Desktop pictures from Flickr, using Magpie and OS X

A script for use with Magpie RSS parser, running locally. Set the username for the download directory (you might have to create the directory first, too), then add RSS feed URLs as you wish (they're at the bottom of most Flickr pages).

Add something like: 15 15 * * * php /Library/WebServer/Documents/magpie/flickr.php to your crontab, and it will run once a day, fetching the RSS feeds and downloading all the new pictures to a folder, which you can then set as your Desktop Pictures folder. Set the picture to change every 15 minutes, and make sure it's centred not stretched.

define('MAGPIE_DIR', '/Library/WebServer/Documents/magpie/');
require_once(MAGPIE_DIR.'rss_fetch.inc');
$feeds = array(
    'http://www.flickr.com/services/feeds/photos_public.gne?tags=garden&format=rss_200',
    'http://www.flickr.com/services/feeds/photos_public.gne?id=59904640@N00&format=rss_200',
    'http://www.flickr.com/services/feeds/photos_public.gne?id=51035609472@N01&format=rss_200',
    'http://www.flickr.com/services/feeds/photos_public.gne?id=54289096@N00&format=rss_200',
    'http://www.flickr.com/services/feeds/photos_public.gne?id=49503155549@N01&format=rss_200'
);
foreach ($feeds as $url) {
    $rss = fetch_rss($url);
    $items = $rss->items;
    foreach ($items as $item) {
        $description = $item['description'];
        if (preg_match("/www.flickr.com\/photos\/(\w*?)_m.jpg/", $description, $matches)){
            $img_url = "http://www.flickr.com/photos/$matches[1]_o.jpg";
            $filename = "/Users/YOUR_USERNAME/Pictures/flickr/$matches[1].jpg";
            if (file_exists($filename) == 0){
                system ( "wget $img_url --quiet -O $filename" );
            }
        }
    }
}