-
-
Notifications
You must be signed in to change notification settings - Fork 794
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
Improved gallery cover lookup #3391
Improved gallery cover lookup #3391
Conversation
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, the only addition I would make would be to also add an option on the settings page to avoid having to directly edit the config file. The docs should probably also be updated for these changes as well.
I skipped the UI due to quite limited spare time and the need to familiarize myself a bit more with the project. Figured it couldn't hurt to already commit this as a rudimentary feature for power users. It is however my intention to implement this in a future commit, hopefully in the coming weeks. |
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.
With latest commit looks and tests ok.
Couldn't notice any performance issues.
Gallery page loading times seem the same and the FindGalleries query doesnt seem to be impacted ( a few ms maybe but the timings arent consistent enough to compare )
It's now possible to change the regex in the settings page. Contrary to what I said previously, I didn't remove the regex compilation check in |
I did some testing and removing the regex check in I also measured the time that only the This also inspired #3424, adding similar validation to all the other regex settings. |
Small PR that changes how gallery covers are looked up. Which should solve (or alleviate) several open issues, including #3311, #1432, #1856, #2720 and #872
Right now only files ending exactly in
cover.jpg
are used as covers, any gallery missing such a file uses its first image.These changes essentially replace
CriterionModifierIncludes
withCriterionModifierMatchesRegex
(performance drop should be negligible), and introducegallery_cover_regex
inconfig.yml
, which defaults to a value of(poster|cover|folder|board)(\.jpg|\.jpeg|\.png)$
.This makes the cover selection function by default much more flexible, but also allows it to be adapted.
Note: First time coding with Go, so I'm unsure if the way the configuration value is passed down to the function isn't total nonsense.