Skip to content

Commit

Permalink
Ensure metadata for displaying links
Browse files Browse the repository at this point in the history
  • Loading branch information
hudren committed Jan 29, 2015
1 parent 869b5fd commit e08b6a2
Showing 1 changed file with 11 additions and 10 deletions.
21 changes: 11 additions & 10 deletions src/video_server/html.clj
Original file line number Diff line number Diff line change
Expand Up @@ -55,16 +55,17 @@
(defn video-links
"Returns a sequence of links for the video."
[info]
(vector
(when (:website info) (video-link (:website info) "Website" "home"))
(when (:trailer info) (video-link (:trailer info) "Trailer" "theaters"))
(when (:wikipedia info) (video-link (:wikipedia info) "Wikipedia"))
(if (:imdb-id info)
(video-link (str "http://www.imdb.com/title/" (:imdb-id info)) "IMDb")
(video-link (str "http://www.imdb.com/find?q=" (URLEncoder/encode (:title info) "UTF-8")) "IMDb" "search"))
(if (:netflix-id info)
(video-link (str "http://dvd.netflix.com/Movie/" (:netflix-id info)) "Netflix")
(video-link (str "http://dvd.netflix.com/Search?v1=" (URLEncoder/encode (:title info) "UTF-8")) "Netflix" "search"))))
(when (seq (select-keys info [:website :trailer :wikipedia :imdb-id :netflix-id]))
(vector
(when (:website info) (video-link (:website info) "Website" "home"))
(when (:trailer info) (video-link (:trailer info) "Trailer" "theaters"))
(when (:wikipedia info) (video-link (:wikipedia info) "Wikipedia"))
(if (:imdb-id info)
(video-link (str "http://www.imdb.com/title/" (:imdb-id info)) "IMDb")
(video-link (str "http://www.imdb.com/find?q=" (URLEncoder/encode (:title info) "UTF-8")) "IMDb" "search"))
(if (:netflix-id info)
(video-link (str "http://dvd.netflix.com/Movie/" (:netflix-id info)) "Netflix")
(video-link (str "http://dvd.netflix.com/Search?v1=" (URLEncoder/encode (:title info) "UTF-8")) "Netflix" "search")))))

(defn- video-type
"Conditionally promotes the video type for better web playability."
Expand Down

0 comments on commit e08b6a2

Please sign in to comment.