Skip to content
This repository has been archived by the owner on Dec 10, 2019. It is now read-only.

Commit

Permalink
Fix #5: Error when scanning for external album art.
Browse files Browse the repository at this point in the history
  • Loading branch information
tkem committed Feb 3, 2015
1 parent 2681e5e commit 34c0b0c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions mopidy_local_images/library.py
Original file line number Diff line number Diff line change
Expand Up @@ -116,18 +116,18 @@ def scan(self, uri):
logger.debug('Scanning %s for images', uri)
data = self.scanner.scan(uri)
tags = data['tags']
images = []
images = set() # filter duplicate URIs, e.g. internal/external
# use 'image' tag if available, smaller 'preview-image' otherwise
for image in tags.get('image', []) or tags.get('preview-image', []):
try:
images.append(self.get_or_create_image_file(None, image.data))
images.add(self.get_or_create_image_file(None, image.data))
except Exception as e:
logger.warn('Cannot extract images for %s: %s', uri, e)
dirname = os.path.dirname(uri_to_path(uri))
for pattern in self.patterns:
for path in glob.glob(os.path.join(dirname, pattern)):
try:
images.append(self.get_or_create_image(path))
images.add(self.get_or_create_image_file(path))
except Exception as e:
logger.warn('Cannot read album art from %s: %s', path, e)
return images
Expand Down

0 comments on commit 34c0b0c

Please sign in to comment.