beetbox / mediafile

elegant audio file tagging
http://mediafile.readthedocs.io/
MIT License
99 stars 25 forks source link

ID3v2.3 multi-value field separator is always "/" #21

Open Moonbase59 opened 4 years ago

Moonbase59 commented 4 years ago

For some libraries, users might decide to store ID3v2.3 tags for greater compatibility with older software (as opposed to the ID3v2.4 default).

Now ID3v2.4 allows storing multiple tags of the same name (for multi-value entries like artists, genres and so on) and ID3v2.3 traditionally used a slash "/" character (which brought us the "AC/DC problem").

People (and tagging software like MusicBrainz Picard) have started to support other separators to store multiple values on one ID3v2.3 field. Typical separators used today are the semicolon ;, the vertical bar |, a comma , the NULL character \0 and even character sequences like semicolon blank ; for better readability. The underlying Mutagen supports all of these by specifying v23_sep.

This is a missing feature in MediaFile (and beets) and I’d like to add it to the MediaFile class so it could also be supported via a beets config entry:

class MediaFile(object):
    """Represents a multimedia file on disk and provides access to its
    metadata.
    """
    def __init__(self, path, id3v23=False, id3v23_sep='/'):
        """Constructs a new `MediaFile` reflecting the file at path. May
        throw `UnreadableFileError`.

        By default, MP3 files are saved with ID3v2.4 tags. You can use
        the older ID3v2.3 standard by specifying the `id3v23` option
        and (optionally) the desired separator `id3v23_sep` for
        multi-value fields (defaults to a slash character).

        To use a NULL character as terminator, pass `id3v23_sep=None`.
        """

Objections? Would it need a u'/' instead?

N.B.: Making this a core config entry in beets should also help some plugins who currently specify their own separators.

sampsyo commented 4 years ago

Sounds pretty reasonable to me, despite my general resistance to additional configuration options. Because Mutagen has first-class support, I can see this being effective. Here are a few miscellaneous comments:

Moonbase59 commented 4 years ago

Would it break anything if we started out with the extra param in MediaFile and then later care about it in beets?

JuniorJPDJ commented 3 years ago

Would it break anything if we started out with the extra param in MediaFile and then later care about it in beets?

It's the idea I would like to see as it's the most reasonable IMO.