Lyricsdownloader for Conky

Conky

Source (link to git-repo or to original if based on someone elses unmodified work): Add the source-code for this project on opencode.net

1
5 .0
Description:

This is a python script that will download lyrics for the song playing in Amarok 1.4x, Amarok 2, Rhythmbox, Audacious, Banshee, Exaile, Gmusicbrowser, Juk, Quod Libet, Listen, Songbird, Muine, Beep Media Player, and MPD and display the lyrics on your desktop with conky.

Both the deb and the tar include an example conkyrc file. The deb installs this in /usr/share/doc/lyricsdownloader/ .

For Amarok 2, Gmusicbrowser, Songbird, Audacious, Juk, BMP, Muine, Exaile, Listen, Quod Libet, Banshee or Rythmbox support, you need python-dbus installed. For MPD support, you must
have MPC also installed. Songbird also requires the extension 'dbusbird'. If you run this from your own conkyrc, make sure that text_buffer_size is set to a high enough value or the lyrics will be cut off. In the example conkyrc it's set to 6076.

If your favorite media player is not supported, leave a comment, and I'll see what I can do.

Requirements: python, beautifulsoup, python-dbus

NOTE: The album art in the screenshots is displayed with a separate superkaramba theme for Amarok 2. It's available here: http://kde-look.org/content/show.php/Amarok+2+Simple?content=93541
Last changelog:

11 years ago

0.9.7
This is just a small change, but it should fix most of the problems that people are having with the lyrics.

0.9.6
The previous version quit working because lyricwiki was forced to shut down their API. This version fetches the web page and scrapes it for the lyrics. There still may be bugs. This version requires the python module beautifulsoup. In Debian and Ubuntu, the package is called python-beautifulsoup.

This version also adds the options "--artist" and "--songname" which can be used to fetch lyrics independently of any music players.
0.9.4
Added an alignment option, -a or --align. To use, you need to specify a conky alignment variable to use. Example: lyricsdownloader -a '${alignc}'

The single quotes around the setting are important. Otherwise, the shell will try to expand the variable.

What this does is output '${alignc}' (or whatever you choose) in front of each line so it's necessary to use ${execpi} in your conkyrc.
0.9.3
This update adds some bug fixes for Amarok 1.x. It also adds several new options. Lyricsdownloader can now output other information from the player along with the lyrics, like the song name, duration, position, volume. You can even specify a template file to format the output.
0.9.0
This one is a big update. I added support for Muine and Beep Media Player. Theres also now command line options.
Some of the cool things you can do with these options are that you can point it at a particular MP3 file with the -f switch and it will download the lyrics for that song. You can use the -d switch and download the lyrics for all the songs in a directory. You can use the -o switch to tell it where to download the lyrics to. For example, you can enter a directory for a specific album and run 'lyricsdownloader -d -o .' and it will download the lyrics for that album and store them in that directory.
0.8.5
Added some things to help with debugging.
0.8.4
Should install on 64 bit now.
0.8.3
Version checking broke with the Amarok 2.0 release.
0.8.2
Initial Release

C

downdiagonal

11 years ago

I just updated. Check out the new version and the change log. You should be able to get lyricsdownloader to output a conky alignment setting now. In your case, your conkyrc should look something like this:
Quote:${font}${execpi 10 ~/.scripts/lyricsdownloader.py -a '${alignc}' | fold -sw60 }${font}

Report

Emperor1982

11 years ago

I give it up...thank you anyway ;)

Report

Emperor1982

11 years ago

Sorry...but what is the "PrintLyrics"-command?

Report

RuleMaker

11 years ago

Very nice but...if the lyrics are too long a part of them goes under my panel.
Is there a way to add a scroll to it or something like that?

Report

jameshardy88

11 years ago

i have not yet managed it myself but i have seen someone else make it spill over into an additional column, as it is in conky i don't think you will be able to add a scroll or anything unfortunately

Report

C

downdiagonal

11 years ago

I hope you managed to get it working at all. I totally missed your previous comment. About getting it to display in two columns, that's done by using the -c and -t switches and running two separate conkys. The first conky would use something like "lyricsdownloader -c 50" and the second one would use "lyricsdownloader -t 50". That way, if the lyrics are more than 50 lines, the second conky displays everything after the 50th, but disappears otherwise.

Report

jameshardy88

11 years ago

Sorry im still abit confused I've tried adding the code into the script in various ways however I've not had any luck. Does it need to be in the code at all replacing th -sw60 part of

"${font}${execi 10 lyricsdownloader | fold -sw60 }${font}"

or is it a change you make when executing it more like...

conky -c .conkylyrics -c 50

?

Report

C

downdiagonal

11 years ago

