Commits

Steve Losh committed 279de61

Wrap the http requests to apple.

  • Participants
  • Parent commits a7d0d99

Comments (0)

Files changed (2)

File src/newseasons/itunes.clj

 
 
 (defn itunes-search [params]
-  ((parse-string (:body (client/get "http://itunes.apple.com/search"
-                                    {:query-params params})))
-     "results"))
+  (try
+    ((parse-string (:body (client/get "http://itunes.apple.com/search"
+                                      {:query-params params})))
+       "results")
+    (catch java.lang.Exception e
+      (println "Failed request to " (:url (.data e))))))
 
 (defn itunes-search-show [query]
   (itunes-search {"term" query
 
 
 (defn itunes-lookup [field id entity]
-  ((parse-string (:body (client/get "http://itunes.apple.com/lookup"
-                                    {:query-params {field id
-                                                    "entity" entity}})))
-     "results"))
+  (try
+    ((parse-string (:body (client/get "http://itunes.apple.com/lookup"
+                                      {:query-params {field id
+                                                      "entity" entity}})))
+       "results")
+    (catch java.lang.Exception e
+      (println "Failed request to " (:url (.data e))))))
 
 (defn itunes-lookup-seasons [id]
   (let [results (itunes-lookup "id" id "tvSeason")]

File src/newseasons/loops/refresh.clj

     (Thread/sleep 10000)))
 
 (defn- refresh []
-  (println "")
+  (println "\n\n")
   (println "Refreshing Shows")
   (println "----------------")
   (Thread/sleep 20000)