The Cube - Assimilating Technology

The Cube

Quod Libet with Last.fm

For Humans only


Quod Libet with Last.fm Print E-mail
Friday, 18 April 2008 17:28

Hi,

Recently I moved from using xmms media player to Banshee media player, but soon after
that I moved over to QuodLibet Player.

Banshee was ok, but realy realy slow in handling large music libraries
(something they are working on fixing).

QuodLibet is fast, has really nice search features (especially if you understand regular expressions)
and handles my large library with ease. Added to that is the tag editing control, and also a
large number of available plugins.

It did, however lack one feature that I enjoyed in Banshee - Recommended artists
(which included top songs and albums)

So, I decided to add this feature.

The system is actually very simple. You just have to query www.last.fm's webservices,
which sends back some xml, and you have all that is needed.

Quod Libet 1.x Procedure

 

Quod Libet 2.x Procedure



Quod Libet 1.x

Overview:

This guide will assume that you already got a working QuodLibet installed on your system
(using the debian apt-get/aptitude installer), and that you are using version 1.x

Also note that this method does not patch the language files, so the new feature will
only be in english.

If you are not using debian, or a debian based system, then you can still apply the patches,
but you will have to locate the required files on your file system, and adjust the
patch command accordingly.

 

To enable this feature you have to patch 3 files, and add a new file to your system

The files to patch are:

config.py
quodlibet.py
prefs.py

and the new file is called

recommend.py

Step1: Patch config.py

Download the patch file: quodlibet_config.py.diff , save it in a convenient location.
/tmp is a good place.

cd /tmp
wget http://www.dedmeet.com/files/quodlibet_config.py.diff 

Create a backup file of the original installed quodlibet file

sudo cp /usr/share/quodlibet/config.py  /usr/share/quodlibet/config.py.bak

Patch the original file

sudo patch -p0 -i /tmp/quodlibet_config.py.diff /usr/share/quodlibet/config.py

Result should be

patching file /usr/share/quodlibet/config.py
Step2: Patch main quodlibet program

Download the patch file  quodlibet_quodlibet.py.diff , again save it to /tmp

wget http://www.dedmeet.com/files/quodlibet_quodlibet.py.diff 

Create a backup file of the original installed quodlibet file

sudo cp /usr/share/quodlibet/qltk/quodlibet.py  /usr/share/quodlibet/qltk/quodlibet.py.bak

Patch the original file

sudo patch -p0 -i /tmp/quodlibet_quodlibet.py.diff /usr/share/quodlibet/qltk/quodlibet.py

Result should be

patching file /usr/share/quodlibet/qltk/quodlibet.py
Step3: Patch preferences file

Download the patch file  quodlibet_prefs.py.diff , again save it to /tmp

wget http://www.dedmeet.com/files/quodlibet_prefs.py.diff 

Create a backup file of the original installed quodlibet file

sudo cp /usr/share/quodlibet/qltk/prefs.py  /usr/share/quodlibet/qltk/prefs.py.bak

Patch the original file

sudo patch -p0 -i /tmp/quodlibet_prefs.py.diff /usr/share/quodlibet/qltk/prefs.py

Result should be

patching file /usr/share/quodlibet/qltk/prefs.py
Last step: Copy new file into place

# File history:
# rev 1 2008-04-16 - Initial creation
# rev 1.1 2008-05-13 - Bug fix
#            Eirik Haatveit found two bugs:
#                1. utf-8 (unicode) characters were not submitted correctly - fixed
#                2. & in artist names were not submitted correctly - fixed (caused by bug in last.fm)

Download the new functions file (quodlibet_recommend.py) and save into /tmp

wget http://www.dedmeet.com/files/quodlibet_recommend.py 

Copy the file into the quodlibet folder

sudo cp /tmp/quodlibet_recommend.py  /usr/share/quodlibet/qltk/recommend.py 

Make sure the file is of correct permissions (thank you to Paul Eipper for spotting this)

sudo chmod 644 /usr/share/quodlibet/qltk/recommend.py 

Quod Libet 2.x

Overview:

This guide will assume that you have downloaded the
latest and greatest Quodlibet from their website , and that you installed it in /usr/share as follows:

cd /usr/share
sudo wget http://quodlibet.googlecode.com/files/quodlibet-2.1.tar.gz
sudo tar xvf quodlibet-2.1.tar.gz
sudo rm quodlibet-2.1.tar.gz

This created a new folder called 'quodlibet-2.1'  - This is where the files will be patched.

Also note that this method does not patch the language files, so the new feature will
only be in english.

If you used your linux distro package manager to install, then you can still apply the patches,
but you will have to locate the required files on your filesystem, and adjust the
patch command accordingly.

 

