mid3v2 mangles data before adding to ID3v2 tags

Bug #1758537 reported by Moses Moore
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
mutagen (Ubuntu)
Fix Released
Undecided
Unassigned

Bug Description

I can't add frame 'WXXX' to mp3 files; mid3v2 changes the frame name
and the frame value before writing to disk.

What I did:

    $ mid3v2 --list-raw example.mp3
    Raw IDv2 tag info for example.mp3
    TDRC(encoding=<Encoding.LATIN1: 0>, text=[u'2018'])
    TALB(encoding=<Encoding.LATIN1: 0>, text=[u'albumname'])
    TPE1(encoding=<Encoding.LATIN1: 0>, text=[u'artistname'])
    TIT2(encoding=<Encoding.LATIN1: 0>, text=[u'songtitle'])
    $ mid3v2 -h
    ...
    You can set the value for any ID3v2 frame by using '--' and then a frame ID.
    For example:
        mid3v2 --TIT3 "Monkey!" file.mp3
    ...
    $ mid3v2 --WXXX "http://ubuntu.com/" example.mp3

What I expected:

    $ mid3v2 --list-raw example.mp3
    WXXX(encoding=<Encoding.????: ?>, text=[u'http://ubuntu.com/'])
    or
    WXXX(encoding=<Encoding.????: ?>, url=u'http://ubuntu.com/')

What I saw:

    $ mid3v2 --list-raw example.mp3
    WXXX(encoding=<Encoding.UTF8: 3>, desc=u'', url=u"[u'http://ubuntu.com/']")

When I use mutagen itself to read that frame I get:

    >>> import mutagen
    >>> f = mutagen.File('example.mp3')
    >>> f.tags['WXXX']
    KeyError: 'WXXX'
    >>> f.tags['WXXX:']
    WXXX(encoding=<Encoding.UTF8: 3>, desc='', url="[u'http://ubuntu.com/']")
    >>> str(f.tags['WXXX:'])
    "[u'http://ubuntu.com/']"

I said "WXXX" not "WXXX:", and the value that mid3v2 stored was a string
of a one-item list of the actual string I told it to store.

ProblemType: Bug
DistroRelease: Ubuntu 17.10
Package: python-mutagen 1.38-1
ProcVersionSignature: Ubuntu 4.13.0-25.29-generic 4.13.13
Uname: Linux 4.13.0-25-generic x86_64
NonfreeKernelModules: nvidia_uvm nvidia_drm nvidia_modeset nvidia
ApportVersion: 2.20.7-0ubuntu3.7
Architecture: amd64
CurrentDesktop: XFCE
Date: Sat Mar 24 10:42:08 2018
Dependencies:

InstallationDate: Installed on 2016-06-05 (657 days ago)
InstallationMedia: Xubuntu 16.04 LTS "Xenial Xerus" - Release amd64 (20160420.1)
PackageArchitecture: all
SourcePackage: mutagen
UpgradeStatus: Upgraded to artful on 2017-10-22 (153 days ago)

Revision history for this message
Moses Moore (moses-ubuntu) wrote :
Revision history for this message
Moses Moore (moses-ubuntu) wrote :

I thought it might be because 'WXXX' is for freeform url data, so I used a more official frame 'WOAS'. The frame name wasn't munged, but the value was:

    $ mid3v2 --WOAS 'https://ubuntu.org' example.mp3
    $ mid3v2 -l example.mp3
    ...
    WOAS=[u'https://ubuntu.org']

and when using mutagen directly:

    >>> import mutagen
    >>> f = mutagen.File('example.mp3')
    >>> f.tags['WOAS']
    WOAS(url="[u'https://ubuntu.org']")
    >>> str(f.tags['WOAS'])
    "[u'https://ubuntu.org']"
    >>> f.tags['WOAS'].url
    "[u'https://ubuntu.org']"

Revision history for this message
Christoph Reiter (lazka) wrote :

Thanks, that looks like a bug.

re "WXXX" vs "WXXX:" see https://mutagen.readthedocs.io/en/latest/user/id3.html#id3-dict-interface

Revision history for this message
Christoph Reiter (lazka) wrote :
Revision history for this message
Christoph Reiter (lazka) wrote :

Fixed in master: https://github.com/quodlibet/mutagen/commit/62e4dbb6c3e9268a659030090ff67a1082d2b771

If I missed anything feel free to post here or on github.

Changed in mutagen (Ubuntu):
status: New → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.