Help:Wiki-Lyrics Script

From Lyriki
Jump to: navigation, search

Wiki-Lyrics is a set of Ruby classes and scripts to interface with various lyrics sites and submit content to Lyriki and LyricWiki, both wikis for lyrics. Wiki-Lyrics can be downloaded from KDE-Apps.

Currently only 2 interfaces exists: an Amarok script and a standalone command line interface. However, the command line interface can be used from Winamp and other Windows players with the help of AMIP plugins, and directly from other Linux players such as Audacious.

Supported Sites

Submitting Policy

  • Always keep your version of the script updated. This ensures submitted content follows the current site guides and reduces the damage to the site caused by bugs in the script or plain obsolesce of the plugins (the parts of it that parse the content of the supported sites --content which is eventually submitted by the script).
  • Properly tag your files, specially if you submit content without reviewing it. You are responsible for the pages the script submits in your behalf.
  • Check your talk page from time to time for any problems someone might have spotted with the script. Update notices and wrongly tagged files warnings will be placed there if necessary.
  • You are free to modify and use the script under the terms of the GPL. However if you use a modified version to submit content, you should also change the way the script identifies its submissions (this helps in identifying sources of problems). Translated, do not impersonate Wiki-Lyrics script. This particularly applies to any mod bypassing the login restriction to submit content. Failure to comply will result in warnings, followed by bans in case of reiteration.

Using Wiki-Lyrics on Windows

This guide intends to explain all steps necesaries to get the script working on Windows. Feel free to expand it if you manage to get it working by tweaking something not explained here. If you're having problems following any of the steps, don't hesitate to ask on the talk page, we'll try to give you an answer.

Install Ruby

Download and install the latest version of the Ruby One-Click-Installer for Windows from RubyForge.

Install a GUI Toolkit

At least one of the supported GUI toolkits is needed to actually see the lyrics. Currently, the Qt4, GTK+ and Tk GUI back-ends are supported on Windows.

Install QtRuby

TODO

Install Ruby/GTK

Download and install the GTK runtime libraries from Glade for Windows.

Download the Ruby/GTK Bindings for Windows. To install them decompress the zip contents in a folder and run the following command from a shell prompt:

C:\ruby-gtk2-0.16.0-1-i386-msvcrt-1.8> ruby.exe install.rb

Install Tcl/Tk

Download and install ActiveTcl from the ActiveState site.

Install Wiki-Lyrics Script

Download and extract the Wiki-Lyrics script to an empty folder on your computer, such as "C:\WikiLyrics" or "C:\Program Files\WikiLyrics".

Install and Configure AMIP

Install AMIP for the media player you're using.

Configure AMIP's "output string & preset" to be one of the suggested settings (explained below) and make sure the script is enabled (if that's configurable). To use Wiki-Lyrics script AMIP has to be instructed to call wikilyrics.bat, located on the win folder.

Fetch lyrics from Lyriki and LyricWiki, prompt to submit missing lyrics to Lyriki
/exec:(<wikilyrics.bat FULL PATH>) -a "%1" -t "%2" -s Lyriki -u USERNAME -p PASSWORD --persist session
Fetch lyrics from Lyriki and LyricWiki, prompt to submit missing lyrics to Lyriki and review autogenerated pages
/exec:(<wikilyrics.bat FULL PATH>) -a "%1" -t "%2" -s Lyriki -u USERNAME -p PASSWORD --persist session -g
Fetch lyrics from Lyriki and LyricWiki, do not prompt to submit missing lyrics
/exec:(<wikilyrics.bat FULL PATH>) -a "%1" -t "%2"
Fetch lyrics only from Lyriki, do not prompt to submit missing lyrics
/exec:(<wikilyrics.bat FULL PATH>) -a "%1" -t "%2" --sites Lyriki
NOTE: these are only suggestions; you can customize AMIP's "output string & preset" option to your liking (read the section on command line interface options to find out what each switch does).

Try It Out

Play a song to test it, if everything goes well you should see a dialog popup with the lyrics for the playing song (it should take from 5 to 20 seconds, depending on the song and your settings). If nothing happens it might be one of the following reasons:

  1. The lyrics were not found: how likely this is depends on AMIP's "output string & preset" option and on the song playing. To rule this out try with other songs and, if it's not the case already, change AMIP's "output string & preset" option to search the lyrics on other sites as well (remove the --no-meta switch).
  2. There is a problem with the GTK or Ruby/GTK instalation: there seems to be an incompatibility between the iconv version installed with Ruby and the one needed by GTK. Try executing the file gtk_fix.bat found on the win directory.
  3. There is a problem with the Tcl/Tk instalation: you may need to copy the tcl lib directory to the root of the drive you have Lyriki's plugin installed to.

