# HG changeset patch # User Steve Losh # Date 1317867588 14400 # Node ID 279de613dd936b2a2f90aa9894c35962e3b6e080 # Parent a7d0d997f5206ec5ffe987e360a6c7d85eda48f0 Wrap the http requests to apple. diff -r a7d0d997f520 -r 279de613dd93 src/newseasons/itunes.clj --- a/src/newseasons/itunes.clj Wed Oct 05 22:05:24 2011 -0400 +++ b/src/newseasons/itunes.clj Wed Oct 05 22:19:48 2011 -0400 @@ -5,9 +5,12 @@ (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 @@ -17,10 +20,13 @@ (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")] diff -r a7d0d997f520 -r 279de613dd93 src/newseasons/loops/refresh.clj --- a/src/newseasons/loops/refresh.clj Wed Oct 05 22:05:24 2011 -0400 +++ b/src/newseasons/loops/refresh.clj Wed Oct 05 22:19:48 2011 -0400 @@ -47,7 +47,7 @@ (Thread/sleep 10000))) (defn- refresh [] - (println "") + (println "\n\n") (println "Refreshing Shows") (println "----------------") (Thread/sleep 20000)