You would use it like this:
Quote:${font}${execi 10 lyricsdownloader -c 50 | fold -sw60 }${font}
or you can just drop the fold altogether like this:
Quote:${font}${execi 10 lyricsdownloader -c 50 }${font}
The fold command just makes sure that no line exceeds 60 characters. Sometimes the lyrics returned have long lines that make your conky grow horizontally.

Report

jameshardy88

11 years ago

Hi i've got the conkylyrics file working ##9it comes up as a transparent space on my desktop, however it won't find the script, im getting this message on repeat in the terminal...

sh: lyricsdownloader: not found

in desperation i have made 3 copies of the script and placed them in my home folder, my scripts folder and a .scripts folder however it still can't find it, do i need it in my filesystem or something?

Report

bjstirling

11 years ago

Just getting into conky and found your script. It works great, thanks for making it available.

I initially used the .deb file but it didn't work since it put the lyricsdownloader.py file in the usr/local/bin folder and I never did find the .conkylyrics file. Reading the comments I found enough info to install manually and it was very easy.

Thanks again!!

Report

Linux-World

11 years ago

Hi, great job my friend! ;)

It was working great for many songs, but theres a bug when playing songs of AC/DC, it seems like the problem is the "/", here it is the message displayed by the terminal:

Quote:
xxxx@xxxx-laptop:/media/disk/Descargas/Conky Lyrics$ conky -c /usr/share/doc/lyricsdownloader/conkylyrics
Conky: desktop window (1400076) is subwindow of root window (87)
Conky: window type - normal
Conky: drawing to created window (3a00001)
Conky: drawing to double buffer
Traceback (most recent call last):
File "/usr/local/bin/lyricsdownloader", line 220, in <module>
os.mkdir(lyrics_folder)
OSError: [Errno 2] No such file or directory: '/home/reobatux/.lyrics/ac/dc'
Traceback (most recent call last):
File "/usr/local/bin/lyricsdownloader", line 220, in <module>
os.mkdir(lyrics_folder)
OSError: [Errno 2] No such file or directory: '/home/reobatux/.lyrics/ac/dc'
Traceback (most recent call last):
File "/usr/local/bin/lyricsdownloader", line 220, in <module>
os.mkdir(lyrics_folder)
OSError: [Errno 2] No such file or directory: '/home/reobatux/.lyrics/ac/dc'
/usr/share/doc/lyricsdownloader/


One more question; In the images previews, there's an album picture of the song over the lyrics, how can i make it work?

Sorry for my english, i need to practice it more lol.

Greetings from Mexico ;)

Report

Linux-World

11 years ago

Sorry i forgot to specify my media player, im using Audacious 1.5.0, Ubuntu 8.04, i used the deb for the installation.

Report

C

downdiagonal

11 years ago

Thanks for the bug report. This is a problem I came across a while back and fixed it for songnames, but not artist names for some reason. If you download the latest version, it should be fixed. :)

Report

Linux-World

11 years ago

Hi, I fixed the bug by myself but, i dont know if the solution is good enoguh lol, at leats works for me :P

Here it is what i do...Oh yes, i only fixed it for the case when the artist is AC/DC LOL

Quote:
#make names lowercase for folders and remove trailing newlines
artistname = artistname.strip().lower()
if artistname == "ac/dc":
artistname = "acdc"
songname = songname.strip().lower()


Im just showing how i did it, i hope this doesnt bother you...

Greetings and thanks, i was waiting for something like this for long time ;)

Report

Linux-World

11 years ago

Hi, I fixed the bug by myself but, i dont know if the solution is good enoguh lol, at leats works for me :P

Here it is what i do...Oh yes, i only fixed it for the case when the artist is AC/DC LOL

Quote:
#make names lowercase for folders and remove trailing newlines
artistname = artistname.strip().lower()
if artistname == "ac/dc":
artistname = "acdc"
songname = songname.strip().lower()


Im just showing how i did it, i hope this doesnt bother you...

Greetings and thanks, i was waiting for something like this for long time ;)

Report

C

downdiagonal

11 years ago

Also, as far as the cover art goes, I don't think that audacious handles that in any way, so I don't think there's any easy way to do that. Many of the other programs have various widgets and plugins to display the cover art.

Report

Linux-World

11 years ago

Thanks, i will change it right now, My solution is very poor lol, i knew the REPLACE function, but not in Python...

Oh yes, after i read your comment i noticed about the covert art thing and that only works with amarok, its ok, the lyrics is just enough for me.

Oh, excuseme but one other thing, how can i change the color of the text?

Report

C

downdiagonal

11 years ago

In my opinion, a temporary hack to fix a problem is better than nothing. The svn version of my script actually has a whitelist of acceptable characters, and anything that's not in that list just gets dropped out. It's somewhat similar to your solution, just more generic.

As far as changing the text color, you'll need to edit the conkyrc. You need to change this line:

