Skip to content

Conversation

@semohr
Copy link
Contributor

@semohr semohr commented Nov 26, 2025

This PR adds the TXXX:LABEL and TXXX:MEDIA to the respective fields in the MediaFile class.

These fields are read and written by foobar and Mp3Tag.

For references see
https://community.mp3tag.de/t/the-case-for-a-dedicated-label-tag/57647/17 and
https://community.mp3tag.de/t/what-is-the-correct-tag-for-label/59445/2

closes #85


Decision needed:

Im not entirely sure if we want to have both fields as read and write as this now duplicates the metadata if mediafile is used to write these fields:

f = MediaFile("label.mp3")
f.label = "some label"
f.save()

This will now write both the TXXX:LABEL and TPUB frame (same for media).

from mutagen.id3 import ID3, TXXX, ID3NoHeaderError
tags = ID3("label.mp3")
tags
#{
#'TPUB': TPUB(encoding=<Encoding.UTF8: 3>, text=['some label']),
#'TXXX:LABEL': TXXX(encoding=<Encoding.UTF8: 3>, desc='LABEL', text=['some label'])
#}

We could defined these fields as read_only, but this would than still make issues with tools relying on the TXXX fields. @JOJ0 Do you know if there is a precedence for this and if we had such an issue beforehand?

@codecov-commenter
Copy link

codecov-commenter commented Nov 26, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.26%. Comparing base (a602f02) to head (1bfc560).

Additional details and impacted files
@@           Coverage Diff           @@
##           master      #95   +/-   ##
=======================================
  Coverage   93.26%   93.26%           
=======================================
  Files          16       16           
  Lines         817      817           
  Branches      118      118           
=======================================
  Hits          762      762           
  Misses         35       35           
  Partials       20       20           

@JOJ0
Copy link
Member

JOJ0 commented Nov 27, 2025

I dont know how to deal with it technically but TPUB is definitely the more important one. Did some (ai-assisted) digging around again, this time focusing on the usage in DJ software and all major ones use it for a field often called label in their UIs. rekordbox, mixxx, traktor, serato

so RW support as we have it already should be kept (just saying, i'm sure that's your intention anyway)

anyway if someone wants to use mediafile to tag
TXXX:label instead of TPUB (read and write) somehow this should be configurable

this could be made possible of we invent a new field to access as file.custom_label

really only thinking out loud here and need to dig deeper to find out if we don't have very similar situations already in mediafile. sorry not much help for now

@JOJ0
Copy link
Member

JOJ0 commented Nov 27, 2025

anyway answering your original question: In my opinion it is perfectly ok if beets writes the same info to both txxx and tpub. the enduser aka the tools that try to display a label will all be happy about it :-)

@JOJ0
Copy link
Member

JOJ0 commented Nov 27, 2025

and as a reminder where we are coming from, we would like imports to read the non standard txxx:label additionally (in case tpub is empty it will be used instead)

#85 (comment)

that doesn't mean it hurts to also allow writing it (beets for example will then simply write both). it shouldn't be a readonly field in my opinion.

hope that helps


label = MediaField(
MP3StorageStyle("TPUB"),
MP3DescStorageStyle("LABEL"),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

on read tpub is preferred, on write both are written, this is the correct order imho.

)
media = MediaField(
MP3StorageStyle("TMED"),
MP3DescStorageStyle("MEDIA"),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

same here

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.

LABEL metadata tag not stored in database for MP3 files

4 participants