LinuxQuestions.org
Review your favorite Linux distribution.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices


Reply
  Search this Thread
Old 03-06-2010, 12:41 PM   #1
SharpyWarpy
Member
 
Registered: Feb 2003
Location: Florida
Distribution: Fedora 18
Posts: 862

Rep: Reputation: 91
Add lyrics to mp3 tag using eyeD3


Hi, everybody.
I've searched high and low on how to add lyrics to an mp3 tag using eyeD3. I want a CLI program so I can use it in GUIs like Rhythmbox or ipod/creative/etc. Or in a non-GUI console. The eyeD3 man page is pretty short on this:
--lyrics=[LANGUAGE]ESCRIPTION:LYRICS
Add (or remove when LYRICS is "") a comment. Note that the argument value MUST always contain exactly two ’:’ char-
acters to delimit the fields even when the default language is being used. The DESCRIPTION string is the lyrics
title. The optional LANGUAGE string MUST be a three-character ISO 639 language code. The default is "eng" for
English.

A tag may not have more than one lyrics frame with the same DESCRIPTION and LANGUAGE values.

Now, when I run
eyeD3 --lyrics=eng:these_lyrics:lyrics_file.txt some_file.mp3
it doesn't work.
eyeD3 -v
does not show the lyrics. I just started using Rhythmbox and it will download lyrics just fine but I'd like to be able to imbed the lyrics in the mp3 tag so I don't have to do this every time. Thanks in advance.
 
Click here to see the post LQ members have rated as the most helpful post in this thread.
Old 03-06-2010, 02:20 PM   #2
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Arch + Xfce
Posts: 6,852

Rep: Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037
Code:
eyeD3 --lyrics=eng:these_lyrics:lyrics_file.txt some_file.mp3
This just puts the filename, that is the literal string "lyrics_file.txt" into the tag, not the contents of the file.

You can embed the contents of a file into a command using the format "$(cat file)". Be sure to use double-quotes to preserve formatting. So try this:

Code:
eyeD3 --lyrics=eng:these_lyrics:"$(cat lyrics_file.txt)" some_file.mp3
 
2 members found this post helpful.
Old 03-06-2010, 03:46 PM   #3
SharpyWarpy
Member
 
Registered: Feb 2003
Location: Florida
Distribution: Fedora 18
Posts: 862

Original Poster
Rep: Reputation: 91
Quote:
Originally Posted by David the H. View Post
Code:
eyeD3 --lyrics=eng:these_lyrics:lyrics_file.txt some_file.mp3
This just puts the filename, that is the literal string "lyrics_file.txt" into the tag, not the contents of the file.

You can embed the contents of a file into a command using the format "$(cat file)". Be sure to use double-quotes to preserve formatting. So try this:

Code:
eyeD3 --lyrics=eng:these_lyrics:"$(cat lyrics_file.txt)" some_file.mp3
That works. Thank you very much.
I had tried `cat lyrics_file.txt` with the tics, also double quotes but not with the $ and the parentheses. What does the $ do?
 
1 members found this post helpful.
Old 03-06-2010, 06:04 PM   #4
SharpyWarpy
Member
 
Registered: Feb 2003
Location: Florida
Distribution: Fedora 18
Posts: 862

Original Poster
Rep: Reputation: 91
Okay I'm going to research the role of "$" elsewhere and go ahead and close this thread as being solved.
For those wondering, there are other id3 tag editors that will do this. Instead of looking up web pages that display lyrics what I do to get these is open Rhythmbox and right click on a file and click on the lyrics tab and it fetches the lyrics. Then I copy and paste to a file in the same directory as the music file and proceed with the aforementioned command in a terminal in that directory.

Last edited by SharpyWarpy; 03-06-2010 at 06:08 PM. Reason: More info
 
Old 03-07-2010, 02:01 AM   #5
David the H.
Bash Guru
 
Registered: Jun 2004
Location: Osaka, Japan
Distribution: Arch + Xfce
Posts: 6,852

Rep: Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037Reputation: 2037
$() is a newer pattern for command substitution. It does the same thing as the backticks, but better. The use of backticks is discouraged these days. Think of the dollar sign as indicating that it's doing basically the same thing as variable subsitution.

At for why your previous efforts failed, my first guess is a problem was with word splitting. As I mentioned, you need to enclose the entire pattern in double quotes, whether it's straight text or expanded through a variable, backticks, or $(), so that the output is read as a single entity and not as a bunch of separate words.

Finally, I guess I'm just used to using cat, as above, but you can also use bash's built-in file redirector instead: "$(<file)"
 
Old 03-07-2010, 06:39 AM   #6
SharpyWarpy
Member
 
Registered: Feb 2003
Location: Florida
Distribution: Fedora 18
Posts: 862

Original Poster
Rep: Reputation: 91
A very good description. Thank you very much for taking the time to explain that for me. I'm pretty sure I'll be using that quite a bit. Thanks again.
 
Old 03-07-2010, 06:48 AM   #7
SharpyWarpy
Member
 
Registered: Feb 2003
Location: Florida
Distribution: Fedora 18
Posts: 862

Original Poster
Rep: Reputation: 91
An excerpt from the link you provided on command substitution:
"A possible problem with putting a list of files into a single string is that a newline may creep in."
This is what was happening to me, newlines all over the place because of the newlines in the lyrics text. But not with the newer method you explained.
 
Old 04-03-2010, 09:40 PM   #8
linuxLuser
Member
 
Registered: Jan 2005
Distribution: Gentoo
Posts: 111

Rep: Reputation: 16
Skipping Intermediate File

As a recommendation, you could use the "xclip" utility to directly enter the lyrics from the clipboard into the shell. So your command might be something like this:

Code:
$ eyeD3 --lyrics=eng:my_label:"$(xclip -o)" my_song.mp3
Skips the intermediate file all-together and shows why the CLI will always be around.

Last edited by linuxLuser; 04-03-2010 at 09:41 PM.
 
Old 04-04-2010, 06:52 PM   #9
SharpyWarpy
Member
 
Registered: Feb 2003
Location: Florida
Distribution: Fedora 18
Posts: 862

Original Poster
Rep: Reputation: 91
Quote:
Originally Posted by linuxLuser View Post
As a recommendation, you could use the "xclip" utility to directly enter the lyrics from the clipboard into the shell. So your command might be something like this:

Code:
$ eyeD3 --lyrics=eng:my_label:"$(xclip -o)" my_song.mp3
Skips the intermediate file all-together and shows why the CLI will always be around.
Sounds great, next time I'll try that and let you know how I like it. Although in a console it wouldn't work.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Embeded lyrics in mp3 files aZZZ Linux - Desktop 2 03-04-2013 02:46 PM
Mp3 tag editing? alaios Linux - Software 5 01-31-2009 05:10 AM
Lyrics to shell : catdwldlyrc mymp3.mp3 frenchn00b Linux - Software 1 04-21-2008 05:11 AM
synchronized lyrics for current playing mp3 file? rlee923 General 1 04-20-2006 12:07 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 11:08 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration