b
Download lyrics.py
This is a module I wrote for Python, intended to be used primarily within an interactive interpreter, which grabs and displays song lyrics from two easily parsed website databases. For lyrics in different languages, a function is provided that displays the original and translated lines side-by-side. The module itself supplies three functions, lyrics(), HTMLDecode(), and, if the translate.py file is present, translate_lyrics().

Documentation

lyrics(artist, song, source=0, output=0, intent=0)
The artist and song are strings determinging which lyrics to fetch. translate_lyrics(artist, song, langfrom='German', langto='English', verb=0, source=0, output=0)
The artist, song, langfrom and langto are strings determinging which lyrics to fetch and the language pair to translate between and display. HTMLDecode(string)
Using the mappings stored in decodedict, changes HTML encoded characters to their UTF-8 equivalents.

Examples

In [1]: from lyrics import * In [2]: lyrics('das ich', 'kokon') kokon Befrage dich selbst, erforsche dein Ich. Du kannst Licht sein und Finsterniss. In [3]: translate_lyrics('das ich', 'kokon', 'german', 'english') Kokon : Cocoon Befrage dich selbst, : Interrogate yourself, erforsche dein Ich. : explore your self. Du kannst Licht sein : You can be light und Finsterniss. : and darkness.