Commit graph

12502 commits

Author SHA1 Message Date
J0J0 Todos
87d9f57e24 In _get_existing_genres ensure empty string ignore 2025-01-22 18:07:43 +01:00
J0J0 Todos
261379f395 Add test_get_genre case proving no-force keeps any
because _get_existing_genres does not rely on configured separator.
2025-01-22 18:07:43 +01:00
J0J0 Todos
34b9021772 Fix test_get_genrer - configure first
otherwise self.whitelist is "set up" before the test cases config is
set.
2025-01-22 18:07:43 +01:00
J0J0 Todos
92e84a2b45 Make sure existing genres are ALWAYS looked at
first thing. Only if genres are existing and force is disabled we return
early!
2025-01-21 18:06:11 +01:00
J0J0 Todos
1219b43af4 Fix a test: no-force always early returns 2025-01-21 17:48:21 +01:00
J0J0 Todos
6530d76319 Revert "Simplify _get_existing_genres()"
This reverts commit 7ff06df17c.

This was here for a reason: Ab empty string genre should als become an
empty list!
2025-01-21 17:44:17 +01:00
J0J0 Todos
4f0837c724 Revert "Include lower-casing in _get_existing already"
This reverts commit d5cf376a51.
2025-01-21 17:21:03 +01:00
J0J0 Todos
d703a7f712 Fix tests for log-label changes 2025-01-21 17:14:15 +01:00
J0J0 Todos
44901873f7 Clarify log-label: keep any, no-force 2025-01-21 17:04:03 +01:00
J0J0 Todos
d5cf376a51 Include lower-casing in _get_existing already
since we don't use it for early-returning no-force-existing genres
anymore.
2025-01-21 17:04:03 +01:00
J0J0 Todos
8da98e52ee Further clarify lastgenre log-labels
state if whitelist was applied or any genre is accepted.
2025-01-21 17:04:03 +01:00
J0J0 Todos
6e6a0ad9a9 Return empty tuple instead of disabling type issue 2025-01-21 17:04:03 +01:00
J0J0 Todos
c9187b40bd Don't uselessly split/join early returned genres 2025-01-21 17:04:03 +01:00
J0J0 Todos
169ec20a2f Remove unused _polish_existing_genres 2025-01-21 17:04:03 +01:00
J0J0 Todos
3cc2a5e2c6 Fix Tuple with tuple in sources property 2025-01-21 17:04:03 +01:00
J0J0 Todos
5d94eb3e13 Fix _get_genre docstring 2025-01-21 17:04:03 +01:00
J0J0 Todos
7ff06df17c Simplify _get_existing_genres()
Co-authored-by: Šarūnas Nejus <snejus@protonmail.com>
2025-01-21 17:04:03 +01:00
J0J0 Todos
c3f0abd61c Fix docstring _resolve_genres
Co-authored-by: Šarūnas Nejus <snejus@protonmail.com>
2025-01-21 17:04:03 +01:00
J0J0 Todos
bb3f9c53c2 lastgenre new defaults, remove config sanity check 2025-01-21 17:04:03 +01:00
J0J0 Todos
4e8948d7ca Rework new & refine existing lastgenre docs chapters
and describe according to new defaults: force and keep_existing
DISABLED, ensuring failsafe operation out of the box.
2025-01-21 17:04:03 +01:00
J0J0 Todos
ca5e471f05 Refactor again _last_lookup 2025-01-21 17:04:03 +01:00
J0J0 Todos
ec10507fab Return as-is if no-force 2025-01-21 17:04:03 +01:00
J0J0 Todos
6e3f5b3127 Fix type hints, Refactor existing genres method
- Rename method _dedup_genre, since it's only used for
  finalizing/polishing existing genres.
- Return separator-delimited string already.
- Decide on not passing "separator" to methods, it's a config
  setting available throughout the plugin. Assign to variable where
  useful for readability though.
- In the force branch, remove re-assigning keep_genres to empty list.
- Fix a test. Existing genres are "polished" now, which means:
  configured title_case is applied.