Quote:${font}${execi 10 lyricsdownloader | fold -sw60 }${font}

To this:
Quote:${font}${color 000000}${execi 10 lyricsdownloader | fold -sw60 }${font}

Where 000000 is the hex code for the color you want. Like ffffff for white and ff0000 for red and 00ff00 for green and so on. It's just HTML notation. You can also just change the value for default_color in the file if that's easier for you. Let me know if you have any more problems.

Report

C

downdiagonal

11 years ago

In my opinion, a temporary hack to fix a problem is better than nothing. The svn version of my script actually has a whitelist of acceptable characters, and anything that's not in that list just gets dropped out. It's somewhat similar to your solution, just more generic.

As far as changing the text color, you'll need to edit the conkyrc. You need to change this line:

Quote:${font}${execi 10 lyricsdownloader | fold -sw60 }${font}

To this:
Quote:${font}${color 000000}${execi 10 lyricsdownloader | fold -sw60 }${font}

Where 000000 is the hex code for the color you want. Like ffffff for white and ff0000 for red and 00ff00 for green and so on. It's just HTML notation. You can also just change the value for default_color in the file if that's easier for you. Let me know if you have any more problems.

Report

C

downdiagonal

11 years ago

The newest version does fix this problem. I tried it myself with ac/dc. Maybe it didn't install correctly, but if you want to fix it for any artist that contains a backslash, you should change this line:

Quote:lyrics_folder = work_folder+'/'+ artistname[:128]

to this:

Quote:lyrics_folder = work_folder+'/'+ artistname[:128].replace("/","%")

The next version will do a much better job of sanitizing filenames.

Report

Linux-World

11 years ago

I did download the deb again, install it again, but the problem still continues...with same error message.
or the fix is on the tar.bz2 file?

Thanks in Advance :)

Report

too5hort

11 years ago

take a look at this http://ubuntuforums.org/showthread.php?p=6381406#post6381406

Problem solved with i updated too amarok 2

Report

glutsemi

11 years ago

Basic question : how do you install it and how do you make it work?

Report

C

downdiagonal

11 years ago

If you download the tar, you can just drop lyricsdownloader.py in ~/.scripts
Then you can run the included conkyrc with the command: conky -c .conkylyrics

If you install with the deb, you can just run the conkyrc installed in /usr/share/doc/lyricsdownloader/conkylyrics : conky -c /usr/share/doc/lyricsdownloader/conkylyrics

Report

too5hort

11 years ago

Hmm i also need installation help, i alredy have a conky script, and when i put the scripts in .script folder and run it, nothing happens besides a bounce of errors. Please help

Report

11 years ago

0.9.7
This is just a small change, but it should fix most of the problems that people are having with the lyrics.

0.9.6
The previous version quit working because lyricwiki was forced to shut down their API. This version fetches the web page and scrapes it for the lyrics. There still may be bugs. This version requires the python module beautifulsoup. In Debian and Ubuntu, the package is called python-beautifulsoup.

This version also adds the options "--artist" and "--songname" which can be used to fetch lyrics independently of any music players.
0.9.4
Added an alignment option, -a or --align. To use, you need to specify a conky alignment variable to use. Example: lyricsdownloader -a '${alignc}'

The single quotes around the setting are important. Otherwise, the shell will try to expand the variable.

What this does is output '${alignc}' (or whatever you choose) in front of each line so it's necessary to use ${execpi} in your conkyrc.
0.9.3
This update adds some bug fixes for Amarok 1.x. It also adds several new options. Lyricsdownloader can now output other information from the player along with the lyrics, like the song name, duration, position, volume. You can even specify a template file to format the output.
0.9.0
This one is a big update. I added support for Muine and Beep Media Player. Theres also now command line options.
Some of the cool things you can do with these options are that you can point it at a particular MP3 file with the -f switch and it will download the lyrics for that song. You can use the -d switch and download the lyrics for all the songs in a directory. You can use the -o switch to tell it where to download the lyrics to. For example, you can enter a directory for a specific album and run 'lyricsdownloader -d -o .' and it will download the lyrics for that album and store them in that directory.
0.8.5
Added some things to help with debugging.
0.8.4
Should install on 64 bit now.
0.8.3
Version checking broke with the Amarok 2.0 release.
0.8.2
Initial Release

12345678910
product-maker Base: 4 x 5.0 Ratings
Be the first to comment
jameshardy88
May 01 2009
File (click to download) Version Description Downloads Date Filesize DL OCS-Install MD5SUM
*Needs pling-store or ocs-url to install things
Pling
0 Affiliates
Details
license
version
0.9.7
updated Aug 11 2009
added Dec 02 2008
downloads 24h
0
mediaviews 24h 0
pageviews 24h 0