From 51123d901be7cd2eee7e8def4c4e03de1c588512 Mon Sep 17 00:00:00 2001 From: Adrian Sampson Date: Fri, 25 Jul 2014 21:28:52 -0700 Subject: [PATCH] Fixes for chroma.auto (#888, fix #629) --- beetsplug/chroma.py | 19 +++++++++++++------ docs/changelog.rst | 2 ++ docs/plugins/chroma.rst | 12 +++++++----- 3 files changed, 22 insertions(+), 11 deletions(-) diff --git a/beetsplug/chroma.py b/beetsplug/chroma.py index 6c39f0d6c..b5b8b1be3 100644 --- a/beetsplug/chroma.py +++ b/beetsplug/chroma.py @@ -114,6 +114,16 @@ def _all_releases(items): class AcoustidPlugin(plugins.BeetsPlugin): + def __init__(self): + super(AcoustidPlugin, self).__init__() + + self.config.add({ + 'auto': True, + }) + + if self.config['auto']: + self.register_listener('import_task_start', fingerprint_task) + def track_distance(self, item, info): dist = hooks.Distance() if item.path not in _matches or not info.track_id: @@ -176,16 +186,13 @@ class AcoustidPlugin(plugins.BeetsPlugin): # Hooks into import process. -@AcoustidPlugin.listen('import_task_start') def fingerprint_task(task, session): """Fingerprint each item in the task for later use during the autotagging candidate search. """ - auto = config['acoustid']['auto'] - if auto: - items = task.items if task.is_album else [task.item] - for item in items: - acoustid_match(item.path) + items = task.items if task.is_album else [task.item] + for item in items: + acoustid_match(item.path) @AcoustidPlugin.listen('import_task_apply') diff --git a/docs/changelog.rst b/docs/changelog.rst index 0dbfa0b88..26e095cd0 100644 --- a/docs/changelog.rst +++ b/docs/changelog.rst @@ -65,6 +65,8 @@ Little improvements and fixes: has been improved. Thanks to sotho. * Already imported singleton tracks are skipped when resuming an import. +* :doc:`/plugins/chroma`: A new ``auto`` configuration option disables + fingerprinting on import. Thanks to ddettrittus. 1.3.6 (May 10, 2014) diff --git a/docs/plugins/chroma.rst b/docs/plugins/chroma.rst index dca773e18..511bde4b6 100644 --- a/docs/plugins/chroma.rst +++ b/docs/plugins/chroma.rst @@ -93,11 +93,7 @@ Using Once you have all the dependencies sorted out, you can enable fingerprinting by editing your :doc:`configuration file `. Put ``chroma`` on your ``plugins:`` line. With that, beets will use fingerprinting the next time -you run ``beet import``. This can be disabled by setting the ``auto`` option to -false, like so:: - - acoustid: - auto: no +you run ``beet import``. You can also use the ``beet fingerprint`` command to generate fingerprints for items already in your library. (Provide a query to fingerprint a subset of your @@ -105,6 +101,12 @@ library.) The generated fingerprints will be stored in the library database. If you have the ``import.write`` config option enabled, they will also be written to files' metadata. +You can disable fingerprinting on import by setting the ``auto`` option to +false, like so:: + + chroma: + auto: no + .. _submitfp: Submitting Fingerprints