Lyriki2tex

Adiel Mittmann
2008-10-04 14:44

About

lyriki2tex is a Bash script that takes the name of artists, albums or songs and generates a LaTeX file containing all the lyrics. It downloads lyrics from Lyriki. So generating a PDF file with all lyrics by Iron Maiden is as simple as:

$ lyriki2tex 'Iron Maiden' > maiden.tex &&
pdflatex maiden.tex &&
pdflatex maiden.tex &&
pdflatex maiden.tex

This comes in handy when you want to print out all the lyrics from an artist or album.

You must bear in mind that Lyriki2tex will not search for lyrics; it will blindly download them from Lyriki. You should browse for your lyrics there and only then use Lyriki2tex to download them for you.

Screenshots

Hyperlinked table of contents.Some (not so) random lyrics.
Hyperlinked table of contents.Some (not so) random lyrics.

Download

Version 0.3

The source code: lyriki2tex-0.3.tar.gz

Install

Lyriki2tex uses CMake. So if you're used to CMake, the installation process is exactly as you expect. If you never used it, this is what you should do inside the main directory:

$ mkdir build && cd build
$ cmake ..
$ make
# make install

Unsurprisingly, you must be root to run the last command.

Usage

Unless told otherwise, Lyriki2tex takes all non-option arguments as names of artists and tries to download all lyrics by those artists. The possible flags are:

  • -a, --artist: this is the default. Lyriki2tex will download all lyrics by the given artists. Example:
    $ lyriki2tex -o -a 'Iron Maiden'
  • -l, --album: downloads all lyrics from the given albums. Specify an album like this:
    $ lyriki2tex -l 'Iron Maiden:Killers (1981)'
  • -s, --song: downloads lyrics for the given songs. Specify a song like this:
    $ lyriki2tex -s 'Iron Maiden:Drifter'
  • -o, --once: if a song is repeated (this could happen, for example, if lyrics of both studio and live albums are downloaded), then don't download it again and don't output it twice.

Bugs

I don't know of any. But what this really means is that I haven't tested it properly. If something doesn't work for you, get in touch with me.

Details

Wget is responsible for downloading pages from Lyriki. This script never downloads the “article” page; always the source page, because it is easier to process. The wiki code is extracted by an XSL file, and the lyrics themselves are parsed by an awk script. The XSL file is awfully short, but it makes life so much easier.