Announcement

Collapse
No announcement yet.

Script to download bing desktops?

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Script to download bing desktops?

    Hi guys,

    I'm trying to download the daily bing wallpapers, but so far I'm SOL for KDE. I found a Suse script, but requires libraries from Suse and crashes. Did you ever come around any nice script that downloads the wallpapers for KDE? I know for gnome it works just fine.

    Thank you!

    #2
    Boilerplate version...

    OpenSuse: http://forums.opensuse.org/showthrea...ktop-wallpaper


    Downloading the:
    - bing_wallpaper.sh
    - kde4_set_wallpaper.sh

    Looking the scripts - Notes:

    Kubuntu is Debian based - we are not using the zypper
    => You will need to install

    - xdotool
    - gettext-base


    I only have the KDE -> removing the generic DE parts + removing lot of stuff...

    What was left

    Code:
    #!/bin/sh
    # Author: Marguerite Su <i@marguerite.su>
    # Version: 1.0
    # License: GPL-3.0
    # Description: Download Bing Wallpaper of the Day and set it as your Linux Desktop.
    
    # $bing is needed to form the fully qualified URL for
    # the Bing pic of the day
    bing="www.bing.com"
    
    # The mkt parameter determines which Bing market you would like to
    # obtain your images from.
    # Valid values are: en-US, zh-CN, ja-JP, en-AU, en-UK, de-DE, en-NZ, en-CA.
    mkt="zh-CN"
    
    # The idx parameter determines where to start from. 0 is the current day,
    # 1 the previous day, etc.
    idx="0"
    
    # $xmlURL is needed to get the xml data from which
    # the relative URL for the Bing pic of the day is extracted
    xmlURL="http://www.bing.com/HPImageArchive.aspx?format=xml&idx=$idx&n=1&mkt=$mkt"
    
    # The file extension for the Bing pic
    picExt=".jpg"
    
    
    # Download the highest resolution
    
        
    for picRes in _1920x1200 _1366x768 _1280x720 _1024x768; do
    
       # Extract the relative URL of the Bing pic of the day from
       # the XML data retrieved from xmlURL, form the fully qualified
       # URL for the pic of the day, and store it in $picURL
       picURL=$bing$(echo $(curl -s $xmlURL) | grep -oP "<urlBase>(.*)</urlBase>" | cut -d ">" -f 2 | cut -d "<" -f 1)$picRes$picExt
    
       # $picName contains the filename of the Bing pic of the day
        picName=${picURL#*2f}
    
        # Download the Bing pic of the day
        curl -s -o "/usr/local/bing/DailyPicture.jpg" $picURL
    
    
        if file "/usr/local/bing/DailyPicture.jpg" | grep JPEG ; then break ; fi
    done
    The code will download the Daily picture information from the http://www.bing.com/HPImageArchive.aspx and parse the image link. The script will download the image to the '/usr/local/bing/DailyPicture.jpg'.


    Testing

    Using anacron: http://askubuntu.com/questions/90816...-execution-tim

    Checking that the script is executable.
    Dropping the script (my_bing_wallpaper) to the /etc/cron.daily/.



    Making the /usr/local/bing/ directory.

    Testing the anacron:

    :~$ sudo anacron -f -d
    [sudo] password for rog132:
    Anacron 2.3 started on 2014-02-04
    Will run job `cron.daily' in 5 min.
    Will run job `cron.weekly' in 10 min.
    Will run job `cron.monthly' in 15 min.
    Job `cron.daily' started
    Job `cron.daily' terminated
    Normal exit (1 job run)
    The daily picture is there:



    Adding the /usr/local/bing/ to the KDE wallpapers.



    Seems to work at here...



    may or may not work there.
    Last edited by Rog132; Feb 08, 2014, 06:20 AM.
    A good place to start: Topic: Top 20 Kubuntu FAQs & Answers
    Searching FAQ's: Google Search 'FAQ from Kubuntuforums'

    Comment

    Working...
    X