leosongwei / mutagen

Automatically exported from code.google.com/p/mutagen
GNU General Public License v2.0
0 stars 0 forks source link

Writing MP3 ID3 tags fails for variable bit rate MP3 with no tags #64

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
See attachment. It has a script to duplicate the steps to cause the bug,
and the offending mp3.

Original issue reported on code.google.com by superjo...@gmail.com on 17 May 2010 at 3:36

Attachments:

GoogleCodeExporter commented 9 years ago
See attachment. It describes the problem in your script.

Original comment by joe.wreschnig@gmail.com on 17 May 2010 at 8:07

Attachments:

GoogleCodeExporter commented 9 years ago
oops, I forgot to add ID3=EasyID3 to the MP3 constructor. But it still fails 
with the
same output: 

Traceback (most recent call last):
  File "test.py", line 15, in <module>
    audio.save()
  File "/usr/lib/python2.6/dist-packages/mutagen/__init__.py", line 132, in save
    return self.tags.save(filename, **kwargs)
  File "/usr/lib/python2.6/dist-packages/mutagen/id3.py", line 335, in save
    framedata = [self.__save_frame(frame) for (key, frame) in frames]
  File "/usr/lib/python2.6/dist-packages/mutagen/id3.py", line 413, in __save_frame
    framedata = frame._writeData()
AttributeError: 'str' object has no attribute '_writeData'

You might argue that it doesn't make sense to create new tags if they don't 
exist,
but then what's the point of the simple interface? I'd have to figure out how to
detect if tags don't exist, if so add them, then try updating them again. I'd 
want
this same boilerplate code every time I used mutagen.

Original comment by superjo...@gmail.com on 17 May 2010 at 9:27

GoogleCodeExporter commented 9 years ago
The solution was to put 

try:
    audio.add_tags(ID3=EasyID3)
except error:
    pass

before the tagging. That's not so bad. I still think mutagen should do this
automatically when you save() though.

Original comment by superjo...@gmail.com on 17 May 2010 at 9:52