You are not logged in.

#1 2010-03-08 22:02:29

Ryuujin
Member
Registered: 2009-07-04
Posts: 31

Shell-fm + Lyrics?

Hey guys:

Shell.FM is a simple console-based player for Last.FM radio streams. It's easy to use (if you can remember some keys), has a light memory footprint, it has only one real dependency (libmad is required for playback, libao is optional), and it supports most of the features the official Last.FM player has, plus some more.

http://shell-fm.wikidot.com/about

I would like to make a script that prints the lyrics of the currently playing song. Any suggestions/ideas on how to get the string that has the artist name and the song title?

shell-lyrics.py

import urllib2
from BeautifulSoup import BeautifulSoup 

title = str(???)

artist = str(???)

magic_url = ("http://www.lyricsplugin.com/winamp03/plugin/?artist="+artist+"&title="+title).replace(" ","%20")

url = urllib2.urlopen(magic_url)
soup = BeautifulSoup(url)
url.close()

htmlSoup = soup.findAll('div', id="lyrics")

print  str(htmlSoup).replace("<br />","").replace("</div>]","").replace("[<div id=\"lyrics\">","")
print "Source: "+magic_url

Thanks !

Offline

#2 2010-06-12 01:35:37

evilgnome
Member
Registered: 2009-02-20
Posts: 62

Re: Shell-fm + Lyrics?

If you control Shell.FM through a socket or netcat, you can query it for information. Check out the man page and look at this: http://shell-fm.wikidot.com/hack:get-so … -with-nall

You can also have Shell.FM run arbitrary commands whenever a song starts, specified in the rc file. These commands can include track info variables.

I have a Python Shell.FM controller project you can use for even closer examples; look at this Lastfm class, primarily the methods shellfm, get_artist and get_track: http://bitbucket.org/EvilGnome/chipmunk … .py#cl-126

I know this post is a bit old, but I hope this helps.

EDIT: I just wanted to thank you for pointing me to that lyrics site, I just integrated it into my program. Do you know who created it? I'd like to ask permission and thank the person, but I don't see any info on the site.

Last edited by evilgnome (2010-06-17 00:13:10)

Offline

Board footer

Powered by FluxBB