class FLACAlbumart(TrackAlbumart): """ Encoding of flac albumart to flac Picture tags """ def __init__(self, track): if not isinstance(track, flac): raise TagError('Track is not instance of flac') super(FLACAlbumart, self).__init__(track) try: self.albumart = AlbumArt() self.albumart.import_data(self.track.entry.pictures[0].data) except IndexError: self.albumart = None return def import_albumart(self, albumart): """ Imports albumart object to the file tags. Sets self.track.modified to True """ super(FLACAlbumart, self).import_albumart(albumart) p = Picture() [setattr(p, k, v) for k, v in self.albumart.info.items()] self.track.entry.add_picture(p) self.track.modified = True
def __init__(self, track): if not isinstance(track, mp3): raise TagError('Track is not instance of mp3') TrackAlbumart.__init__(self, track) try: self.tag = filter(lambda k: k[:5] == 'APIC:', self.track.entry.keys())[0] except IndexError: self.tag = None return try: albumart = AlbumArt() albumart.import_data(self.track.entry[self.tag].data) except AlbumArtError, emsg: raise TagError('Error reading mp3 albumart tag: %s' % emsg)
def __init__(self, track, tag=AAC_ALBUMART_TAG): if not isinstance(track, aac): raise TagError('Track is not instance of aac') super(AACAlbumArt, self).__init__(track) self.tag = AAC_ALBUMART_TAG if not self.track.entry.has_key(self.tag): return try: albumart = AlbumArt() albumart.import_data(self.track.entry[self.tag][0]) except AlbumArtError as e: raise TagError('Error reading AAC albumart tag: {0}'.format(e)) self.albumart = albumart
def __init__(self, track): if not isinstance(track, mp3): raise TagError('Track is not instance of mp3') super(MP3AlbumArt, self).__init__(track) try: self.tag = [k for k in self.track.entry.keys() if k[:5] == 'APIC:'][0] except IndexError: self.tag = None return try: albumart = AlbumArt() albumart.import_data(self.track.entry[self.tag].data) except AlbumArtError as e: raise TagError('Error reading mp3 albumart tag: {}'.format(e)) self.albumart = albumart
def __init__(self, track): if not isinstance(track, mp3): raise TagError('Track is not instance of mp3') TrackAlbumart.__init__(self, track) try: self.tag = filter(lambda k: k[:5]=='APIC:', self.track.entry.keys() )[0] except IndexError: self.tag = None return try: albumart = AlbumArt() albumart.import_data(self.track.entry[self.tag].data) except AlbumArtError, emsg: raise TagError('Error reading mp3 albumart tag: %s' % emsg)
def __init__(self, track): if not isinstance(track, flac): raise TagError('Track is not instance of flac') super(FLACAlbumart, self).__init__(track) try: self.albumart = AlbumArt() self.albumart.import_data(self.track.entry.pictures[0].data) except IndexError: self.albumart = None return