Skip to content

Fix deletion of empty MP4 tuple fields - #111

Open
emreyolcu wants to merge 1 commit into
beetbox:masterfrom
emreyolcu:master
Open

emreyolcu wants to merge 1 commit into
beetbox:masterfrom
emreyolcu:master

Conversation

@emreyolcu

Copy link
Copy Markdown

I use beets' zero plugin to omit zero-valued track numbers when tags are written. After importing a singleton M4A with that setup, beet info shows no track or disc metadata as expected, but Mp3tag and foobar2000 still show 0 for the track and disc numbers. The raw trkn and disk atoms are both (0, 0).

MP4 stores each number and total together as a pair, while MediaFile exposes them separately. When beets clears these fields, MediaFile deletes the number first, removing the shared pair. Deleting the total afterward recreates the missing pair as (0, 0). MediaFile reads zero components as unset, so the problem is not visible in beets.

I made a change so that deleting a total checks the pair's number first. If the number is missing or zero, MediaFile removes the pair; otherwise, it clears only the total and preserves the number. Regression tests check the raw Mutagen tags for both trkn and disk.

@github-actions

Copy link
Copy Markdown

Thank you for the PR! The changelog has not been updated, so here is a friendly reminder to check if you need to add an entry.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant