lyrico is a command line application which downloads lyrics for your songs. When given a folder,
- scan it, and all inner folders, for audio files
- read the metadata for all songs that it detects
- download the lyrics for each song
- embed the lyrics downloaded into the song (as standard lyrics tag) and also save it to a text file
- Audio Formats - mp3, flac, m4a, mp4, wma, OGG (Vorbis and FLAC).
- Python - Python 27 and Python 3 (tested on Python 3.5 Python 3.4)
- OS - Windows, Linux (tested on Ubuntu).
Use the standard
pip install lyrico
This will also install the dependencies. Hence, it is recommended to install
lyrico on a separate virtual environment.
You can test if
lyrico was installed correctly by running the 'lyrico' command, which now should be available:
This would give the following output:
source_dir is not set. Please use the "set" command to set source_dir. use "lyrico --help" to view commands. Your current settings: ACTIONS save_to_file = True save_to_tag = False overwrite = False PATHS source_dir = None lyrics_dir = None SOURCES lyric_wikia = True lyrics_n_music = True musix_match = True lyricsmode = True az_lyrics = False
If you get this screen, that means
lyrico and its dependencies were installed correctly.
If you see an error like
ImportError: No module named mutagen.id3, this means that the dependencies were not installed for some reason. In that case you can install them very easily with single command. Here's what you do:
lyrico's GitHub page.
Download repository as ZIP and extract the
requirements.txtfile from it. It is in the root directory of repository. This is the only file you need.
Open command prompt in directory containing the
requirements.txtand run following command (if you're using a virtual environment, activate it before running the command):
pip install -r requirements.txt
This will install all of the
lyrico's dependencies and now you can try testing with the 'lyrico' command. It should give no errors.
lyrico operates using two directories (folders):
- Source Directory (
source_dir): This is the directory which
lyricoscans for audio files. The scan also includes all the directories contained within.
- Lyrics Directory (
lyrics_dir): This is where
lyricowill save the lyrics' text files.
lyrico you must set these using the
set command. Values must be absolute paths to the directories. Once set,
lyrico will remember your settings (which can be changed easily at any time). So this has to be done only for the first time.
This is how an example first-run would look like on Windows.
lyrico set source_dir D:\test\Music
This logs the following message:
source_dir updated. lyrico will scan the following folder for audio files: D:\test\Music
source_dir, the directory must exist beforehand.
lyricowill not create the
lyrico set lyrics_dir D:\test\Lyrics
This logs the following in command prompt:
Directory does not exist. Creating new one. lyrics_dir updated. lyrico will save lyrics files in the following folder: D:\test\Lyrics
source_dir, when setting the
lyrics_dirto folder that does not exist (as in this example);
lyricowill create it for you.
This will start the application and it will start downloading the lyrics for songs that it detects in the
source_dir. You will be able to see the status (song name, lyrics URL) in the command prompt as it downloads, one at a time, the lyrics for each song.
Finally it builds the log of whole operation and saves it in the
log.txtis located in your
Other Settings and Commands
Basic settings like
lyrics_dir can be repeatedly changed using the
set command as described in the example above. There are few more settings that are available to control
lyrico's actions. These actions can be either disabled or enabled.
save_to_file- When enabled,
lyricowill save the lyrics downloaded to a text file and put it in the
lyrics_dir. The naming convention of file is as follows:
[artist name] - [title].txt
where [artist name] and [title] are extracted from the song's metadata. It either of this is not found, lyrics won't be downloaded and you will see that in the final
log.txt. This naming convention in the current version cannot be changed.
enabled by default
save_to_tag- When enabled,
lyricowill embed the lyrics downloaded into song tags.
lyricouses the standard lyrics tags for different formats. This means, as long as your music player can read standard lyrics tags from the song's metadata, it should display them.
disabled by default
overwrite- When enabled,
lyricowill always download the lyrics for a song ignoring they might already be present in the lyrics tag or in the
lyrics_diras a text file. After the download, it overwrites any existing lyrics in the tag or the text file.
This setting is meant to avoid repetitive download of lyrics. For example, if there is a song 'ABC' in the
overwriteis disabled. When
lyricois run, it will first look into
lyrics_dirif it already has lyrics. If yes, then it would ignore the song.
overwritetakes into account, the
save_to_tagsettings to decide what to do. For
save_to_file, it looks in
save_to_tagit searches for existing lyrics in songs's metadata. Whenever there is a void, download happens and old lyrics will be replaced by downloaded ones in both, text file and song metadata as per your settings.
disabled by default
The above three settings can be changed using
disable commands. This is how you will enable
save_to_tag from its default 'disabled' setting:
lyrico enable save_to_tag
This would log:
save_to_tag enabled lyrico will embed the downloaded lyrics into song tags.
Similarly to disable
lyrico disable save_to_file
This gives following message in command prompt:
save_to_file disabled lyrico will not save the downloaded lyrics to text files.
Viewing current settings - To view current settings use the following command:
Help - You can always view all the commands by asking for the help screen:
lyricoquick invocation - you can supply
lyricocommand. The following command:
is same as running the two commands:
lyrico set source_dir full_path_to_source_dir lyrico
However this won't work for the very first run.
lyrico uses the following sources from where it downloads the lyrics:
Lyric Wikia :
az_lyrics(disabled by default)
The search order is same as enumerated above and cannot be changed. You can, however, disable or enable any of the sources using the same
disable commands. When a source is disabled, it is simply skipped during the search.
For example, to enable AZLyrics:
lyrico enable az_lyrics
Use the command line name for the source, which is mentioned after the link to the source in the above list. This logs the following message indicating that
az_lyrics will be used as a source:
az_lyrics enabled lyrico will use AZLyrics as a source for lyrics.
Or to disable Lyric Wikia:
lyrico disable lyric_wikia:
This logs the following message:
lyric_wikia disabled lyrico will not use Lyric Wikia as a source for lyrics.
Audio Formats and Tags
Below is the table of supported audio formats and their supported tags:
|m4a, mp4||MP4 Tags (iTunes metadata)|
|OGG (Vorbis and FLAC)||Vorbis Comments|
Here are somethings that
lyrico does well:
No junk -
lyricowill not insert junk text into your lyrics files or audio tags. It won't create blank files or blank lyrics tags. Neither it would create lyrics files or tags containing errors etc.
Language - Since
lyricouses your song's artist name and title to construct the URLs; so as long as they are correct and the source has the lyrics, it would work no matter which language.
foobar2000 - The poor performance of the Lyric Show Panel 3 component was main reason I wrote this application. It simply won't work for me.
lyricoplays nicely with 'Lyric Show Panel'.
lyrico's file-naming convention matches 'Lyric Show Panel's default settings. Just point 'Lyric Show Panel' to your
I recommend simply removing all of 'Lyric Show Panel' online sources and use offline mode (Tag search, Files search, Associations search) with
lyrico. It is the next best thing to automatic search. Because 'Lyric Show Panel' on failure embeds errors in lyrics files and tags!
Even if you don't use foobar2000 or your music player cannot read lyrics from text files like that, you can always embed lyrics into tags which should work with any decent music player including iTunes.
log.txtcreated at end of every
lyricorun is nice way to see what have you fetched. It show list of every song present in
source_diralong with status of download or errors that happened.
Here are few points you should know before using
Your tags -
lyricouses metadata in your tags for building URLs. Hence your songs should be tagged with correct 'artist', 'title' information.
lyricoalso assumes that you're using standard tags for each format (container) of your songs. For example,
lyricoassumes that your
.mp3files are using the standard
ID3tags and only reads metadata for those. If you are using something like an
APEv2tag with an
lyricowon't be able to read it and would log the pertinent error in the
You don't need to be concerned about this unless you have forcibly embedded non-standard tags in your songs with some other software. Table of supported tags for audio formats is given above.
ID3 tag versions -
lyricowill convert any old ID3 tag to ID3v2.4 if
save_to_tagis enabled. This is the default behavior of mutagen; the underlying dependency used by
lyricoto read ID3 tags.
This has never caused any problem for me till date. And from my understanding you should be using ID3v2.4 tags anyways. I have used
lyricoon hundreds of mp3 files and had no issues. You can always test
lyricoon few songs and check. Or you can just disable
Song metadata - Lyrics are fetched using a URL generated using song's artist name and title. This means that if the song has titles like:
- ABC(live version)
or an artist like:
- XYZ(feat. Blah)
the download might fail. Sometimes artist-name or title contain characters like '?'. For this, Windows won't be able to create the text file as it is a restricted character. But the lyrics will be downloaded anyways and saved to tag if
windows console - If you are using Windows, like me, you must use some other font than the default 'raster fonts' in the command prompt to view in-prompt logging for songs using other characters than English in their metadata.
But the problem does not end here. Even after enabling other allowed fonts like
Lucida Console, you still won't be able to see in-prompt logging (you will see question marks or boxes) for Asian languages like Mandarin, Japanese, Korean etc. Though European language are displayed correctly.
Despite any issues with windows console display,
lyricodownloads and saves the lyrics correctly to files and tags.
lyrico uses and thanks the following python packages:
- glob2: to allow simple recursive directory search in Python 27.
- requests: HTTP for Humans.
- mutagen: to read tags from audio files and embed lyrics in tags for multiple audio formats.
- beautifulsoup4: to extract the lyrics.
- win_unicode_console: because Python 27, Unicode and command prompt is a nightmare.
- docopt: to create beautiful command-line interfaces.
A note on mass downloading
lyrico is simply scraping lyrics off the HTML pages of the sources, please don't set
source_dir to a folder having thousands of songs.
They might ban your bot.
az_lyrics sometimes bans your IP (not sure if permanent) if you hit them with too many failed requests. Though, refreshing your IP by restarting your router or using a VPN solves that. Hence,
az_lyrics as a source is disabled by default. Only use it if you are looking for recent lyrics.
Also, downloading 1000s of lyrics will be slow since
lyrico does not batch-download. It sends one request to one source at a time. This is by design.
I personally use it at one or two albums at time and keep checking for any errors in
- 0.5.0 Added musiXmatch and LYRICSMODE to sources. Include detection for licensing errors.
- 0.4.0 Added LYRICSnMUSIC and AZLyrics as sources. Expanded the command line interface to control sources. Added requests to dependencies.
- 0.3.0 Added support for
wmaaudio formats. Replaced
LYRICStags to embed lyrics in Vorbis Comments.
- 0.2.0 Added documentation and tutorial.
- 0.1.0 Initial release.