Screenshots

No, seriously... it works:

  • Wiki-Lyrics running from Winamp (GTK toolkit)

Lyriki-Lyrics running from Winamp (GTK toolkit)

  • Wiki-Lyrics running from Winamp (Tk toolkit)

Lyriki-Lyrics running from Winamp (Tk toolkit)

Using Wiki-Lyrics with Audacious

To use the script with Audacious you have to enable the Song Change plugin and configure it to call cli/wikilyrics.rb when a new song starts.

Install Wiki-Lyrics Script

Download and extract the Wiki-Lyrics script.

Configure the Song Change Plugin

Make sure the plugin is enabled (it's on the General plugins section) and configure the "command to run when audacious starts a new song" to call wikilyrics.rb, located under the "cli" directory. Let's see some examples:

Fetch lyrics from Lyriki and LyricWiki, prompt to submit missing lyrics to Lyriki
ruby <wikilyrics.rb FULL PATH> -a ARTIST -t TITLE -s Lyriki -u USERNAME -p PASSWORD --persist session
Fetch lyrics from Lyriki and LyricWiki, prompt to submit missing lyrics to Lyriki and review autogenerated pages
ruby <wikilyrics.rb FULL PATH> -a ARTIST -t TITLE -s Lyriki -u USERNAME -p PASSWORD --persist session -g
Fetch lyrics from Lyriki and LyricWiki, do not prompt to submit missing lyrics
ruby <wikilyrics.rb FULL PATH> -a ARTIST -t TITLE
Fetch lyrics only from Lyriki, do not prompt to submit missing lyrics
ruby <wikilyrics.rb FULL PATH> -a ARTIST -t TITLE --sites Lyriki
NOTE: these are only suggestions; you can customize this to do whatever you like (read the section on command line interface options to find out what each switch does).


Unfortunately the plugin doesn't provide song metadata such as artist, title, album or year as variables, so they have to be parsed from the "song name" (%n) using regular expressions. To make it worst, the "song name" value depends on the title display format option (found on the playlist page). The following expressions can be used to extract the ARTIST and TITLE information from the most common display names:

ARTIST - TITLE
ARTIST: $(echo "%n" | sed -ne 's/ - .*$//p' | sed -e 's/ /_/g') TITLE: $(echo "%n" | sed -ne 's/^.* - //p' | sed -e 's/ /_/g')

Command Line Interface Options

Usage: wikilyrics.rb [OPTIONS]
Fetch lyrics from various sites and/or submit lyrics to Lyriki and LyricWiki.

Options:
    -a, --artist [ARTIST]            Song artist (mandatory unless batch-file specified).
    -t, --title [TITLE]              Song title (mandatory unless batch-file specified).
    -l, --album [ALBUM]              Song album.
    -y, --year [YEAR]                Song album year.
    -f, --[no-]featfix               Fix artist/title when the later has "feat. ARTIST" (true by
                                     default).

    -b, --batch-file [FILE]          Batch process file (expects artist;title;album;year entries in
                                     each line).

    -c, --[no-]cleanup               Cleanup fetched lyrics (true by default).

        --sites [SITE1,SITE2...]     Sites to search lyrics for, order included (Lyriki,LyricWiki by
                                     default; see sites-list).
        --sites-list                 List available sites.

    -s, --submit [Lyriki|LyricWiki]  Wiki site to submit content to (needs username and password).
    -u, --username [USERNAME]        Username to login with (mandatory when submit specified).
    -p, --password [PASSWORD]        Password to login with (mandatory when submit specified).
        --persist [SESSIONFILE]      Restore/save session from/to file (needs username and password).
    -r, --[no-]review                Prompt for review before submitting content (true by default,
                                     needs submit).
    -g, --[no-]autogen               Prompt for review of autogenerated pages (false by default,
                                     needs review).
    -n, --[no-]new                   Prompt for submission even when no lyrics to submit where found
                                     (false by default, needs review).

    -x, --proxy [PROXY]              Proxy server URL.

    -k, --toolkits [TK1,TK2...]      GUI toolkits priority. Loading falls back to the next toolkit
                                     when one fails; an empty list will cause no dialog to be shown
                                     and lyrics to be dumped to stdout (defaults to qt3,qt4,gtk,tk).

    -h, --help                       Show this message and exit.
    -v, --version                    Show version and exit.