To enable this feature you have to patch 3 files, and add a new file to your system

The files to patch are:

config.py
quodlibetwindow.py
prefs.py

and the new file is called

recommend.py

Step1: Patch config.py

Download the patch file: quodlibet_2_config.py.diff , save it in a convenient location.
/tmp is a good place.

cd /tmp
wget http://www.dedmeet.com/files/quodlibet_2_config.py.diff 

Create a backup file of the original installed quodlibet file

sudo cp /usr/share/quodlibet-2.1/quodlibet/config.py /usr/share/quodlibet-2.1/quodlibet/config.py.bak

Patch the original file

sudo patch -p0 -i /tmp/quodlibet_2_config.py.diff /usr/share/quodlibet-2.1/quodlibet/config.py

Result should be

patching file /usr/share/quodlibet-2.0/quodlibet/config.py
Step2: Patch main quodlibet program

Download the patch file  quodlibet_quodlibetwindow.py.diff , again save it to /tmp

wget http://www.dedmeet.com/files/quodlibet_quodlibetwindow.py.diff

Create a backup file of the original installed quodlibet file

sudo cp /usr/share/quodlibet-2.1/quodlibet/qltk/quodlibetwindow.py \
/usr/share/quodlibet-2.1/quodlibet/qltk/quodlibetwindow.py.bak

Patch the original file

sudo patch -p0 -i /tmp/quodlibet_quodlibetwindow.py.diff  \
/usr/share/quodlibet-2.1/quodlibet/qltk/quodlibetwindow.py

Result should be

patching file /usr/share/quodlibet-2.1/quodlibet/qltk/quodlibetwindow.py
Step3: Patch preferences file

Download the patch file  quodlibet_2_prefs.py.diff , again save it to /tmp

wget http://www.dedmeet.com/files/quodlibet_2_prefs.py.diff

Create a backup file of the original installed quodlibet file

sudo cp /usr/share/quodlibet-2.1/quodlibet/qltk/prefs.py \
/usr/share/quodlibet-2.1/quodlibet/qltk/prefs.py.bak

Patch the original file

sudo patch -p0 -i /tmp/quodlibet_2_prefs.py.diff  \
/usr/share/quodlibet-2.1/quodlibet/qltk/prefs.py

Result should be

patching file /usr/share/quodlibet-2.1/quodlibet/qltk/prefs.py
Last step: Copy new file into place

# File history:
# rev 1 2008-04-16 - Initial creation
# rev 1.1 2008-05-13 - Bug fix
#            Eirik Haatveit found two bugs:
#                1. utf-8 (unicode) characters were not submitted correctly - fixed
#                2. & in artist names were not submitted correctly - fixed (caused by bug in last.fm)

Download the new functions file (quodlibet_2_recommend.py) and save into /tmp

wget http://www.dedmeet.com/files/quodlibet_2_recommend.py 

Copy the file into the quodlibet folder

sudo cp /tmp/quodlibet_2_recommend.py  /usr/share/quodlibet-2.1/quodlibet/qltk/recommend.py 

Make sure the file is of correct permissions (thank you to Paul Eipper for spotting this)

sudo chmod 644 /usr/share/quodlibet-2.1/quodlibet/qltk/recommend.py

How to use:

Once QuodLibet is patched, and started, you will see at the bottom of the screen a
new option (it will always start minimised) - The option is called 'Recommended'.
Click on it, and a new portion of the screen will open.
This will contain three areas: 'Similar Artists', 'Top 10 Songs' and 'Top 10 Albums'.
When a song is played, these areas will be populated with the required information.
You can right-click on any of the entries and select 'Information',
which will open a browser window with information about the item in the last.fm website.
You can also view artist images, and album images.

In the 'Top 10 Songs' list a * next to the song name shows that you have the song
in your collection, and additionally to that, if the song is in an album, then the album
name will be displayed in brackets.

In the 'Top 10 Albums' list a * next to the album name shows that you have the album
(or at least some songs of the album) in your collection.

NOTE:

Since creating this article/patch, I have moved on to using Amarok as my default player.
This means that I am not actively using QuodLibet as a player, which means the patches
could break at some point without me knowing.
Breaking could either be due to QuodLibet code moving along, or the Last.fm api system
moving along.
If you use this patch, and find it no longer works, please do drop me an email, and I will
get onto fixing the issue.

Update 27-07-2009 - Tested patches against the new 2.1 version, and it still works fine.
Updated the article to download and patch version 2.1

Enjoy

 

 

QuodLibet with new Last.fm integration

 

 

Last Updated on Friday, 26 February 2010 07:28
 
Share on facebook