dhamaniasad / mutagen

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

Problem adding ID3 tags to tagless file opened with MP3(filename, ID3=EasyID3) #89

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
I transcoded "tagged.mp3" with ID3 tags using lame, which throws away the tags, 
creating "untagged.mp3".  Opened both tagged and untagged files with 
MP3(filename, ID3=EasyID3).  Copied tags from tagged to untagged.  Now both 
untagged.pprint() and untagged.save() throw errors.  Slightly edited transcript:

{{{
$ ls
tagged.mp3
$ lame -b 192 tagged.mp3 untagged.mp3
ID3v2 found. Be aware that the ID3 tag is currently lost when transcoding.
LAME 3.97 32bits (http://www.mp3dev.org/)
[feedback while transcoding]
Writing LAME Tag...done
ReplayGain: -5.6dB
$ python
Python 2.6.6 (r266:84292, May 13 2011, 10:40:57) 
[GCC 4.2.1 (Apple Inc. build 5664)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import mutagen.mp3
>>> import mutagen.easyid3
>>> tagged = mutagen.mp3.MP3("tagged.mp3", ID3=mutagen.easyid3.EasyID3)
>>> print tagged.pprint()
MPEG 1 layer 3, 320000 bps, 44100 Hz, 247.77 seconds (audio/mp3)
album=The Burst of the West
artist=Harry Potter
encodedby=Fission
performer=Harry Potter
title=You Said it Butch
tracknumber=2/3
>>> untagged = mutagen.mp3.MP3("untagged.mp3", ID3=mutagen.easyid3.EasyID3)
>>> print untagged.pprint()
MPEG 1 layer 3, 192000 bps, 44100 Hz, 248.25 seconds (audio/mp3)
>>> for k in tagged:
...     untagged[k] = tagged[k]
... 
>>> print untagged.pprint()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/mutagen/__init__.py", line 140, in pprint
    try: tags = self.tags.pprint()
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/mutagen/id3.py", line 187, in pprint
    return "\n".join(map(Frame.pprint, self.values()))
TypeError: unbound method pprint() must be called with Frame instance as first 
argument (got list instance instead)
>>> 
>>> untagged.save()
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/mutagen/__init__.py", line 134, in save
    return self.tags.save(filename, **kwargs)
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/mutagen/id3.py", line 365, in save
    framedata = [self.__save_frame(frame) for (key, frame) in frames]
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/mutagen/id3.py", line 443, in __save_frame
    framedata = frame._writeData()
AttributeError: 'list' object has no attribute '_writeData'
>>> tagged
{'album': [u'The Burst of the West'], 'performer': [u'Harry Potter'], 'title': 
[u'You Said it Butch'], 'artist': [u'Harry Potter'], 'encodedby': [u'Fission'], 
'tracknumber': [u'2/3']}
>>> untagged
{'album': [u'The Burst of the West'], 'performer': [u'Harry Potter'], 'artist': 
[u'Harry Potter'], 'title': [u'You Said it Butch'], 'encodedby': [u'Fission'], 
'tracknumber': [u'2/3']}
>>> 
}}}

These errors don't occur, and I can correctly pprint and save the modified 
"untagged.mp3" if I open it either of these ways:
{{{
    untagged = mutagen.mp3.EasyMP3("untagged.mp3")
or
    untagged = mutagen.File("untagged.mp3", easy=True)
}}}

I can't tell whether the errors represent a bug or "expected" behavior.  Both 
the errors and successes occur with the 32K truncated examples attached.

Zoom H2 recorder software v1.2 320Kbps stereo ==> Fission 1.6.10 lossless 
editing ==> lame 3.97 transcoding to 192kbps ==> mutagen 1.20 under Python 
2.6.6 on MacOS 10.6.7 ==> FTWIW !!!1!

Original issue reported on code.google.com by mac.dash...@gmail.com on 16 May 2011 at 12:39

Attachments:

GoogleCodeExporter commented 9 years ago
This issue was closed by revision r107.

Original comment by joe.wreschnig@gmail.com on 16 May 2011 at 9:50