leosongwei / mutagen

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

ID3: POPM: Does not support empty counts as per ID3v2.4 spec. #33

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
http://www.id3.org/id3v2.4.0-frames

Here's a fix:

class POPM(Frame):
    """Popularimeter.

    This frame keys a rating (out of 255) and a play count to an email
    address.

    Attributes:
    email -- email this POPM frame is for
    rating -- rating from 0 to 255
    count -- number of times the files has been played
    """
    _framespec = [Latin1TextSpec('email'), ByteSpec('rating')]
    _optionalspec = [ IntegerSpec('count') ]
    HashKey = property(lambda s: '%s:%s' % (s.FrameID, s.email))

    def __eq__(self, other): return self.rating == other
    def __pos__(self): return self.rating
    def _pprint(self):
        try: return "%s=%s %s/255" % (self.email, self.count, self.rating)
        except AttributeError: return "%s=%s %s/255" % (self.email, '0',
self.rating)

Original issue reported on code.google.com by opensh...@gmail.com on 27 Oct 2009 at 4:21

GoogleCodeExporter commented 9 years ago
Fixing this allows mutagen to read Windows Media Player rating tags. :) For 
now, this
will be monkey patched in MB Picard.

Original comment by opensh...@gmail.com on 27 Oct 2009 at 4:25

GoogleCodeExporter commented 9 years ago

Original comment by joe.wreschnig@gmail.com on 27 Oct 2009 at 7:58

GoogleCodeExporter commented 9 years ago

Original comment by joe.wreschnig@gmail.com on 27 Oct 2009 at 7:58

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

Original comment by joe.wreschnig@gmail.com on 28 Oct 2009 at 5:16