Repository navigation
Fix lastgenre output during import - #7107
Sabrina04072003 wants to merge 3 commits into
Conversation
henry-oberholtzer
left a comment
There was a problem hiding this comment.
Looks like this completely removes the ability to view changes for the user when running automatically, which is an unfortunate loss of information communicated to the user. I'd personally rather see this implemented as a configuration option when running in auto mode, as being able to choose between viewing the output or not is useful.
I think the crux of this issue has to do with parallelism, and the fact that the plugin only triggers on a completed import, which can run in a different thread, and may lag behind the UI updates for the user.
It's also tricky, as until a candidate is chosen, choosing the right genres from Last.FM based on information we're attempting to tag would be inaccurate. A possible workaround would be to run LastGenre per candidate, before they're presented to the user, and show the tags with the candidate, but that might be an excessive number of extra queries to make.
I'll defer to @JOJ0 on this though since they know the most about the plugin!
|
@henry-oberholtzer but in general when a plugin is doing something in |
So what I'm trying to say Henry, is that actually printing out the changes ( What at first I was not sure about and that would have been a question for @snejus is if deciding to show output is something to be decided in the plugin code or rather be solved within that show_model_changes function already? From investigating other use-cases of this function, I can see that So I think this change is legitimate :-) |
|
Hi @Sabrina04072003 could you rebase this branch with |
|
Thanks for clarifying @JOJ0 ! That makes a lot of sense. I think this is a great fix then & also happy to approve once rebased. |
|
Hmm I'm not entirely sure we want to hide the output altogether. For example, lyrics plugin also prints stuff in
@Sabrina04072003 are you importing using |
|
I agree that it's useful information but does it look pretty enough? How and where does lyrics print it? Can you print an example output. Also for lastgenre an example output would be nice here (too lazy to test myself ATM. can do later!) |
|
See Maybe we should only print the output in verbose |
|
Thanks @snejus , but that is different situations we are comparing. lyrics seems to output already as DEBUG or INFO log. lastgenre ussually does that but only the So I agree we should print it only as actual log, but I'd still want to see that (very helpful) output in standalone runs of the plugin. So let's make it an INFO log rather than a DEBUG log. So insetad of do |
|
or @snejus another idea: Do
Log info:
Log debug:
|
|
@JOJ0 I think I prefer the initial idea using |
|
Hi @Sabrina04072003 do you want to make the here suggested changes #7107 (comment) or is it ok if I push them? (I have it locally already), either way is fine, just tell us if you will find the time to come back to finishing this PR! Thanks for your submission! |
|
Hi @JOJ0, thank you for the suggestions! I will make the changes myself (using @snejus about your question: I did not reproduce the whole scenario with a real interactive import. It needs Last.fm and MusicBrainz access and albums that wait for input, and I did not set that up. I found the likely cause by reading the code: What I did check: with automated tests (also on Windows), the import stage printed the genre changes with the original code, and with the fix it prints nothing by default. |
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013HUsEieYZDzwW94X32CkqK
45b1008 to
c635b15
Compare
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013HUsEieYZDzwW94X32CkqK
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013HUsEieYZDzwW94X32CkqK
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #7107 +/- ##
==========================================
+ Coverage 80.65% 80.67% +0.01%
==========================================
Files 150 150
Lines 21298 21300 +2
Branches 3294 3295 +1
==========================================
+ Hits 17178 17183 +5
+ Misses 3291 3289 -2
+ Partials 829 828 -1
🚀 New features to boost your workflow:
|
| # Only print the changes if INFO logs are enabled. That is the case when | ||
| # running the command, but not during an import (unless it is verbose), | ||
| # where printed output can appear on top of the importer's prompt. |
There was a problem hiding this comment.
maybe shorten this. a very short comment why it is here would be sufficient, leaving out the technical details we read in the code anyway. thanks
JOJ0
left a comment
There was a problem hiding this comment.
Please rebase your branch with master again, I hope you don't get too much conflicts, there were quite some linting/code-style changes in the last days that might lead to such. Other than that, the regression tests look ok and we can merge it once rebase is done. Thank you!
Description
Fixes #6830.
During an import, the
lastgenreplugin prints the fetched genres to the terminal. This output can appear on top of the importer's prompt for the next album, making the import look frozen.This PR fixes the issue by preventing the
importedhook from printing genre changes during an import. The genres are still fetched and saved, andbeet lastgenrecontinues to display changes as before.I investigated the code to identify the likely cause. I added a regression test to verify that the import stage does not print anything and that the genres are still assigned correctly. I also tested the change on Windows and confirmed that the new test fails with the original code and passes with the fix.
If someone can reproduce the original issue, I would appreciate confirmation that this fix resolves it.
AI usage
I used Claude to help me with this contribution. I ran the tests and linter myself .