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

Method set_fields

beets/importer/tasks.py:289–308  ·  view source on GitHub ↗

Sets the fields given at CLI or configuration to the specified values, for both the album and all its items.

(self, lib: library.Library)

Source from the content-addressed store, hash-verified

287 )
288
289 def set_fields(self, lib: library.Library) -> None:
290 """Sets the fields given at CLI or configuration to the specified
291 values, for both the album and all its items.
292 """
293 items = self.imported_items()
294 for field, view in config["import"]["set_fields"].items():
295 value = str(view.get())
296 log.debug(
297 "Set field {}={} for {}",
298 field,
299 value,
300 util.displayable_path(self.paths),
301 )
302 self.album.set_parse(field, format(self.album, value))
303 for item in items:
304 item.set_parse(field, format(item, value))
305 with lib.transaction():
306 for item in items:
307 item.store()
308 self.album.store()
309
310 def finalize(self, session: ImportSession) -> None:
311 """Save progress, clean up files, and emit plugin event."""

Callers 1

_apply_choiceFunction · 0.45

Calls 7

imported_itemsMethod · 0.95
set_parseMethod · 0.80
transactionMethod · 0.80
itemsMethod · 0.45
getMethod · 0.45
debugMethod · 0.45
storeMethod · 0.45

Tested by

no test coverage detected