fetchart: fix exception when source returns None

This commit is contained in:
Adrian Sampson 2012-12-17 23:22:45 -08:00
parent 5b50f235c6
commit 0c49db0f11
5 changed files with 15 additions and 5 deletions

View file

@ -12,7 +12,7 @@
# The above copyright notice and this permission notice shall be # The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software. # included in all copies or substantial portions of the Software.
__version__ = '1.0rc1' __version__ = '1.0rc2-dev'
__author__ = 'Adrian Sampson <adrian@radbox.org>' __author__ = 'Adrian Sampson <adrian@radbox.org>'
import beets.library import beets.library

View file

@ -149,13 +149,17 @@ def _source_urls(album):
necessary. necessary.
""" """
if album.mb_albumid: if album.mb_albumid:
yield caa_art(album.mb_albumid) url = caa_art(album.mb_albumid)
if url:
yield url
# Amazon and AlbumArt.org. # Amazon and AlbumArt.org.
if album.asin: if album.asin:
for url in art_for_asin(album.asin): for url in art_for_asin(album.asin):
yield url yield url
yield aao_art(album.asin) url = aao_art(album.asin)
if url:
yield url
def art_for_album(album, path, maxwidth=None, local_only=False): def art_for_album(album, path, maxwidth=None, local_only=False):
"""Given an Album object, returns a path to downloaded art for the """Given an Album object, returns a path to downloaded art for the

View file

@ -1,6 +1,12 @@
Changelog Changelog
========= =========
1.0rc2 (in development)
-----------------------
* :doc:`/plugins/fetchart`: Fix a regression that caused crashes when art was
not available from some sources.
1.0rc1 (December 17, 2012) 1.0rc1 (December 17, 2012)
-------------------------- --------------------------

View file

@ -13,7 +13,7 @@ project = u'beets'
copyright = u'2012, Adrian Sampson' copyright = u'2012, Adrian Sampson'
version = '1.0' version = '1.0'
release = '1.0rc1' release = '1.0rc2-dev'
pygments_style = 'sphinx' pygments_style = 'sphinx'

View file

@ -42,7 +42,7 @@ if 'sdist' in sys.argv:
shutil.copytree(os.path.join(docdir, '_build', 'man'), mandir) shutil.copytree(os.path.join(docdir, '_build', 'man'), mandir)
setup(name='beets', setup(name='beets',
version='1.0rc1', version='1.0rc2-dev',
description='music tagger and library organizer', description='music tagger and library organizer',
author='Adrian Sampson', author='Adrian Sampson',
author_email='adrian@radbox.org', author_email='adrian@radbox.org',