Created
August 2, 2013 20:12
-
-
Save mbriggs/6143061 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(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