How can I fetch lyrics for all my music and store them within the files?
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 a free wikilyrics mirror to fetch the lyrics and then eyeD3 again to save the new tag. I encourage every one who will use this code to look up another lyrics API, as exploiting the same service over and over can be considered malicious.
#!/bin/bash
_TPL='http://makeitpersonal.co/lyrics?artist=<artist>&title=<title>'
_SRY="Sorry, We don't have lyrics for this song yet."
[ "$1" ] && _PATH="$1" || _PATH=$PWD
cd $_PATH
for _FILE in {*.mp3,*.m4a}; do
if [[ -r $_FILE ]]; then
_SONG=$(eyeD3 --no-color "$_FILE" | grep title)
_ARTIST="${_SONG#*"artist: "}"
_TITLE="${_SONG%"artist: "*}"
_TITLE="${_TITLE#"title: "}"
echo -n "$_ARTIST - $_TITLE"
_ARTIST="${_ARTIST// /+}"
_TITLE="${_TITLE// /+}"
_URL="${_TPL//"<artist>"/$_ARTIST}"
_URL="${_URL//"<title>"/$_TITLE}"
_LYRICS=$(wget -qO- $_URL)
if [ "$_LYRICS" != "$_SRY" ]; then
eyeD3 --lyrics=eng:Lyrics:"$_LYRICS" "$_FILE" 1>/dev/null
else
echo "No lyrics found... skipping!"
fi
fi
done
cd $OLDPWD
Instructions (run commands in terminal):
- install
wget
andeyeD3
by issuingsudo apt-get install wget eyed3
- save above code to a file, e.g.
/home/user/lyrics_fetcher.sh
- add permission to run the file:
chmod u+x /home/user/lyrics_fetcher.sh
- run the file (mind the quotes):
/home/user/lyrics_fetcher.sh "path_to_my_album"
- 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, I guess. 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.
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.