MCPcopy Index your code
hub / github.com/beetbox/beets / singletons

Method singletons

beetsplug/bpsync.py:75–100  ·  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

73 self.albums(lib, args, move, pretend, write)
74
75 def singletons(self, lib, query, move, pretend, write):
76 """Retrieve and apply info from the autotagger for items matched by
77 query.
78 """
79 for item in lib.items([*query, "singleton:true"]):
80 if not item.mb_trackid:
81 self._log.info(
82 "Skipping singleton with no mb_trackid: {}", item
83 )
84 continue
85
86 if not self.is_beatport_track(item):
87 self._log.info(
88 "Skipping non-{.beatport_plugin.data_source} singleton: {}",
89 self,
90 item,
91 )
92 continue
93
94 # Apply.
95 trackinfo = self.beatport_plugin.track_for_id(item.mb_trackid)
96 with lib.transaction():
97 TrackMatch(Distance(), trackinfo, item).apply_metadata(
98 from_scratch=False
99 )
100 apply_item_changes(lib, item, move, pretend, write)
101
102 @staticmethod
103 def is_beatport_track(item):

Callers 1

funcMethod · 0.95

Calls 9

is_beatport_trackMethod · 0.95
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
apply_metadataMethod · 0.45

Tested by

no test coverage detected