Ubuntu / Linux news and application reviews.

Rhythmbox lastfm playcount

A while back we wrote about a Rhythmbox plugin that synchronizes your Rhythmbox play count with Last.fm and that's pretty cool but the plugin only does this once you play a track. So what if you want to synschronize all your Rhythmbox play counts with Last.fm? Well, there's a script for that (actually 2)!

1. Install the dependencies:

sudo apt-get install python-beautifulsoup python-qt4 bzr

2. Download Lastscarpe from HERE (make sure to download the Linux and not the Windows version) and extract it in your home folder.

3. To get every song you've listened from Last.fm, go the newly extracted folder and you can either run "guy.py" to do this the graphical way or use the following command to dump all your songs to a file called "dump":
cd && cd lastscrape-0.0.4
./lastscrape.py YOUR_LASTFM_USERNAME dump

Now the script will retrieve all your song history. This might take a while (it took more then an hour for all my 54.000 Last.fm songs).

4. You need to download the "rb-mergeplays" scripts from Launchpad:
bzr get lp:rb-mergeplays

Once the scripts are downloaded, copy the file created under step 3 (called "dump" - if you've followed our exact instructions you should find it under ~/lastscrape-0.0.4) into ~/rb-mergeplays

5. At this point you're ready to import the last.fm play count into Rhythmbox

Firstly make a backup of your Rhythmbox library:
cp ~/.local/share/rhythmbox/rhythmdb.xml ~/.local/share/rhythmbox/rhythmdb.xml-backup

Begin the import:
cd ~/rb-mergeplays
python ./mergeplays.py

"rb-mergeplays" contains another interesting script which lets you import your Last.fm loved tracks into Rhythmbox. The process is fairly easy so head over to the rb-mergeplays page for instructions (scroll down to RATE5LOVED.PY).