Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Lastgenre: Fix track-level handling, multi-genre keep, force behaviour, logging #4982

Draft
wants to merge 15 commits into
base: master
Choose a base branch
from

Commits on Oct 31, 2024

  1. Configuration menu
    Copy the full SHA
    182dbd7 View commit details
    Browse the repository at this point in the history
  2. Fix track-level genre handling in lastgenre plugin

    When `lastgenre.source: track` is configured,
    
    - `lastgenre -a` _should not_ fall back to the album level genre (by
      making use of the with_album=False kwarg of the Libary's get method).
    - `lastgenre -a`, when finally storing the genres of _an album_, should
      _not_ also write the tracks genres (by making use of the inherit=False
      kwarg of the Album's store method.
    JOJ0 committed Oct 31, 2024
    Configuration menu
    Copy the full SHA
    a1de6a9 View commit details
    Browse the repository at this point in the history
  3. Streamline lastgenre singleton log with album log

    It was rather confusing that the lastgenre plugin, when handling
    singletons, sometimes showed that it applied genres from last.fm and
    sometimes didn't (it did only in debug log). This streamlines the
    behaviour:
    
    - Change debug to info log.
    - Streamline wording.
    - Display details about the track.
    JOJ0 committed Oct 31, 2024
    Configuration menu
    Copy the full SHA
    6326b4f View commit details
    Browse the repository at this point in the history
  4. Handle dups of existing genres in lastgenre plugin

    When handling existing comma-separated genres in the _get_genre method
    of the plugin, make sure duplicate genres are removed.
    JOJ0 committed Oct 31, 2024
    Configuration menu
    Copy the full SHA
    1ac2220 View commit details
    Browse the repository at this point in the history
  5. Prevent album genre inherit only when source:track

    is configured.
    JOJ0 committed Oct 31, 2024
    Configuration menu
    Copy the full SHA
    f8f3190 View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    2b0fce2 View commit details
    Browse the repository at this point in the history
  7. Another round of lastgenre logging nitpicks

    - Printing out album/item in default format could lead to unreadable
      clutter depending on the user's configured formats.
    - The album's name and the individual tracks' title should be just
      sufficient to provide context as well readability.
    - Log like this while importing as well as in standalone runs.
    JOJ0 committed Oct 31, 2024
    Configuration menu
    Copy the full SHA
    2082b9c View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    174a615 View commit details
    Browse the repository at this point in the history
  9. Use separator as configured instead of hardcoding

    in lastgenre plugin.
    JOJ0 committed Oct 31, 2024
    Configuration menu
    Copy the full SHA
    8a68d70 View commit details
    Browse the repository at this point in the history
  10. Use provided deduplicate function for keep_allowed

    generation, instead of a simple set(). This way we keep the original
    order of genres.
    JOJ0 committed Oct 31, 2024
    Configuration menu
    Copy the full SHA
    e8dcaa7 View commit details
    Browse the repository at this point in the history
  11. Add lastgenre keep_allowed options (-k/-K)

    - Default to False.
    - During PR#4982 discussions we came to the conclusion that the
      following behaviour would be a good new default choice:
      - Keep whitelisted existing genres
      - Only Fetch last.fm genres for empty tags.
      - To get this we also have to change the default of the force
        option!!!
      - Resulting in "force: no" and "keep_allowed: yes"; see Case 4 in
        PR#4982 description
    - Options are not put to use yet, just defined and defaults set!
    JOJ0 committed Oct 31, 2024
    Configuration menu
    Copy the full SHA
    dff1270 View commit details
    Browse the repository at this point in the history
  12. Docs for lastgenre keep_allowed/force

    Keep both options' "Configuration" chapter texts as compact as possible,
    while linking to a new chapter that describes all 4 possible
    combinations in detail.
    JOJ0 committed Oct 31, 2024
    Configuration menu
    Copy the full SHA
    8345934 View commit details
    Browse the repository at this point in the history
  13. Implement --force and --keep-allowed behaviours

    - Retrieving, filtering and deduplicating present genres of Items/Albums
      via separate methods.
    - Implement all four cases of behaviour as described in PR#4982
    - Issues:
      - There is quite some unnecessary spliting of genres from strings into
        lists and the other way round happening throughout the plugin.
      - In the case where existing genres get "augmented" with last.fm
        genres, we might end up with _more_ genres than the configured
        limit.
    JOJ0 committed Oct 31, 2024
    Configuration menu
    Copy the full SHA
    63e4c0c View commit details
    Browse the repository at this point in the history
  14. Refactor keep/new genres combination

    - Handle genre combination logic in a well documented helper function
      that also include type hints.
    - Throughout the _get_genre function rename the result variable to
      new_genres to make it clearly descriptive.
    - Rewrite thze _get_genre function's docstring.
    JOJ0 committed Oct 31, 2024
    Configuration menu
    Copy the full SHA
    3ff7075 View commit details
    Browse the repository at this point in the history
  15. Configuration menu
    Copy the full SHA
    a56098f View commit details
    Browse the repository at this point in the history