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

Improved gallery cover lookup #3391

Merged
merged 11 commits into from
Feb 22, 2023
9 changes: 9 additions & 0 deletions internal/manager/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ import (
"github.com/stashapp/stash/pkg/logger"
"github.com/stashapp/stash/pkg/models"
"github.com/stashapp/stash/pkg/models/paths"
"github.com/stashapp/stash/pkg/plugin/common/log"
)

var officialBuild string
Expand Down Expand Up @@ -640,6 +641,14 @@ func (i *Instance) GetVideoFileNamingAlgorithm() models.HashAlgorithm {
}

func (i *Instance) GetGalleryCoverRegex() string {
var regexString = i.getString(GalleryCoverRegex)

_, err := regexp.Compile(regexString)
if err != nil {
log.Warn(fmt.Sprintf("Gallery cover regex '%v' invalid, reverting to default.", regexString))
Ksrx01 marked this conversation as resolved.
Show resolved Hide resolved
return galleryCoverRegexDefault
}

return i.getString(GalleryCoverRegex)
}

Expand Down
1 change: 1 addition & 0 deletions ui/v2.5/src/docs/en/Manual/Configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ These options are typically not exposed in the UI and must be changed manually i
| `custom_ui_location` | The file system folder where the UI files will be served from, instead of using the embedded UI. Empty to disable. Stash must be restarted to take effect. |
| `max_upload_size` | Maximum file upload size for import files. Defaults to 1GB. |
| `theme_color` | Sets the `theme-color` property in the UI. |
| `gallery_cover_regex` | The regex responsible for selecting images as gallery covers |

### Custom served folders

Expand Down