autobpm: Add --force and --quiet options; Deprecate overwrite#6481
autobpm: Add --force and --quiet options; Deprecate overwrite#6481
--force and --quiet options; Deprecate overwrite#6481Conversation
|
Thank you for the PR! The changelog has not been updated, so here is a friendly reminder to check if you need to add an entry. |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #6481 +/- ##
==========================================
- Coverage 70.01% 70.01% -0.01%
==========================================
Files 146 146
Lines 18505 18514 +9
Branches 3010 3012 +2
==========================================
+ Hits 12957 12962 +5
- Misses 4920 4923 +3
- Partials 628 629 +1
🚀 New features to boost your workflow:
|
79fa4e2 to
4b75c68
Compare
overwrite setting
overwrite setting--force and deprecate overwrite setting
227b179 to
8621fa8
Compare
8621fa8 to
2832cc5
Compare
beetsplug/autobpm.py
Outdated
| ) | ||
|
|
||
| def imported(self, _, task: ImportTask) -> None: | ||
| self.calculate_bpm(task.imported_items()) |
There was a problem hiding this comment.
Should this also obey force and quiet from the config?
--force and deprecate overwrite setting--force and --quiet options; Deprecate overwrite
There was a problem hiding this comment.
Pull request overview
This PR update autobpm plugin so user can overwrite existing BPM via new force name (config + CLI), and hide “already has bpm” message via quiet. It also start deprecate old overwrite config name.
Changes:
- Add
--force/-fand--quiet/-qflags tobeet autobpm, and threadforce/quietthrough BPM calculation. - Add config keys
forceandquiet, and deprecateoverwrite(with user warning). - Update docs and changelog to mention new options and deprecation.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 5 comments.
| File | Description |
|---|---|
beetsplug/autobpm.py |
Add force/quiet config + CLI flags; deprecate overwrite and map it to force; adjust logging/skip logic. |
docs/plugins/autobpm.rst |
Document new config defaults; add force/quiet; mark overwrite deprecated. |
docs/changelog.rst |
Add Unreleased changelog bullets for new force + --quiet. |
| def command(self, lib: Library, opts, args: list[str]) -> None: | ||
| force = self.config["force"].get(bool) or opts.force | ||
| quiet = self.config["quiet"].get(bool) or opts.quiet | ||
| self.calculate_bpm( | ||
| list(lib.items(args)), | ||
| write=should_write(), | ||
| force=force, | ||
| quiet=quiet, | ||
| ) | ||
|
|
||
| def imported(self, _, task: ImportTask) -> None: | ||
| self.calculate_bpm(task.imported_items()) | ||
| self.calculate_bpm( | ||
| task.imported_items(), | ||
| force=self.config["force"].get(bool), | ||
| quiet=self.config["quiet"].get(bool), | ||
| ) | ||
|
|
||
| def calculate_bpm(self, items: list[Item], write: bool = False) -> None: | ||
| def calculate_bpm( | ||
| self, | ||
| items: list[Item], | ||
| write: bool = False, | ||
| force: bool = False, | ||
| quiet: bool = False, | ||
| ) -> None: | ||
| for item in items: | ||
| path = item.filepath | ||
| if bpm := item.bpm: | ||
| self._log.info("BPM for {} already exists: {}", path, bpm) | ||
| if not self.config["overwrite"]: | ||
| if not quiet: | ||
| self._log.info("BPM for {} already exists: {}", path, bpm) | ||
| if not force: | ||
| continue |
There was a problem hiding this comment.
grug see new force/quiet behavior and deprecated overwrite path, but tests not check: (1) --force overwrites existing bpm, (2) --quiet suppresses log, (3) overwrite config still works + warns. please add regression tests in existing test/plugins/test_autobpm.py so behavior not break later.
|
Docs render and relevant parts look like this (first time I actually use the conf directives and the deprecations features. Very nice stuff! Love it @snejus) Hope I did it correctly since it doesnt state which version we will throw it out? (The logs say that this is with 3.0.0, so i guess when we deprecate something we will always until next major release which is allowed to include breaking changes, right?)
@jackwilsdon appreciate a final review :-) |
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
e5f66e8 to
48bf094
Compare

Description
Reveal the
overwriteconfig setting to the CLI and at the same time deprecate the option name. It should be namedforceto streamline with other beets configs of the same kind.docs/to describe it.)docs/changelog.rstto the bottom of one of the lists near the top of the document.)