MP4 fails with string argument for freeform text ('----') tags

Bug #1835771 reported by Simon Lambourn
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
python-mutagen
New
Unknown
mutagen (Ubuntu)
New
Undecided
Unassigned

Bug Description

mutagen.mp4.MP4 container does not accept a string value for freeform text tags, but expects (and returns) a bytes argument. This is inconsistent with python3 default of string values.

code:
>>> import mutagen.mp4.MP4 as MP4
>>> m = MP4()
>>> m['----:test:item'] = 'test value'
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python3/dist-packages/mutagen/_file.py", line 75, in __setitem__
    self.tags[key] = value
  File "/usr/lib/python3/dist-packages/mutagen/mp4/__init__.py", line 375, in __setitem__
    self._render(key, value)
  File "/usr/lib/python3/dist-packages/mutagen/mp4/__init__.py", line 391, in _render
    return render_func(self, key, value, *render_args)
  File "/usr/lib/python3/dist-packages/mutagen/mp4/__init__.py", line 632, in __render_freeform
    data += v
TypeError: can't concat str to bytes
>>> m['----:test:item'] = b'test value'
>>> m['----:test:item']
b'test value'
>>>

Expected behaviour: accept (and return) string values, with encoding to utf-8 if required (this is implied in some of the comments in the code).

ProblemType: Bug
DistroRelease: Ubuntu 19.04
Package: python3-mutagen 1.40.0-2
ProcVersionSignature: Ubuntu 5.0.0-20.21-generic 5.0.8
Uname: Linux 5.0.0-20-generic x86_64
ApportVersion: 2.20.10-0ubuntu27
Architecture: amd64
CurrentDesktop: ubuntu:GNOME
Date: Mon Jul 8 15:03:10 2019
Dependencies:

PackageArchitecture: all
SourcePackage: mutagen
UpgradeStatus: Upgraded to disco on 2019-04-25 (74 days ago)

Revision history for this message
Simon Lambourn (simon-lambourn-o) wrote :
Revision history for this message
Simon Lambourn (simon-lambourn-o) wrote :

PS. The use case for this is in storing and retrieving musicbrainz ID tags, which are stored as freeform tags.

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

Please report things upstream: https://github.com/quodlibet/mutagen/issues

Revision history for this message
Simon Lambourn (simon-lambourn-o) wrote :

Christoph - thank you for the pointer. I have reported it as you suggest: https://github.com/quodlibet/mutagen/issues/391

Changed in mutagen:
status: Unknown → New
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.