class COMR(FrameOpt): """Commercial frame.""" _framespec = [ EncodingSpec('encoding'), Latin1TextSpec('price'), FixedWidthStringSpec('valid_until', 8), Latin1TextSpec('contact'), ByteSpec('format'), EncodedTextSpec('seller'), EncodedTextSpec('desc'), ] _optionalspec = [ Latin1TextSpec('mime'), BinaryDataSpec('logo') ] @property def HashKey(self): return '%s:%s' % (self.FrameID, self._writeData()) def __eq__(self, other): return self._writeData() == other._writeData() __hash__ = FrameOpt.__hash__
class USLT(Frame): """Unsynchronised lyrics/text transcription. Lyrics have a three letter ISO language code ('lang'), a description ('desc'), and a block of plain text ('text'). """ _framespec = [ EncodingSpec('encoding'), FixedWidthStringSpec('lang', 3), EncodedTextSpec('desc'), EncodedTextSpec('text') ] @property def HashKey(self): return '%s:%s:%r' % (self.FrameID, self.desc, self.lang) def __str__(self): return self.text def __eq__(self, other): return self.text == other __hash__ = Frame.__hash__
class USER(Frame): """Terms of use. Attributes: * encoding -- text encoding * lang -- ISO three letter language code * text -- licensing terms for the audio """ _framespec = [ EncodingSpec('encoding'), FixedWidthStringSpec('lang', 3), EncodedTextSpec('text') ] @property def HashKey(self): return '%s:%r' % (self.FrameID, self.lang) def __str__(self): return self.text def __eq__(self, other): return self.text == other __hash__ = Frame.__hash__ def _pprint(self): return "%r=%s" % (self.lang, self.text)
class LINK(FrameOpt): """Linked information. Attributes: * frameid -- the ID of the linked frame * url -- the location of the linked frame * data -- further ID information for the frame """ _framespec = [ FixedWidthStringSpec('frameid', 4), Latin1TextSpec('url') ] _optionalspec = [BinaryDataSpec('data')] @property def HashKey(self): try: return "%s:%s:%s:%r" % ( self.FrameID, self.frameid, self.url, self.data) except AttributeError: return "%s:%s:%s" % (self.FrameID, self.frameid, self.url) def __eq__(self, other): try: return (self.frameid, self.url, self.data) == other except AttributeError: return (self.frameid, self.url) == other __hash__ = FrameOpt.__hash__
class LNK(LINK): """Linked information""" _framespec = [ FixedWidthStringSpec('frameid', 3), Latin1TextSpec('url') ] _optionalspec = [BinaryDataSpec('data')]
class PIC(APIC): """Attached Picture. The 'mime' attribute of an ID3v2.2 attached picture must be either 'PNG' or 'JPG'. """ _framespec = [ EncodingSpec('encoding'), FixedWidthStringSpec('mime', 3), ByteSpec('type'), EncodedTextSpec('desc'), BinaryDataSpec('data') ]
class OWNE(Frame): """Ownership frame.""" _framespec = [ EncodingSpec('encoding'), Latin1TextSpec('price'), FixedWidthStringSpec('date', 8), EncodedTextSpec('seller'), ] def __str__(self): return self.seller def __eq__(self, other): return self.seller == other __hash__ = Frame.__hash__
class COMM(TextFrame): """User comment. User comment frames have a descrption, like TXXX, and also a three letter ISO language code in the 'lang' attribute. """ _framespec = [ EncodingSpec('encoding'), FixedWidthStringSpec('lang', 3), EncodedTextSpec('desc'), MultiSpec('text', EncodedTextSpec('text'), sep=u'\u0000'), ] @property def HashKey(self): return '%s:%s:%r' % (self.FrameID, self.desc, self.lang) def _pprint(self): return "%s=%r=%s" % (self.desc, self.lang, " / ".join(self.text))
class SYLT(Frame): """Synchronised lyrics/text.""" _framespec = [ EncodingSpec('encoding'), FixedWidthStringSpec('lang', 3), ByteSpec('format'), ByteSpec('type'), EncodedTextSpec('desc'), SynchronizedTextSpec('text'), ] @property def HashKey(self): return '%s:%s:%r' % (self.FrameID, self.desc, self.lang) def __eq__(self, other): return str(self) == other __hash__ = Frame.__hash__ def __str__(self): return "".join(text for (text, time) in self.text)