squell / id3

ID3 mass tagger
https://squell.github.io/id3
Other
117 stars 7 forks source link

Refinements and Enhancements #9

Open J-P- opened 8 years ago

J-P- commented 8 years ago

These are not issues, per se, rather requests. Thanks in advance.

1) Add a modifier, such as a semicolon, to append to keys which allow multiple lines or values (GENRE, COMMENT, POPM, …), as opposed to replacing any value previously set with the the new. See the example in the next item.

2) Add support writing POPM. I suggest: "POPM":"johndoe@RATED.COM:192:62"

E.g., to replace current POPM values: id3 -2 -wPOPM "johndoe@RATED.COM:2:62" …

E.g., to append to current POPM, i.e., add a second: id3 -2 -wPOPM ";janedoe@RATED.COM:2:4" …

3) Replace line feed with Unicode (U+000D/U+000A) or PCRE (\R) representatives. This will allow writing multi-line COMM values. The \R matches the user's environment, \r\n or \n.

4) These all pertain to the verbose output (dump) and write options. I suggest modifying the format a little, allowing the output to a file in a standard way and reading in the same file.

a) I suggest "a key and value on one line" format for the metadata dump file (a little JSON-ish). Note that for key which allow multiple lines or values (GENRE, COMMENT, POPM, …), a prefixed semicolon appends attached value as opposed to swapping the attached new with any previously set.


{
    "id3mt": "0.81",
    "file_name": "test.mp3",
    "metadata": "ID3v2.3",
    "TIT2": "08—THIS TOWN",
    "TPE1": "06—FRANK SINATRA",
    "TALB": "02—ALBUM",
    "TRCK": "19",
    "TORY": "2003",
    "TCON": "GENRE1;GENRE2",
    "TCON": ";GENRE3",
    "TEXT": "18—LYRICIST",
    "TPE4": "16—MIXER",
    "TOAL": "21—ALBUMORIG",
    "TOPE": "23—ARTISTORIG",
    "TOLY": "28—LYRICISTORIG",
    "TSO2": "51—ALBUMARTISTSORT",
    "TXXX:ASIN": "24000078",
    "TXXX:BAND": "14—BAND",
    "TXXX:CATALOGNUMBER": "26—CATALOGNO",
    "TXXX:itunesadvisory": "4",
    "TXXX:TEST3": "60—TEST",
    "COMM::eng": "13—COMMENT_LINE1U+000DU+000A13—COMMENT_LINE2U+000DU+000A13—COMMENT_LINE3U+000DU+000A",
    "POPM":"johndoe@RATED.COM:192:62",
    "POPM":";janedoe@RATED.COM:1:2"
}

b) Provide a means to output a dump file from an audio file. For example, id3 -2 -vf test.mp3 >>> test.tags … with contents as (a) above. I realize that a users can currently do: id3 -v test.mp3 > test.tags

c) Provide a means to input a dump file to an audio file. For example, id3 -2 -wf test.mp3 >>> uses contents of test.tags, or explicitly specify dump file, id3 -2 -wf "test.tags" test.mp3

squell commented 7 years ago

1) "Appending" is a bit ambiguous in ID3v2. You can have multiple COMM frames in a tag (as long as they have unique descriptors), and each COMM frame can also have multiple lines. I can imagine mp3 playing software blurring this distinction.

* Appending content to an existing frame is already supported, since you can use something like:

```id3 -2wCOMM:descr:eng "%{COMM:descr:eng}\nJ-P was here!"```

Which could be made a bit nicer, indeed, by introducing a meta-variable for the previous value (I don't what would be a nice pick here, perhaps `%&`)

* Adding a *new* COMM frame requires providing a descriptor, e.g.

```id3 -2wCOMM:bragging:eng "J-P- was here!"```

But in this case you're not really appending to anything, just adding new information.

2) Great suggestion. If I read the ID3v2 spec, the email-adress is part of the key of the frame, so the syntax should become -wPOPM:johndoe@rated.com 2:62, which can then be queried using %{POPM:johndoe@rated.com}

3) Not sure what you mean here: ID3v2 appears to require multiple lines in supported fields to be seperated by newlines, so \n should give you support for multiple lines.

4) There are two issues here; reading the dump, and the output format of this dump.

* Reading the dump is on the TODO list; as is adding support for 

piping such a dump through an external editor/tool, and then reading it back again.

* The current 'verbose' format was designed to be close to the actual binary representation and to be friendly for bash/sed/vim; and also to be useful (hopefully) as an intermediate representation for conversion more well-defined formats (such as JSON/YAML/XML...).

So, an easiest way to add JSON output would be by writing a seperate script that transforms the output of `id3 -v` to JSON (and back again, once I've added reading dumps). This is also something that is probably best implemented in a higher level scripting language instead of C++. Help in this area is appreciated as I'm not a JSON/YAML/XML/etc. expert.