37
37
38
38
import beets
39
39
from beets import logging
40
- from beets .autotag .distance import Distance
41
40
from beets .util .id_extractors import extract_release_id
42
41
43
42
if TYPE_CHECKING :
55
54
from confuse import ConfigView
56
55
57
56
from beets .autotag import AlbumInfo , TrackInfo
57
+ from beets .autotag .distance import Distance
58
58
from beets .dbcore import Query
59
59
from beets .dbcore .db import FieldQueryType
60
60
from beets .dbcore .types import Type
@@ -225,6 +225,8 @@ def track_distance(
225
225
"""Should return a Distance object to be added to the
226
226
distance for every track comparison.
227
227
"""
228
+ from beets .autotag .distance import Distance
229
+
228
230
return Distance ()
229
231
230
232
def album_distance (
@@ -236,6 +238,8 @@ def album_distance(
236
238
"""Should return a Distance object to be added to the
237
239
distance for every album-level comparison.
238
240
"""
241
+ from beets .autotag .distance import Distance
242
+
239
243
return Distance ()
240
244
241
245
def candidates (
@@ -455,6 +459,8 @@ def track_distance(item: Item, info: TrackInfo) -> Distance:
455
459
"""Gets the track distance calculated by all loaded plugins.
456
460
Returns a Distance object.
457
461
"""
462
+ from beets .autotag .distance import Distance
463
+
458
464
dist = Distance ()
459
465
for plugin in find_plugins ():
460
466
dist .update (plugin .track_distance (item , info ))
@@ -467,6 +473,8 @@ def album_distance(
467
473
mapping : dict [Item , TrackInfo ],
468
474
) -> Distance :
469
475
"""Returns the album distance calculated by plugins."""
476
+ from beets .autotag .distance import Distance
477
+
470
478
dist = Distance ()
471
479
for plugin in find_plugins ():
472
480
dist .update (plugin .album_distance (items , album_info , mapping ))
@@ -653,6 +661,8 @@ def get_distance(
653
661
"""Returns the ``data_source`` weight and the maximum source weight
654
662
for albums or individual tracks.
655
663
"""
664
+ from beets .autotag .distance import Distance
665
+
656
666
dist = Distance ()
657
667
if info .data_source == data_source :
658
668
dist .add ("source" , config ["source_weight" ].as_number ())
0 commit comments