# HG changeset patch # User Steve Losh # Date 1317687496 14400 # Node ID d6f1f9d14b825149f6a94dd5f5d1f9003d73eade # Parent e3e497ef8f629723cae1181eec9890c0626f2c14 Factor out itunes and fix search styles. diff -r e3e497ef8f62 -r d6f1f9d14b82 resources/public/css/style.less --- a/resources/public/css/style.less Mon Oct 03 20:15:07 2011 -0400 +++ b/resources/public/css/style.less Mon Oct 03 20:18:16 2011 -0400 @@ -135,3 +135,11 @@ } } } +.search { + li.show { + form { + margin-top: 17px; + margin-bottom: 0px; + } + } +} diff -r e3e497ef8f62 -r d6f1f9d14b82 src/newseasons/itunes.clj --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/src/newseasons/itunes.clj Mon Oct 03 20:18:16 2011 -0400 @@ -0,0 +1,26 @@ +(ns newseasons.itunes + (:require [clj-http.client :as client]) + (:use [cheshire.core :only (parse-string)])) + + +(defn itunes-search [params] + ((parse-string (:body (client/get "http://itunes.apple.com/search" + {:query-params params}))) + "results")) + +(defn itunes-search-show [query] + (itunes-search {"term" query + "media" "tvShow" + "entity" "tvSeason" + "attribute" "showTerm"})) + + +(defn itunes-lookup [field id] + ((parse-string (:body (client/get "http://itunes.apple.com/search" + {:query-params {field id}}))) + "results")) + +(defn itunes-lookup-artist [id] + (first (itunes-lookup "id" id))) + + diff -r e3e497ef8f62 -r d6f1f9d14b82 src/newseasons/views/main.clj --- a/src/newseasons/views/main.clj Mon Oct 03 20:15:07 2011 -0400 +++ b/src/newseasons/views/main.clj Mon Oct 03 20:18:16 2011 -0400 @@ -1,11 +1,10 @@ (ns newseasons.views.main (:use noir.core) (:use newseasons.utils) + (:use newseasons.itunes) (:require [noir.response :as resp]) (:require [noir.session :as sess]) (:require [noir.util.crypt :as crypt]) - (:require [clj-http.client :as client]) - (:use [cheshire.core :only (parse-string)]) (:require [newseasons.templates.main :as t]) (:require [newseasons.models.shows :as shows]) (:require [newseasons.models.users :as users])) @@ -47,28 +46,6 @@ (defn unique-shows [seasons] (unique-by (sort-maps-by seasons "releaseDate") "artistId")) -; iTunes ---------------------------------------------------------------------- -(defn itunes-search [params] - ((parse-string (:body (client/get "http://itunes.apple.com/search" - {:query-params params}))) - "results")) - -(defn itunes-search-show [query] - (itunes-search {"term" query - "media" "tvShow" - "entity" "tvSeason" - "attribute" "showTerm"})) - - -(defn itunes-lookup [field id] - ((parse-string (:body (client/get "http://itunes.apple.com/search" - {:query-params {field id}}))) - "results")) - -(defn itunes-lookup-artist [id] - (first (itunes-lookup "id" id))) - - ; Authentication -------------------------------------------------------------- (defn force-login [] (flash! "Please log in to view that page!")