Support for custom item values like AdvisoryRating as ItemValue
Summary
Currently, you have to do custom pre/post-processing on the low-level tag type, because those values are not accessible from TaggedFile.
How could this information be made accessible in a generic way?
API design
No response
Also applies to ItemKey::FlagCompilation.
I've thought about this before, and I've been unable to come up with any good solutions. The only real blockers are ilst and ID3v2, since they have so many extras that are difficult to translate to a generic format.
Currently, when converting an ID3v2Tag -> Tag, a Popularimeter is converted to its binary representation and stored as ItemValue::Binary. This is only safe because ID3v2 is the only format that accepts both ItemKey::Popularimeter and ItemValue::Binary. It's not a perfect solution by any means, but this can be done for other items. I just don't know if there are any overlaps that break this safety.
@uklotzde I just remembered this issue, and the solution could be pretty simple:
When converting to the generic format:
-
AdvisoryRatingcould be stored as its variant ("Explicit" | "Inoffensive" | "Clean") - Flag items could be stored as
"1"or"0"
When converting from the generic format:
-
AdvisoryRatingis determined from the variants or the Apple encoded value, so:-
"Explicit" | "1" => AdvisoryRating::Explicit
-
- Flags are simply:
-
"1" | "true" => 1 -
"0" | "false" => 0
-
This was done for ItemKey::Flag* awhile ago, forgot to do AdvisoryRating. I'll get that in the next release.