Sunday, March 11, 2007

wiki_lyrics script enhancement

I hate it when wiki_lyrics fails if a track does not have Artist info. This happens for most of the online radio stations as they send all the track info only in Title metainfo. I modified the script to parse artist info and title info which are separated by a '-' and get the lyrics from that info. Here is the script ...


--- amarokmetalyrics.rb.bak 2007-03-12 00:06:08.213744500 -0500
+++ amarokmetalyrics.rb 2007-03-12 00:06:28.026982750 -0500
@@ -261,11 +261,19 @@
on_configure()
when 'fetchLyrics'
args = message.split()
- if args.length < 3
+ if args.length < 2
Amarok.show_error()
else
artist = Amarok.get_current_artist().to_s()
title = Amarok.get_current_title().to_s()
+ if artist.empty?
+ tmpartist, tmptitle = title.split( '-' )
+ if tmptitle == nil
+ title = tmpartist; artist = '';
+ else
+ title = tmptitle; artist = tmpartist;
+ end
+ end
on_fetch_lyrics(
Strings.cleanup_artist( artist, title ),
Strings.cleanup_title( title ),

1 comment:

Anonymous said...

please, notify me whenever you've got an idea or improvement for wiki-lyrics. i'll be more than glad to check it out and add it to the main release if possible.

sergio pistone