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 and streamline logging #5582

Merged
merged 6 commits into from
Jan 9, 2025

Conversation

JOJ0
Copy link
Member

@JOJ0 JOJ0 commented Jan 7, 2025

Description

  • Fix lastgenre -A in combination with config option source: track (Tracks inherited the album's genre even when this option was set)

    • Now, When an album-level genre is set already, single tracks don't fall back to the album's genre and request their own last.fm genre.
  • Fix log-level and message wording being slightly different for source: track, album, artist genre

    • Now log messages follow the same wording, level and structure throughout.

Note: This was split out from PR #4982

To Do

JOJ0 added 5 commits January 7, 2025 01:53
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.
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.
- 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.
Copy link

github-actions bot commented Jan 7, 2025

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.

@JOJ0 JOJ0 marked this pull request as draft January 7, 2025 18:00
JOJ0 added a commit that referenced this pull request Jan 8, 2025
@JOJ0 JOJ0 marked this pull request as ready for review January 8, 2025 06:56
JOJ0 added a commit that referenced this pull request Jan 8, 2025
@JOJ0 JOJ0 force-pushed the lastgenre_track branch from 30a4a27 to 5e5a29b Compare January 8, 2025 07:07
@JOJ0 JOJ0 force-pushed the lastgenre_track branch from 5e5a29b to 55c0f7a Compare January 8, 2025 07:42
@JOJ0
Copy link
Member Author

JOJ0 commented Jan 8, 2025

Ready for final testing if you find the time @arsaboo. Also ready for a final code review @snejus or @Serene-Arc, if you have a minute. I think it's pretty straightforward.

Testing like this:

beet lastgenre -s track -f query

and

beet lastgenre -A -s track -f query

@arsaboo
Copy link
Contributor

arsaboo commented Jan 8, 2025

Tested and here's my output:

$ beet lastgenre -A
lastgenre: genre for track Die With A Smile (None):

arsaboo@ubuntuvm2:~$ beet lastgenre -A -s track
lastgenre: genre for track Die With A Smile (None):

I guess this PR is working. The tracks not found is probably a separate issue (about Lastfm search that needs to be improved)

@JOJ0
Copy link
Member Author

JOJ0 commented Jan 8, 2025

This is best tested with an (not too rare) album with many tracks or even better with a various artist compilation.

Copy link
Contributor

@Serene-Arc Serene-Arc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, merge when ready

@JOJ0 JOJ0 merged commit bcc91ff into master Jan 9, 2025
13 checks passed
@JOJ0 JOJ0 deleted the lastgenre_track branch January 9, 2025 06:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants