MCPcopy
hub / github.com/beetbox/beets / singletons

Method singletons

beetsplug/mbsync.py:71–97  ·  view source on GitHub ↗

Retrieve and apply info from the autotagger for items matched by query.

(self, lib, query, move, pretend, write)

Source from the content-addressed store, hash-verified

69 self.albums(lib, args, move, pretend, write)
70
71 def singletons(self, lib, query, move, pretend, write):
72 """Retrieve and apply info from the autotagger for items matched by
73 query.
74 """
75 for item in lib.items([*query, "singleton:true"]):
76 if not (track_id := item.mb_trackid):
77 self._log.info(
78 "Skipping singleton with no mb_trackid: {}", item
79 )
80 continue
81
82 if not (
83 track_info := metadata_plugins.track_for_id(
84 track_id, item.get("data_source", "MusicBrainz")
85 )
86 ):
87 self._log.info(
88 "Recording ID not found: {} for track {}", track_id, item
89 )
90 continue
91
92 # Apply.
93 with lib.transaction():
94 TrackMatch(Distance(), track_info, item).apply_metadata(
95 from_scratch=False
96 )
97 apply_item_changes(lib, item, move, pretend, write)
98
99 def albums(self, lib, query, move, pretend, write):
100 """Retrieve and apply info from the autotagger for albums matched by

Callers 1

funcMethod · 0.95

Calls 9

TrackMatchClass · 0.90
DistanceClass · 0.90
apply_item_changesFunction · 0.90
transactionMethod · 0.80
itemsMethod · 0.45
infoMethod · 0.45
track_for_idMethod · 0.45
getMethod · 0.45
apply_metadataMethod · 0.45

Tested by

no test coverage detected