From 3314db2f77cb6b4a5ac4639e990a6ade08472144 Mon Sep 17 00:00:00 2001 From: Adrian Sampson Date: Sat, 12 Dec 2015 16:44:55 -0800 Subject: [PATCH] fetchart: Better logging for iTunes (#1760) --- beetsplug/fetchart.py | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/beetsplug/fetchart.py b/beetsplug/fetchart.py index 1b2089b58..81137dc28 100644 --- a/beetsplug/fetchart.py +++ b/beetsplug/fetchart.py @@ -196,11 +196,19 @@ class ITunesStore(ArtSource): try: # Isolate bugs in the iTunes library while searching. try: - itunes_album = itunes.search_album(search_string)[0] + results = itunes.search_album(search_string) except Exception as exc: self._log.debug('iTunes search failed: {0}', exc) return + # Get the first match. + if results: + itunes_album = results[0] + else: + self._log.debug('iTunes search for {:r} got no results', + search_string) + return + if itunes_album.get_artwork()['100']: small_url = itunes_album.get_artwork()['100'] big_url = small_url.replace('100x100', '1200x1200')