- Fix/add type hints on all touched and new methods
2025-01-21 17:04:03 +01:00
J0J0 Todos
ed68bc019b Refactor _get_genre, simplify _combine_genre 2025-01-21 17:04:03 +01:00
J0J0 Todos
4580757c8e Simplify _last_lookup()
f-string, list comprehension, remove redundant vars.
2025-01-21 17:04:03 +01:00
J0J0 Todos
f16e671ff6 Simplify _get_genre keep_existing conditional
- If the keep_existing option is set, just remember everything for now.
- Dedup happening later on via _combine... _resolve_genres...
- Even knowing if whitelist or not is not important at this point.
2025-01-21 17:04:03 +01:00
J0J0 Todos
f698f21a28 Ensure _resolve returns list, add type hint
Prevents potential type erros when handing over to
_to_delimited_genre_string.
2025-01-21 17:04:03 +01:00
J0J0 Todos
d358a24ed9 Remove redundant unique_list call in _combine
and clarify in _resolve_genre docstring.
2025-01-21 17:04:02 +01:00
J0J0 Todos
2a80a10aa8 Use util.unique_list in fav of deduplicate 2025-01-21 17:04:02 +01:00
J0J0 Todos
79b5379dce Refactor and rename _is_valid() helper 2025-01-21 17:04:02 +01:00
J0J0 Todos
14974533e8 Revert "Quickfix constant msgpack poetry issue"
This reverts commit cfc4c9866bd7be8856b35bfbb62fd778bfd9054e.
2025-01-21 17:04:02 +01:00
J0J0 Todos
e1fe6fd3d0 Prevent album genre inherit only when source:track
is configured.
2025-01-21 17:04:02 +01:00
J0J0 Todos
bd0c02437a Apply temp logging leftover review suggestions
Useless variables that only were introduced for temporary debug logging
while refactoring earlier. Get rid of them.

Co-authored-by: Šarūnas Nejus <snejus@protonmail.com>
2025-01-21 17:04:02 +01:00
J0J0 Todos
b476560d76 Integrate _format_tag in _to_delimited_...
optimize by checking for config once and simplify tags list slicing.
Remove _format_tags method.

Co-authored-by: Šarūnas Nejus <snejus@protonmail.com>
2025-01-21 17:04:02 +01:00
J0J0 Todos
593f5460b6 Apply type hint suggestions from review
Co-authored-by: Šarūnas Nejus <snejus@protonmail.com>
2025-01-21 17:04:02 +01:00
J0J0 Todos
6b41743b91 Polish 'fetched last.fm tags' debug message
The best place to log what we actually fetched from last.fm seems to be
here in _combine_and_label_genres. Leave out the existing genres we also
receive in this function - less is more.
2025-01-21 17:04:02 +01:00
J0J0 Todos
8d43517a71 Remove all lastgenre temporary debug logging 2025-01-21 17:04:02 +01:00
J0J0 Todos
847b7260b4 Fix most popular track genre fetching (VA albums) 2025-01-21 17:04:02 +01:00
J0J0 Todos
1aca3989d7 Fix previous temp log messages 2025-01-21 17:04:02 +01:00
J0J0 Todos
da98d37632 Temporary debug messages in _sort_by_depth 2025-01-21 17:04:02 +01:00
J0J0 Todos
a717998587 Add a temporary log around whitelist setup 2025-01-21 17:04:02 +01:00
J0J0 Todos
a49f12b110 Final lastgenre docs changes 2025-01-21 17:04:02 +01:00
J0J0 Todos
37fc1b6b7f Final lastgenre plugin linting 2025-01-21 17:04:02 +01:00
J0J0 Todos
6cd000750a _resolve_genre as list tests, add test_to_delimited_string
- Adapt tests to _resolve_genres returning a list with not yet formatted genres.
- Rename and adapt test_count -> test_to_delimited_string. Note that the
  new function does not apply whitelist, prefer anything. It just cuts
  to count and formats!
2025-01-21 17:04:02 +01:00
J0J0 Todos
13ae699230 Fix _dedup_genre, ensure lower case
otherwise deduplicate() can't handle it.
2025-01-21 17:04:02 +01:00
J0J0 Todos
dd3a74ca4d Fix lastgenre limit to count test
- No idea where a missing separator (which is default) could
  happen...just set it explicitely.
- Since we now refactored fetch_genre to returning a list we can add
  mock multiple fetched gernes easier.
2025-01-21 17:04:02 +01:00
J0J0 Todos
569ba73016 Refactor again _combine_and_label_genres 2025-01-21 17:04:02 +01:00
J0J0 Todos
3d036473e7 lastgenre _is_allowed detailed logging
- Add detailed debug logging to learn when and why things go wrong here.
- Shorten docstring
2025-01-21 17:04:02 +01:00
J0J0 Todos
b4590ec3e0 Fix/add lastgenre fallback tests 2025-01-21 17:04:02 +01:00
J0J0 Todos
50e2619ed2 Refactor lastgenre mocked fetchers return list 2025-01-21 17:04:02 +01:00