d6f1f9d14b82

Factor out itunes and fix search styles.
[view raw] [browse files]
author Steve Losh <steve@stevelosh.com>
date Mon, 03 Oct 2011 20:18:16 -0400
parents e3e497ef8f62
children 77f9ac55543d
branches/tags (none)
files resources/public/css/style.less src/newseasons/itunes.clj src/newseasons/views/main.clj

Changes

--- 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;
+        }
+    }
+}
--- /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)))
+
+
--- 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!")