acousticbrainz: Allow filtering on a query

Like other, similar commands.
This commit is contained in:
Adrian Sampson 2015-12-31 11:33:58 -08:00
parent 878161bb4f
commit 5d89b7da67
2 changed files with 7 additions and 5 deletions

View file

@ -35,16 +35,17 @@ class AcousticPlugin(plugins.BeetsPlugin):
help="fetch metadata from AcousticBrainz")
def func(lib, opts, args):
fetch_info(self._log, lib)
items = lib.items(ui.decargs(args))
fetch_info(self._log, items, ui.should_write())
cmd.func = func
return [cmd]
def fetch_info(log, lib):
def fetch_info(log, items, write):
"""Currently outputs MBID and corresponding request status code
"""
for item in lib.items():
for item in items:
if item.mb_trackid:
log.info('getting data for: {}', item)
@ -79,7 +80,8 @@ def fetch_info(log, lib):
["highlevel", "mood_party", "all", "party"],
)
item.write()
if write:
item.try_write()
item.store()

View file

@ -9,7 +9,7 @@ The ``acoustricbrainz`` plugin gets acoustic-analysis information from the
Enable the ``acousticbrainz`` plugin in your configuration (see :ref:`using-plugins`) and run it by typing::
$ beet acousticbrainz
$ beet acousticbrainz [QUERY]
For all tracks with a MusicBrainz recording ID, the plugin currently sets
these fields: