Results 1 to 2 of 2

Thread: Fetch daily-updated online image as wallpaper

  1. #1
    Join Date
    Aug 2009
    Beans
    10

    Fetch daily-updated online image as wallpaper

    Hello all,
    just an itch I needed to scratch; there's an image on a website, and it is updated every day (happily using a regular format for its url). I want to fetch this image every day and set it as my desktop background. In my example, the image is the YouGov daily poll ratings for the UK, but I hope this will be helpful for others to adapt.

    Code:
    #!/bin/sh
    mkdir $HOME/pollgrabber
    cd $HOME/pollgrabber
    date +%d --date="yesterday" > date
    echo http://today.yougov.co.uk/sites/today.yougov.co.uk/files/550pxVotIntdategoeshere1010.jpg > templateurl
    cat templateurl | sed "s/dategoeshere/`cat date`/" templateurl > url
    wget $( cat "./url" ) -O today.png
    gconftool-2 --type string --set /desktop/gnome/background/picture_filename "$HOME/pollgrabber/today.png"
    gconftool-2 --type string --set /desktop/gnome/background/picture_options centre
    A quick run-through:

    1. Make a directory for the script to run in, just makes things tidier. Don't worry about running this again, if the folder's already there it doesn't matter.
    2. Change to that directory
    3. Find yesterday's date, i.e. if yesterday was 21st October, a file will be created containing the text 21.
    4. This url will be set as the template for the date to be substituted into
    5. Substitute the "date" file into the template url
    6. Use wget (a downloading tool) to fetch the image
    7. Use gconftool to set the image as the wallpaper
    8. Use gconftool to centre the wallpaper (optional, but probably a good idea with medium-low res images like this one)

    Hope someone finds this useful.
    Attached Files Attached Files

  2. #2
    Join Date
    May 2007
    Location
    127.0.0.1
    Beans
    17
    Distro
    Ubuntu 9.10 Karmic Koala

    Arrow Re: Fetch daily-updated online image as wallpaper

    I had a similar itch to scratch.

    Here: http://github.com/dougle/Remote-Desktop-Background-Sync
    I use cron to set the frequency and the URL etc

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •