mirror of
https://github.com/beetbox/beets.git
synced 2025-12-06 16:42:42 +01:00
fetchart: cover engines yield their results
This commit is contained in:
parent
5713df3d5a
commit
ef6d3efe6d
2 changed files with 9 additions and 9 deletions
|
|
@ -126,7 +126,7 @@ def aao_art(album):
|
|||
m = re.search(AAO_PAT, resp.text)
|
||||
if m:
|
||||
image_url = m.group(1)
|
||||
return image_url
|
||||
yield image_url
|
||||
else:
|
||||
log.debug(u'fetchart: no image found on page')
|
||||
|
||||
|
|
@ -155,7 +155,7 @@ def google_art(album):
|
|||
data = results['responseData']
|
||||
dataInfo = data['results']
|
||||
for myUrl in dataInfo:
|
||||
return myUrl['unescapedUrl']
|
||||
yield myUrl['unescapedUrl']
|
||||
except:
|
||||
log.debug(u'fetchart: error scraping art page')
|
||||
return
|
||||
|
|
@ -172,7 +172,7 @@ def itunes_art(album):
|
|||
if itunes_album.get_artwork()['100']:
|
||||
small_url = itunes_album.get_artwork()['100']
|
||||
big_url = small_url.replace('100x100', '1200x1200')
|
||||
return big_url
|
||||
yield big_url
|
||||
else:
|
||||
log.debug(u'fetchart: album has no artwork in iTunes Store')
|
||||
except IndexError:
|
||||
|
|
@ -181,6 +181,7 @@ def itunes_art(album):
|
|||
|
||||
# Art from the filesystem.
|
||||
|
||||
|
||||
def filename_priority(filename, cover_names):
|
||||
"""Sort order for image names.
|
||||
|
||||
|
|
@ -244,9 +245,8 @@ def _source_urls(album, sources=SOURCES_ALL):
|
|||
"""
|
||||
for s in sources:
|
||||
urls = ART_FUNCS[s](album)
|
||||
if urls:
|
||||
for url in urls:
|
||||
yield url
|
||||
for url in urls:
|
||||
yield url
|
||||
|
||||
|
||||
def art_for_album(album, paths, maxwidth=None, local_only=False):
|
||||
|
|
|
|||
|
|
@ -198,13 +198,13 @@ class AAOTest(_common.TestCase):
|
|||
self.mock_response(self.AAO_URL, body)
|
||||
album = _common.Bag(asin=self.ASIN)
|
||||
res = fetchart.aao_art(album)
|
||||
self.assertEqual(res, 'TARGET_URL')
|
||||
self.assertEqual(list(res)[0], 'TARGET_URL')
|
||||
|
||||
def test_aao_scraper_returns_none_when_no_image_present(self):
|
||||
def test_aao_scraper_returns_no_result_when_no_image_present(self):
|
||||
self.mock_response(self.AAO_URL, 'blah blah')
|
||||
album = _common.Bag(asin=self.ASIN)
|
||||
res = fetchart.aao_art(album)
|
||||
self.assertEqual(res, None)
|
||||
self.assertEqual(list(res), [])
|
||||
|
||||
|
||||
class GoogleImageTest(_common.TestCase):
|
||||
|
|
|
|||
Loading…
Reference in a new issue