From d3f0742276d65fb2c215e768a4f5c8816f883704 Mon Sep 17 00:00:00 2001 From: Adrian Sampson Date: Tue, 11 Nov 2014 10:10:43 -0800 Subject: [PATCH] Changelog, tweaks for fetchart sources (#1075) --- beetsplug/fetchart.py | 30 ++++++++++++++++-------------- docs/changelog.rst | 5 +++-- docs/plugins/fetchart.rst | 14 +++++++------- 3 files changed, 26 insertions(+), 23 deletions(-) diff --git a/beetsplug/fetchart.py b/beetsplug/fetchart.py index 18ffe7790..e2a409ad6 100644 --- a/beetsplug/fetchart.py +++ b/beetsplug/fetchart.py @@ -285,20 +285,6 @@ def art_for_album(album, paths, maxwidth=None, local_only=False): return out -def sanitize_sources(sources): - """Remove unknown or duplicate sources while keeping original order. - """ - seen = set() - others_sources = set(SOURCES_ALL) - set(sources) - res = [] - for s in 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 not HAVE_ITUNES and 'itunes' in res: - res.remove('itunes') - return res - # PLUGIN LOGIC ############################################################### @@ -327,6 +313,22 @@ def batch_fetch_art(lib, albums, force, maxwidth=None): message)) +def sanitize_sources(sources): + """Clean up the user's configured source list. Remove unknown or + duplicate sources while keeping original order. + """ + seen = set() + others = set(SOURCES_ALL) - set(sources) + res = [] + for s in sources: + if s in SOURCES_ALL + ['*']: + if not (s in seen or seen.add(s)): + res.extend(list(others) if s == '*' else [s]) + if not HAVE_ITUNES and 'itunes' in res: + res.remove('itunes') + return res + + class FetchArtPlugin(BeetsPlugin): def __init__(self): super(FetchArtPlugin, self).__init__() diff --git a/docs/changelog.rst b/docs/changelog.rst index b5ef7e180..d66a37787 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -29,8 +29,9 @@ Features: disable this, unset the ``auto`` config flag. * Standard cover art in APEv2 metadata is now supported. Thanks to Matthias Kiefer. :bug:`1042` -* :doc:`/plugins/fetchart`: Art can now be searched for on the iTunes Store, - using the python-itunes library. +* :doc:`/plugins/fetchart`: Art can now be searched for on the iTunes Store. + There's also a new ``sources`` config option that lets you choose exactly + where to look for images and in which order. * :doc:`/plugins/replaygain`: A new Python Audio Tools backend was added. Thanks to Francesco Rubino. :bug:`1070` diff --git a/docs/plugins/fetchart.rst b/docs/plugins/fetchart.rst index 936765cc1..47aeabdc9 100644 --- a/docs/plugins/fetchart.rst +++ b/docs/plugins/fetchart.rst @@ -45,13 +45,13 @@ file. The available options are: as fallback. Default: ``no``; remote (Web) art sources are only queried if no local art is found in the filesystem. -- **sources**: List of websites sources to query when searching arts. Star char - `*` expands to all available sources. - Default : ``coverart itunes albumart amazon google`` ie all sources +- **sources**: List of sources to search for images. An asterisk `*` expands + to all available sources. + Default: ``coverart itunes albumart amazon google``, i.e., all sources Here's an example that makes plugin select only images that contain *front* or -*back* keywords in their filenames and prioritize 'itunes' over others -sources:: +*back* keywords in their filenames and prioritizes the iTunes source over +others:: fetchart: cautious: true @@ -97,8 +97,8 @@ Album Art Sources By default, this plugin searches for art in the local filesystem as well as on the Cover Art Archive, the iTunes Store, Amazon, AlbumArt.org, -and Google Image Search, in that order. You can remove sources to speed up the -process, or reorder them using the ``sources`` configuration option. +and Google Image Search, in that order. You can reorder the sources or remove +some to speed up the process using the ``sources`` configuration option. When looking for local album art, beets checks for image files located in the same folder as the music files you're importing. Beets prefers to use an image