What is wallpaperfm.py ?

Wallpaperfm.py is a Python script that generates desktop wallpapers from your last.fm music profile. It runs on linux but should run just as well on Mac and Windows.

Here are examples of what it does with my profile, using the default parameters:-

Inspiration: Gijsco's Last.fm Desktop Generator for the use of last.fm data, and Jamie Zawinski's webcollage, for the collage mode.

File

The script can be found here. Download it, make it executable (chmod a+x wallpaperfm.py) and run it from the command line. With no argument, wallpaperfm.py shows some examples and instructions.
[Show source]

Requirements

Apart from a last.fm account and an active internet connection, you only need Python and the Python Imaging Library (PIL) to run the script. Python, a powerful and beautiful scripting language, and the PIL are usually installed by default on linux systems. If not, Ubuntu users will find both of them on synaptic. Mac and Windows can also run Python and I'd love to hear from their users and know how well the script works on these systems.

Installation

Here is a quick way to install and try out wallpaperfm.py (linux and mac):
cd
mkdir wallpaperfm
cd wallpaperfm
wget http://ledazibao.free.fr/wallpaperfm/wallpaperfm.py
chmod a+x wallpaperfm.py
./wallpaperfm.py -u YOURLASTFMUSERNAME

Developpers! I'm always happy when people build on my own version (see two examples in the 'TIPS' section). The code is on github at http://github.com/Koantig/wallpaperfm as well if you want to use git.

git clone git@github.com:Koantig/wallpaperfm.git 

Instructions

By default, a 1280x1024 image is produced, using the Tile mode and the list of your overall 50 favorite albums. Running ./wallpaperfm.py will show you all the parameters available. The long list of switches can be a bit daunting at first but don't be overwhelmed by it: most defaults are ok and you'll probably just want to change the mode ('tile','glass' or 'collage') and the size of the image.
Here are the parameters common to all modes. Specific parameters are described in the sections Tile, Glass and Collage

Mode

The script can generate 3 different wallpapers. Select the one you want between 'tile', 'glass' and 'collage' with '-m' or '--Mode'. The default mode is 'tile'. E.g. ./wallpaperfm.py -m glass

Image size

The size of the final image is controlled by '-i' or '--ImageSize'. Use the format numberxnumber to specify the size you want. For example: ./wallpaperfm.py -i 800x600 will produce a 800x600 pixel image.

Canvas size

The canvas is the area where the drawing is actually taking place and is controlled by '-c' or '--CanvasSize' By default, it has the same size as the image but you can change that to obtain different effects, like restricting the drawing to a small portion of the screen, or drawing outside the limit of the image.

For example:

Username

Specify the username with '-u' or '--Username'. Ex.:./wallpaperfm.py -u Koant

Filename

The default filename is username.jpg. You can change to whatever you want with '-f' or '--Filename'. Ex.: ./wallpaperfm.py -f mywallpaper. The .jpg extension will be added automatically.

Profile period

By default, the program fetches your overall favorite albums. You can change that to either 3, 6 or 12 months with the '-t' or '--Past' switch. Ex.: ./wallpaperfm.py -t 3month. Use one of '3month', '6month', '12month' and 'overall'.

Final Opacity

Use this option to darken the image a bit so that it's not too distracting as a desktop wallpaper. Use a value between 0 and 100, 0 meaning that the image is completely black. The default is 80 and you control it with '-O' or '--FinalOpacity'. Ex.: ./wallpaperfm.py -O 30

Cache

The albums are stored in a cache directory and are not downloaded again if there are available. The default cache is called wpcache. You can change that with the '-e' or '--Cache' switch. Ex.:./wallpaper -e tmp

Excluded albums

You can exclude albums from the process by using the '-x' or '--ExcludedList'. There is one URL that is excluded by default: http://cdn.last.fm/depth/catalogue/noimage/cover_med.gif, which is the last.fm generic cover.

Local copy

By using '-l' or '--Local', you are using a local copy of the charts, from the last time you used the script. Doing so is faster than having to go and fetch the profile on the web, and allows you to use the script offline.