From 5ed6f59983895d3ba7c855959f0ec1b7c7f26f3c Mon Sep 17 00:00:00 2001 From: Adrian Sampson Date: Tue, 28 Oct 2014 11:05:26 -0700 Subject: [PATCH] Slight simplification for #1042 --- beets/mediafile.py | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/beets/mediafile.py b/beets/mediafile.py index c101c9f32b..51ef64895e 100644 --- a/beets/mediafile.py +++ b/beets/mediafile.py @@ -955,7 +955,7 @@ class APEv2ImageStorageStyle(ListStorageStyle): """ formats = ['APEv2File', 'WavPack', 'Musepack', 'MonkeysAudio', 'OptimFROG'] - _APE_COVER_TAG_NAMES = { + TAG_NAMES = { ImageType.other: 'Cover Art (other)', ImageType.icon: 'Cover Art (icon)', ImageType.other_icon: 'Cover Art (other icon)', @@ -976,15 +976,15 @@ class APEv2ImageStorageStyle(ListStorageStyle): ImageType.fish: 'Cover Art (colored fish)', ImageType.illustration: 'Cover Art (illustration)', ImageType.artist_logo: 'Cover Art (band logo)', - ImageType.publisher_logo: 'Cover Art (publisher logo)'} + ImageType.publisher_logo: 'Cover Art (publisher logo)', + } def __init__(self): super(APEv2ImageStorageStyle, self).__init__(key='') def fetch(self, mutagen_file): images = [] - for cover_type, cover_tag in \ - APEv2ImageStorageStyle._APE_COVER_TAG_NAMES.iteritems(): + for cover_type, cover_tag in self.TAG_NAMES.items(): try: frame = mutagen_file[cover_tag] text_delimiter_index = frame.value.find('\x00') @@ -1005,14 +1005,13 @@ def set_list(self, mutagen_file, values): image_type = image.type or ImageType.other comment = image.desc or '' image_data = comment + "\x00" + image.data - cover_tag = APEv2ImageStorageStyle._APE_COVER_TAG_NAMES[image_type] + cover_tag = self.TAG_NAMES[image_type] mutagen_file[cover_tag] = image_data def delete(self, mutagen_file): """Remove all images from the file. """ - for cover_tag in \ - APEv2ImageStorageStyle._APE_COVER_TAG_NAMES.itervalues(): + for cover_tag in self.TAG_NAMES.values(): try: del mutagen_file[cover_tag] except KeyError: