GSPlyrics.pl PERL script

Talk about anything!

Moderator: Station Managers

GSPlyrics.pl PERL script

Postby Xebinon » Thu Jun 25, 2009 2:23 am

I wrote this PERL script a while back, just for myself, to make it easier to find lyrics to some of the songs I had trouble following. It gradually evolved into something that let me post links to the lyrics and then when Lykeios posted his posters for all the DJs, I added the ability to set my Windows background to one of those based on the stream title. There was enough interest in it that I took the time to rewrite it into something that would be usable for someone else, as long as they have PERL to run it with and can configure it in standard PERL syntax.

It is not an Anarchy Online script. It will not run in AO. Don't put it in your Scripts folder.

This is a PERL script. I use it with ActivePerl, but it should work with any PERL for Windows. ActivePerl is free. You can get it at http://www.activestate.com/activeperl/ Installing it is pretty simple, for a programming language.

Once you have PERL, you can just download this zip, extract the script and its example configuration file, and save them anywhere you like. Just double-click GSPlyrics.pl to run it. I keep mine in my "My Documents" folder to keep it easily accessible for more editing, but there should be no need for you to edit the script to use it. It will look for the configuration file in the same directory it is run from. You can use that file to set all the configuration variables. They are described in detail at the beginning of the script and in the example configuration file.

This script relies on the "/gsp" script that GridStream Player generates, so you will have to have GridStream Player running, with the script option enabled, to use it. It reads that script every time it changes and picks out the song title and artist and the stream name.

It uses the stream name to choose a folder to look for background images in. For example, as I type this, the stream title is "Lyk's Fuzzy Playlist" and there is an Alias defined for "Lyk" => "Lykeios", so the script went to the "Lykeios" folder under "C:\Program Files\GridStream\images" and picked a .bmp file to set as the background. The location to look for the DJ subfolders in is configurable, as are the aliases. You can also just turn that function completely off if you don't want it or haven't downloaded all the pretty pictures Lyk made for us.

It uses the song title and artist to search three different lyrics sites and generate results summaries with links. Most songs have far too many words to just put them all in an infotext window in AO. Which lyrics sites to search and how to search them and interpret the results is configurable, but involves a bunch of PERL regular expressions. If you don't know what that means, just stick with the defaults, which I've found reasonably effective so far: LyricsMode, MetroLyrics, and AbsoluteLyrics.

Once the matches (if any) have been found and interpreted, the results are pasted into some configurable output templates to generate scripts that will be available in the AO client. By default, these are:

/lyrics: /me sings along, with a link to the results
/checklyrics: /text results display, only visible to you
/llyrics: /me looks up the lyrics (showing the results without singing along)

And one infotext page (CheckLyrics.html) that you can open with a macro (/macro ShowL /showinfo CheckLyrics.html), to just see it yourself with a single click.

When all that is done, it returns to waiting and watching the /gsp script until it changes again and starts the whole process over.

If you're interested in this script and can't get it to work, let me know here or ask Jezebelle (RK1) or Kalissa (RK2) or anyone else you see using it. It'll probably be pretty obvious who got it working.
Attachments
GSPlyrics.zip
GSPlyrics.pl PERL script
(8.86 KiB) Downloaded 112 times
Do not try to think outside the box, for that is impossible. Simply realize the truth; there is no box.
Xebinon
 
Posts: 184
Joined: Thu Mar 13, 2008 8:51 pm
Location: nowhere important

Return to General/Discussion

Who is online

Users browsing this forum: No registered users and 21 guests

cron