Skip to content

Commit a770cfb

Browse files
committed
Opt in chroma plugin.
1 parent b62fb10 commit a770cfb

File tree

1 file changed

+13
-5
lines changed

1 file changed

+13
-5
lines changed

beetsplug/chroma.py

Lines changed: 13 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,14 @@
1919
import re
2020
from collections import defaultdict
2121
from functools import cached_property, partial
22+
from typing import Iterable
2223

2324
import acoustid
2425
import confuse
2526

26-
from beets import config, plugins, ui, util
27+
from beets import config, ui, util
2728
from beets.autotag.distance import Distance
29+
from beets.metadata_plugins import MetadataSourcePlugin, TrackInfo
2830
from beetsplug.musicbrainz import MusicBrainzPlugin
2931

3032
API_KEY = "1vOwZtEn"
@@ -168,10 +170,8 @@ def _all_releases(items):
168170
yield release_id
169171

170172

171-
class AcoustidPlugin(plugins.BeetsPlugin):
173+
class AcoustidPlugin(MetadataSourcePlugin):
172174
def __init__(self):
173-
super().__init__()
174-
175175
self.config.add(
176176
{
177177
"auto": True,
@@ -210,7 +210,7 @@ def candidates(self, items, artist, album, va_likely):
210210
self._log.debug("acoustid album candidates: {0}", len(albums))
211211
return albums
212212

213-
def item_candidates(self, item, artist, title):
213+
def item_candidates(self, item, artist, title) -> Iterable[TrackInfo]:
214214
if item.path not in _matches:
215215
return []
216216

@@ -223,6 +223,14 @@ def item_candidates(self, item, artist, title):
223223
self._log.debug("acoustid item candidates: {0}", len(tracks))
224224
return tracks
225225

226+
def album_for_id(self, *args, **kwargs):
227+
# Lookup by fingerprint ID does not make too much sense.
228+
return None
229+
230+
def track_for_id(self, *args, **kwargs):
231+
# Lookup by fingerprint ID does not make too much sense.
232+
return None
233+
226234
def commands(self):
227235
submit_cmd = ui.Subcommand(
228236
"submit", help="submit Acoustid fingerprints"

0 commit comments

Comments
 (0)