Zeugma440 / atldotnet

Fully managed, portable and easy-to-use C# library to read and edit audio data and metadata (tags) from various audio formats, playlists and CUE sheets
MIT License
459 stars 61 forks source link

Custom AdditionalFields does not work as documented #171

Closed scott-lin closed 1 year ago

scott-lin commented 1 year ago

The problem

I'm trying to add custom metadata to my m4b file based on the ATL readme example.

I'm doing the following:

var track = new Track(audioFilePath);

track.AdditionalFields["series"] = value;
track.AdditionalFields["series-title"] = value;
track.AdditionalFields["movement-name"] = value;
track.AdditionalFields["series-part"] = value;
track.AdditionalFields["movement-index"] = value;
track.AdditionalFields["language"] = value;

track.Save();

The ATL log tells me:

Non-standard fields must have a namespace (e.g. namespace:fieldName) Field 'narrator' will be ignored.
Field code fixed length is 4; detected field 'narrator' is 8 characters long and will be ignored

Non-standard fields must have a namespace (e.g. namespace:fieldName) Field 'series' will be ignored.
Field code fixed length is 4; detected field 'series' is 6 characters long and will be ignored

Non-standard fields must have a namespace (e.g. namespace:fieldName) Field 'series-title' will be ignored.
Field code fixed length is 4; detected field 'series-title' is 12 characters long and will be ignored

Non-standard fields must have a namespace (e.g. namespace:fieldName) Field 'movement-name' will be ignored.
Field code fixed length is 4; detected field 'movement-name' is 13 characters long and will be ignored

Non-standard fields must have a namespace (e.g. namespace:fieldName) Field 'series-part' will be ignored.
Field code fixed length is 4; detected field 'series-part' is 11 characters long and will be ignored

Non-standard fields must have a namespace (e.g. namespace:fieldName) Field 'movement-index' will be ignored.
Field code fixed length is 4; detected field 'movement-index' is 14 characters long and will be ignored

Non-standard fields must have a namespace (e.g. namespace:fieldName) Field 'language' will be ignored.
Field code fixed length is 4; detected field 'language' is 8 characters long and will be ignored

Environment

Zeugma440 commented 1 year ago

That one's easy 😉

Two of them are standard :

For the others, you need to add a namespace before your field or it will be rejected (see https://github.com/Zeugma440/atldotnet/wiki/Focus-on-non-standard-fields).

For instance, one possible implementation could be (with the scott namespace) :

scott-lin commented 1 year ago

Thanks! I totally missed that wiki section in my late-night marathon. 🤦

That wiki documentation helped explain the functionality, though, I might recommend updating the front and center AdditionalFields example at the top of the readme to something that won't be ignored. The same example is replicated here in the wiki code snippets too.

Perhaps just throw a namespace on the example for clarity? theTrack.AdditionalFields["customNamespace:customField"] = "fancyValue";

Zeugma440 commented 1 year ago

These code snippets are universal and should work with almost every format except MP4/M4A which is very peculiar on its requirements. That's the exception rather than the rule.

scott-lin commented 1 year ago

Got it. I'm very new to this domain, so all of the context you provide is very helpful for my learning. Cheers! 🥂