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 "", line 1, in
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).
Already submitted on Ubuntu Launchpad as https://bugs.launchpad.net/bugs/1835771, where I was advised to report it here.