Skip to content

Commit

Permalink
Lastgenre: New config option keep_existing (#4982)
Browse files Browse the repository at this point in the history
##  New config option `keep_existing` (#4982)

- Fix the behavior of the`force` option. Previously disabling the option
had "incomplete" behaviour:
- If content was found, a whitelist check was issued and if valid the
plugin exited early and logged ("keep").
- This whitelist check was not aware of multiple genres (separated
typically by a string like `, `), thus it failed erased all existing
genres and overwrote with new ones.
 
_**This didn't feel like a typical behaviour of a `force` option, which
this PR tries to improve as follows...**_

- String-separated multi-genres are now compiled into a list and
depending on the `whitelist` option are kept and enriched with freshly
fetched last.fm genres.

- If force is off, pre-populated tags are not touched.

- A lot of refactoring was done, some absolutely required, some as a
preparation for future work on the plugin.

- The main processing function `_get_genre` was massively overhauled and
got a new `pytest.mark.parametrize` test which includes much more test
cases.
  • Loading branch information
JOJ0 authored Jan 23, 2025
2 parents f709ac1 + 9d4653f commit 9682f24
Show file tree
Hide file tree
Showing 3 changed files with 501 additions and 177 deletions.
Loading

0 comments on commit 9682f24

Please sign in to comment.