-
-
Notifications
You must be signed in to change notification settings - Fork 379
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PICARD-2616: id3v2.4 TDRL -> releasedate mapping #2206
Conversation
id3v2.3 fallback for TDRL
One more suggestion... You might want to be a bit more descriptive in your commit messages. I suggest having a look at articles like https://initialcommit.com/blog/git-commit-messages-best-practices and https://www.freecodecamp.org/news/how-to-write-better-git-commit-messages/ for some tips. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tests should be added for this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks a lot for tackling this. Before we merge this we should have a look over how other tools handle TDRL
and how it maps to other tagging format, especially MP4 and ASF (which had not yet been considered in this PR). https://github.com/metabrainz/picard/blob/master/CONTRIBUTING.md#audio-metadata-specifications provides some resources for tag specs and mappings in other tools.
The current implementation will not write this tag to ASF, for MP4 it would be treated as a custom tag ----:com.apple.iTunes:releasedate
.
So a quick look over what we have here:
Software | ID3v2.3 | Vorbis | MP4 | ASF | Ape |
---|---|---|---|---|---|
MP3Tag | TDRL |
RELEASETIME ? |
- | - | - |
Kid3 | - | RELEASEDATE ? |
----:com.apple.iTunes:RELEASEDATE |
- | - |
Yate | TXXX:Release Time |
RELEASETIME |
----:com.apple.iTunes:RELEASETIME |
- | Release Time |
JaudioTagger (Jaikoz, SongKong) | - | - | - | - | - |
MediaMonkey | - | - | - | - | - |
MusicBee | - | - | - | - | - |
Notes;
- JaudioTagger, MediaMonkey, MusicBee do not support TDRL (according to the docs)
- MP3Tag: Vorbis is not specified, but AFAIK it ends up with internal name
RELEASETIME
- Kid3: MP4 uses uppercase
----:com.apple.iTunes:releasedate
- Kodi treats
TDRL
just as another source for its DATE, just likeTDRC
. Unsure which it prefers. - foobar2000: Supports
TDRL
. Internal name isRELEASE DATE
. Unsure how it handles it for other formats
So this is really a mixed bag (and as a side note is one of the reasons this has not yet been supported by Picard). Anyway, we should just choose. I think the current approach is overall fine. Not supporting ASF seems to be widely the standard way of handling it (and ASF has lost relevance anyway, I can't remember the last time any user had some question about that).
Maybe explicitly add it to the mapping for MP4 as uppercases (----:com.apple.iTunes:RELEASEDATE
). What do you think?
|
A lot of players these days just use boilerplate libraries like TagLib and mutagen, which both map the internal variable I think whether many music players use it isn't so much of a reason to not support writing a tag? Hardly any player uses
We're also in a chicken/egg situation where application developers are discouraged from using the tag because they know Picard cannot write it - you can see that for example in the Kodi code comments Anyway, I'm currently writing support for
Yes this is why I restricted this PR to the narrow case where there is a de-jure (id3v2.4) or de-facto (Vorbis & MP4, through mp3tag/Yate/kid3/TagLib) standard. ASF I'm not touching with a bargepole. If you think the id3v2.3 fallback frame
As these are tiny (one-line) commits I thought the code would more or less speak for itself, and this PR discussion would provide the required context - but happy to be more verbose in future commits. Unfortunately I cannot edit past commits I think? |
I think we are essentially good with this approach. The TDRL tag is nod widely supported, but I agree with the approach taken here. What I'd wish to see is adding an explicit support for
To be fair just because these libraries are used does not necessarily mean the player has support for this tag. It's still the decision of the developers which tags and how they support. And some tools are very open and allow flexible access to a lot of tags, and others are very limited and only support the essentials. But I get your point.
I think it is ok to write it. I just wonder if we should maybe uppercase this. Picard's original approach was to write TXXX frames as title case. Yate also does this in this case with But in the last years newer tags had usually been all uppercase, essentially unifying the naming between Vorbis and ID3 TXXX. This makes handling custom tags much easier, as flexible players like foobar2000 can handle these tags independent of what format is being used and without the player needing actual knowledge of the tags. Especially from the foobar2000 side Picard receives frequent criticism for how it handles tags. An alternative approach would be to use
Actually I think in this case we will just squash them on merge into a single commit, it's only a few lines of changes that belong together. So for me the commit history is currently fine as it is. But otherwise I would indeed prefer more descriptive commit messages. |
Just adding a note here so that we don't forget... Once this is all sorted out and merged, we'll need to update the tag mapping appendix information (and spreadsheet) in the Picard documentation. This should be done in the https://github.com/metabrainz/picard-docs/blob/master/tag_mapping.py file, which is used to automatically update all of the references. |
You can, That said, in this case, I think you can just squash all commits in one, and set a clean message for it. |
As requested by @phw : #2206 (comment)
Done: 38c739a
Happy to do this, but shouldn't this then also be done with
@zas also happy do do this, I was a bit hesitant to just upload new test.mp3/mp4/flac files without discussion/consultation :) |
We usually are rather careful changing tags once they are implemented, unless there is a good reason to change it. Anyway, as part of this PR we should focus on releasedate.
Most of the test cases use the existing files as basis to first create the tags in the state to test and then perform the tests. The first step for having basic test coverage is to add the Specific tests for ID3 can be added to https://github.com/metabrainz/picard/blob/master/test/formats/test_id3.py . E.g. to specifically test how the tag gets written to ID3 v2.3 vs v2.4 something like this could work (just some ad-hoc code written here, might contain mistakes): class Id3TestCase(CommonTests.TagFormatsTestCase):
# ....
@skipUnlessTestfile
def test_releasedate_v23(self):
config.setting['write_id3v23'] = True
metadata = Metadata({
'releasedate': '2023-04-28',
})
save_metadata(self.filename, metadata)
raw_metadata = load_raw(self.filename)
self.assertEqual(metadata['releasedate', raw_metadata['TXXX:RELEASEDATE')
@skipUnlessTestfile
def test_releasedate_v24(self):
config.setting['write_id3v23'] = False
metadata = Metadata({
'releasedate': '2023-04-28',
})
save_metadata(self.filename, metadata)
raw_metadata = load_raw(self.filename)
self.assertEqual(metadata['releasedate', raw_metadata['TDRL') |
@certuna can you update the PR as requested? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As this looks good code wise I'll going to merge it so we can include it in the 2.9 release. Thanks a lot for the contribution, much appreciated.
I'll add some tests after the merge. If you have anything to add feel free to open a new PR for it.
Thank you Philipp, I've tried creating the tests but I have to admit I had some issues figuring out how to set up the dev environment correctly for that. |
Summary
Picard currently cannot read or write the official Release Time (
TDRL
) frame in id3v2.4 due to a missing mapping ofTDRL
to the internal variablereleasedate
, like it currently has withTDRC
->date
andTDOR
->originaldate
.This PR fixes it and provides a graceful fallback + upgrade path for id3v2.3.
This make no changes to any default behaviour of Picard. It only adds one internal variable, available to scripting
Problem
Read:
Picard does not read the
TDRL
frame in id3v2.4 & does not show it in the list of tags.With Vorbis Comments, Picard does read the (equivalent)
RELEASEDATE
tagWrite:
When Picard is instructed to write the variable
releasedate
, for example in this script:$set(releasedate,%date%)
, the following happens:With id3v2.4, it currently creates a custom frame
TXXX:releasedate
and notTDRL
. While this is compliant with id3v2.3 (which does not have theTDRL
frame defined), this is not compliant with id3v2.4, where it is part of the official standard: id3v2.4 paragraph 4.2.5With Vorbis Comments, the
RELEASEDATE
frame is written correctly, albeit without date sanitation.Most other tag editors (mp3tag, mutagen, Yate, PuddleTag, kid3, ffmpeg, TagLib, etc) have a mapping of the internal variable
releasedate
<->TDRL
, Picard is the only modern tag editor I'm aware of that is not able to write (or even read!) this frame.Solution
I have deliberately not touched any of the default MusicBrainz JSON -> Picard tag mappings, as I understand from my conversation with Philipp Wolfer that it is a deliberate decision that Picard does not write anything to the
TDRL
frame in its default settings, as to not upset people's existing workflows. However, this mapping at least makes thereleasedate
internal variable accessible to scripts that do.TDRL
->releasedate
mapping for id3v2.4TXXX:releasedate
custom frame fallback for id3v2.3 + upgrade path for v2.3 -> v2.4releasedate
field for Vorbis Comments, like Picard already does withoriginaldate
anddate
Note: id3v2.3 fallback is done in the same way Picard currently handles Mood (
TMOO
) which is another frame that exists in v2.4 but not v2.3Action
Please review & comment