-
-
Notifications
You must be signed in to change notification settings - Fork 384
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
PICARD-1477: Option to never replace an image with a smaller one #2521
PICARD-1477: Option to never replace an image with a smaller one #2521
Conversation
I'm not sure there is a "best" way to handle this with multiple images of the same type. With your suggestion, I assume you mean "Maybe the minimum among currently embedded images of the same type"? That's probably as good as any approach. I certainly can't think of anything better right now. A bit off topic perhaps, but... What do you think of an option like "Never replace embedded images of this type:" to allow adding such an image if it doesn't exist, but not replace it (them) if an image of that type does exist? The selection interface could be similar to the one used for the "Cover Art Archive" -> "Download only cover art images matching selected types" (possibly even reusing the same one with a slightly different note at the bottom): As a side note, I really should fix the size of that window to decrease the minimum width. |
Yes sorry, this is what I meant
I like the idea, this makes me think I should try to improve the possibilities for image filters. If I pass also the I think it would make it easier to add more features like these in the future too. |
Now I made the dict keep track only of the smallest image for each type.
For now I reused the same one, as I'm still trying to understand where it would be best to create a new one. I was thinking to create a new class that inherits from Maybe inside the same file as the cover art options page? |
Creating a new class should work, but I'm wondering if it would be simpler to use the same class but just change the appropriate label text when loading it? In any case it may be appropriate to make some size adjustments to the existing dialog to decrease the width and allow expanding (vertically?) to accommodate text of different lengths. I'm not sure I took into account different string lengths due to different language translations when I initially designed it. I was pretty new to Python and the whole i18n stuff at the time. If you think there's any value in that, I should be able to take a quick look at making it more flexible (in a separate PR). |
Which text do you want to change? If you go for subclassing (which I'm ok with), you can do it directly where it is used. |
Ah that makes sense, thank you so much to both of you!
I just tested it and the dialog seems to expand vertically automatically based on the size of the text, so I think there's no need to worry about that. |
Have a look at #2522. This would allow you to specify the alternate instructions (both above and below the list boxes) in the call to the dialog. It might be simpler than adding a new class. |
@twodoorcoupe @rdswift 's PR was merged, you can update this one. |
aed4462
to
fba6441
Compare
Thank you @rdswift for the help! This is what the new cover art options look like (I just added the two checkboxes under "Embed only a single front image"): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me, too. Nice work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good work, LGTM
Summary
Adds an option in the "Cover Art" options page to never replace embedded cover art with smaller images of the same type.
Problem
Solution
At first I tried to implement this as a filter, but I hit a wall. So I had to move the logic inside
coverart/__init__.py
. Now when an image is downloaded, it checks if there was an image of the same type embedded into tags and if it was bigger.I'm not entirely convinced by this solution either, in fact I'm still not sure how multiple images of the same type should be handled. For example, if a file has multiple "booklet" type images embedded, what size should I compare the downloaded image with? Maybe the minimum among images of the same type?
Action
Additional actions required: