leosongwei / mutagen

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

Support Pickle protocol #102

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
It would be nice if Metadata instances could be pickeled. They are essentially 
dicts, after all.

Original issue reported on code.google.com by elsdoer...@gmail.com on 11 Dec 2011 at 5:59

GoogleCodeExporter commented 9 years ago
What doesn't work about pickling right now?

Original comment by joe.wreschnig@gmail.com on 11 Dec 2011 at 10:22

GoogleCodeExporter commented 9 years ago
Trying further, I see that the error only occurs when using EasyID3, not with 
the default ID3 class. (I have not tried other types).

>>> import mutagen, pickle
>>> audio = mutagen.File(r'test.mp3', easy=True)
>>> pickle.dumps(audio)
.....
TypeError: can't pickle instancemethod objects

This is because audio.tags has load, save, and delete methods attached to the 
instance:

(in easyid3.py)

    def __init__(self, filename=None):
        self.__id3 = ID3()
        self.load = self.__id3.load
        self.save = self.__id3.save
        self.delete = self.__id3.delete

Original comment by elsdoer...@gmail.com on 16 Dec 2011 at 3:42

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

Original comment by reiter.christoph@gmail.com on 14 Aug 2012 at 10:51