17

I have a large music library (most of them are .mp3 & .m4a) and none of them have lyrics. Is there any program or plug-in that automatically adds lyrics to all of my music by querying the internet?

Because I don't usually have an Internet connection I need a program which automatically adds all lyrics to music file tags so I can view them offline.

Glutanimate
  • 21,763
Bharat
  • 707

8 Answers8

6

This is a semi answer as I don't know your environment and the code I provide is intended to serve as an example only - running it as is shouldn't do any harm but I can't give any guarantee.

Tasks like this can be dealt with using simple bash scripts, e.g. in the following example I use eyeD3 to extract artist and title, then any WikiLirics-like web service to fetch lyrics and then eyeD3 again to add them as a tag. I encourage everyone who will use this code to look up their own lyrics website as exploiting the same service over and over can be considered malicious.

[edit] Someone have actually provided a lyrics API under the URL from this script and it works!

#!/bin/bash

url_template='http://makeitpersonal.co/lyrics?artist=<artist>&title=<title>' failure_message="Sorry, We don't have lyrics for this song yet."

[ "$1" ] && cd "$1" # if argument provided, use it as working directory

for file in {.mp3,.m4a}; do if [[ ! -r "$file" ]]; then # if file isn't readable continue # skip to the next one fi # but if it is readable... # get artist&title line from eyeD3 song=$(eyeD3 --no-color "$file" | grep title) # e.g. title: Alive artist: Bon Jovi artist="${song#"artist: "}" # use everything after artist: as artist title="${song%"artist: "}" # use everything before artist: as title title="${title#"title: "}" # but cut the title: keyword out

echo -n &quot;$artist - $title&quot;    # $title has extra space at the end but YOLO

artist=&quot;${artist// /+}&quot;       # replace spaces in $artist and $title with
title=&quot;${title// /+}&quot;         # `+` characters for use in $url_template
url=&quot;${url_template//&quot;&lt;artist&gt;&quot;/$artist}&quot;  # replace `&lt;artist&gt;` with $artist
url=&quot;${url//&quot;&lt;title&gt;&quot;/$title}&quot;             # replace `&lt;title&gt;` with $title

lyrics=$(wget -qO- $url)      # make `wget` read the response from $url
                              # which is lyrics or $failure_message
if [ &quot;$lyrics&quot; == &quot;$failure_message&quot; ]; then  # if it is $failure_message
    echo &quot;No lyrics found... skipping!&quot;       # then lyrics aren't available
else                                          # else save $lyrics in $file
    eyeD3 --lyrics=eng:Lyrics:&quot;$lyrics&quot; &quot;$file&quot; 1&gt;/dev/null
fi

done

Instructions (run commands in terminal):

  1. install wget and eyeD3 with command sudo apt install wget eyed3
  2. save above code to a file, e.g. ~/bin/lyrics_fetcher.sh
  3. add permission to run the file: chmod u+x ~/bin/lyrics_fetcher.sh
  4. run the file (mind the quotes): ~/bin/lyrics_fetcher.sh "path/to/my album"
  5. you can stop script execution at any time by pressing ctrl+c

I checked this code with "AM" album by Arctic Monkeys and it did sweetly.

If you really want to fetch lyrics for all of your albums at once you can run the script in a loop for each directory:

cd path/to/my_music_directory
for album in */; do ~/bin/lyrics_fetcher.sh "$album"; done

Still, I wouldn't use it as a final solution - wikilyrics and everyone who supports it by mirroring are good guys and this answer is here to promote thinking, not abuse.

cprn
  • 1,209
3

I recently wrote a python script for Automatically fetching and tagging lyrics to your music. Check it out here. This will download the lyrics as txt file and embed it in your .mp3 file

Youtube Demo.

yask
  • 672
2

beets is a command line tool for organising your music library that can fetch lyrics automatically, as well as lots of other things. From the website:

The purpose of beets is to get your music collection right once and for all. It catalogs your collection, automatically improving its metadata as it goes using the MusicBrainz database. Then it provides a bouquet of tools for manipulating and accessing your music.

Specifically, it has a lyrics plugin that fetches lyrics from Lyric Wiki, Lyrics.com, Musixmatch, Genius.com, or a Google custom search API.

The community around it is very active. Check it out!

user53137
  • 121
1

I use lyrico, a python script to download lyrics and embed them into the ID3 or ogg vorbis meta tags.

cweiske
  • 3,395
1
  • lrc.pl is a pearl script using David Precious' Lyrics::Fetcher package, for batch downloading of lyrics for MP3.

  • Also try the Amarok plug-in Ultimate Lyrics. Ultimate Lyrics is a configurable script that fetches lyrics from many sites.

  • Another option: Lyrics extension for banshee

Glutanimate
  • 21,763
totti
  • 6,908
  • 4
  • 40
  • 48
1

as music fan I can recommend you Guayadeque player, fast and light and full featured player and if I'm not mistaken it's got lyrics extensions by default and there's ability to choose more and which, I'm listening through songs right now and it shows lyrics to every song even band bio. There's posibillity to store lyrics to a song manually too, but it's better to sync with internet of course, anyways it's your choice.

sudo add-apt-repository ppa:anonbeat/guayadeque

sudo apt-get update

sudo apt-get install guayadeque-svn
JoKeR
  • 7,062
0

Mp3nity is free for 1.5 months(maybe). Then you have to buy the premium version. It embeds artworks for albums. You can get lyrics for all your music files at once.

Stephen Rauch
  • 1,156
  • 6
  • 15
  • 21
0

I personally use lyrics finder: https://www.lyricfinder.org/

You can use add folder to have it recursively search through folders and find all music files and then try to find and add lyrics to the ID3-tag of them.