Skip to content

Instantly share code, notes, and snippets.

@mbriggs
Created August 2, 2013 20:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mbriggs/6143061 to your computer and use it in GitHub Desktop.
Save mbriggs/6143061 to your computer and use it in GitHub Desktop.
(ns scrape-kuvva.core
(:require [scrape-kuvva.kuvva :as kuvva])
(:require [scrape-kuvva.files :as files]))
(def timeout 2000)
(defn sync
"Download any wallpaper that is
a) downloadable
b) not already downloaded"
[]
(doseq [wallpaper (kuvva/wallpapers)]
(when (not (files/already-downloaded? wallpaper))
(println (str "downloading " wallpaper))
(let [request (kuvva/get wallpaper)]
(if (kuvva/successful? request)
(files/write wallpaper (:body request))
(println (str "Could not download, status: " (:status request)))))
(Thread/sleep timeout))))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment