Created
July 24, 2009 03:39
-
-
Save dvdsgl/153825 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
import System (system) | |
import System.Posix (sleep) | |
import Text.Printf (printf) | |
import Flickr.Monad | |
import Flickr.Types | |
import Flickr.Photos | |
import Flickr.URLs (photoSourceURL) | |
import Flickr.Groups.Pools (getPhotos) | |
image = "/tmp/ubuntu-wallpaper" | |
interval = 10 {-minutes-} * 60 {-seconds-} | |
main = do | |
urls <- flick getPhotoURLs | |
mapM_ (\url -> display url >> sleep interval) (cycle urls) | |
display url = do | |
system $ printf "wget \"%s\" -O %s" url image | |
system $ "gconftool-2 -t str -s /desktop/gnome/background/picture_filename " ++ image | |
getPhotoURLs = getPhotos "556923@N24" [] Nothing [] >>= mapM url | |
where url Photo { photoId = pid } = do details <- getInfo pid Nothing | |
return $ photoSourceURL details PhotoSizeLarge |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment