Skip to content

Instantly share code, notes, and snippets.

@dvdsgl
Created July 24, 2009 03:39
Show Gist options
  • Save dvdsgl/153825 to your computer and use it in GitHub Desktop.
Save dvdsgl/153825 to your computer and use it in GitHub Desktop.
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