mirror of
https://github.com/beetbox/beets.git
synced 2026-01-01 05:23:05 +01:00
fetchart: fix flake8
This commit is contained in:
parent
d1115ce1ec
commit
09bea52a41
2 changed files with 8 additions and 6 deletions
|
|
@ -29,6 +29,11 @@ from beets import ui
|
|||
from beets import util
|
||||
from beets import config
|
||||
|
||||
try:
|
||||
import itunes
|
||||
HAVE_ITUNES = True
|
||||
except ImportError:
|
||||
HAVE_ITUNES = False
|
||||
|
||||
IMAGE_EXTENSIONS = ['png', 'jpg', 'jpeg']
|
||||
CONTENT_TYPES = ('image/jpeg',)
|
||||
|
|
@ -290,11 +295,8 @@ def sanitize_sources(sources):
|
|||
if s in SOURCES_ALL + ['*']:
|
||||
if not (s in seen or seen.add(s)):
|
||||
res.extend(list(others_sources) if s == '*' else [s])
|
||||
if 'itunes' in res:
|
||||
try:
|
||||
import itunes
|
||||
except ImportError:
|
||||
res.remove('itunes')
|
||||
if not HAVE_ITUNES and 'itunes' in res:
|
||||
res.remove('itunes')
|
||||
return res
|
||||
|
||||
# PLUGIN LOGIC ###############################################################
|
||||
|
|
|
|||
|
|
@ -51,7 +51,7 @@ class FetchartCliTest(unittest.TestCase, TestHelper):
|
|||
res = fetchart.sanitize_sources(['google', '*', 'amazon'])
|
||||
# don't check strict egality on lengths as itunes source may be removed
|
||||
# by plugin
|
||||
self.assertTrue(len(res) >= len(fetchart.SOURCES_ALL)-1 and
|
||||
self.assertTrue(len(res) >= len(fetchart.SOURCES_ALL) - 1 and
|
||||
res[0] == 'google' and res[-1] == 'amazon')
|
||||
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue