How to use line breaks in eyeD3

478 views Asked by At

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?

1

There are 1 answers

3
John1024 On BEST ANSWER

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.