diff --git a/beetsplug/smartplaylist.py b/beetsplug/smartplaylist.py index 3bc18fa69a..6563e60dbd 100644 --- a/beetsplug/smartplaylist.py +++ b/beetsplug/smartplaylist.py @@ -15,7 +15,6 @@ """Generates smart playlists based on beets queries. """ from __future__ import print_function -from itertools import chain from beets.plugins import BeetsPlugin from beets import ui @@ -30,11 +29,17 @@ def _items_for_query(lib, queries, album): latter case, the results from each query are concatenated. `album` indicates whether the queries are item-level or album-level. """ - request = lib.albums if album else lib.items if isinstance(queries, basestring): - return request(queries) + queries = [queries] + if album: + for query in queries: + for album in lib.albums(query): + for item in album.items(): + yield item else: - return chain.from_iterable(map(request, queries)) + for query in queries: + for item in lib.items(query): + yield item class SmartPlaylistPlugin(BeetsPlugin): diff --git a/docs/changelog.rst b/docs/changelog.rst index 69aa4da8de..0a46ba6d6f 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -18,6 +18,8 @@ Fixes: :bug:`1212` * Fix a crash when the importer deals with Unicode metadata in ``--pretend`` mode. :bug:`1214` +* :doc:`/plugins/smartplaylist`: Fix ``album_query`` so that individual files + are added to the playlist instead of directories. :bug:`1225` For developers: The logging system in beets has been overhauled. Plugins now each have their own logger, which helps by automatically adjusting the