2

Recently I started experimenting with eyeD3 to manage my large collection of MP3's.

Using the commandline on Linux ('BASH') I want to add comments to MP3's according to this structure:

Line 1
Line 2
Line 3

So I need to insert a line break. I tried anything I can think of:

/r, /n, $0A (which is hexadecimal) and a regular line break as in HTML.

Nothing works.

I googled around but could not find any relevant search result covering the same problem. Although I think it can't be that difficult.

Does someone know what I should you use?

John1024
  • 109,961
  • 14
  • 137
  • 171
wie5Ooma
  • 281
  • 1
  • 4
  • 15
  • 1
    not clear at all how you're trying to solve your problem. Consider editting your question to show the exact command you're using, and exact sample input file (if that is separate). Note that CR= "\r' and LF = "\n". Finally, not clear where the comments are going, inot an eyeD3 db, the mp3 files or ?? Good luck. – shellter Nov 24 '14 at 04:23

1 Answers1

4

eyeD3 can include newline characters in comments. Any shell method for embedding newlines in the comment string will work. Here are three examples:

Method 1: Using actual newlines in plain quotes

Actual newlines can be embedded in plain quotes:

$ eyeD3 --comment=":Rating:This is
> an even
> better
> song" file.mp3

Method 2: Read the comment in from a multi-line file

Suppose that we have this file;

$ cat comment.txt
This is
the best
song of
a lifetime

We can place that comment in the mp3 file like this:

$ eyeD3 --comment=":Rating:$(cat comment.txt)" file.mp3

Method 3: Using $'...'

To add a multi-line comment to a mp3, one option is to use $'...' to hold the newline characters:

eyeD3 --comment=$':Rating:This is\nthe best\nsong ever' file.mp3

Once this is done, we can display the multi-line comment to verify that it was properly saved:

$ eyeD3 file.mp3 

file.mp3        [ 16.78 KB ]
-------------------------------------------------------------------------------
Time: 00:07     MPEG2, Layer III        [ ~16 kb/s @ 11025 Hz - Mono ]
-------------------------------------------------------------------------------
ID3 v2.4:
title:          artist: 
album:          year: None
track:  
Comment: [Description: Rating] [Lang: eng]
This is
the best
song ever

The $'...' construct works well when you want to write the comment on one line of input. $'...' also supports many other special characters beside newlines.

$'...' requires bash.

John1024
  • 109,961
  • 14
  • 137
  • 171