19
19
import re
20
20
from collections import defaultdict
21
21
from functools import cached_property , partial
22
+ from typing import Iterable
22
23
23
24
import acoustid
24
25
import confuse
25
26
26
- from beets import config , plugins , ui , util
27
+ from beets import config , ui , util
27
28
from beets .autotag .distance import Distance
29
+ from beets .metadata_plugins import MetadataSourcePlugin , TrackInfo
28
30
from beetsplug .musicbrainz import MusicBrainzPlugin
29
31
30
32
API_KEY = "1vOwZtEn"
@@ -168,10 +170,8 @@ def _all_releases(items):
168
170
yield release_id
169
171
170
172
171
- class AcoustidPlugin (plugins . BeetsPlugin ):
173
+ class AcoustidPlugin (MetadataSourcePlugin ):
172
174
def __init__ (self ):
173
- super ().__init__ ()
174
-
175
175
self .config .add (
176
176
{
177
177
"auto" : True ,
@@ -210,7 +210,7 @@ def candidates(self, items, artist, album, va_likely):
210
210
self ._log .debug ("acoustid album candidates: {0}" , len (albums ))
211
211
return albums
212
212
213
- def item_candidates (self , item , artist , title ):
213
+ def item_candidates (self , item , artist , title ) -> Iterable [ TrackInfo ] :
214
214
if item .path not in _matches :
215
215
return []
216
216
@@ -223,6 +223,14 @@ def item_candidates(self, item, artist, title):
223
223
self ._log .debug ("acoustid item candidates: {0}" , len (tracks ))
224
224
return tracks
225
225
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
+
226
234
def commands (self ):
227
235
submit_cmd = ui .Subcommand (
228
236
"submit" , help = "submit Acoustid fingerprints"
0 commit comments