mirror of
https://github.com/stashapp/stash.git
synced 2025-12-18 21:04:37 +03:00
Images section (#813)
* Add new configuration options * Refactor scan/clean * Schema changes * Add details to galleries * Remove redundant code * Refine thumbnail generation * Gallery overhaul * Don't allow modifying zip gallery images * Show gallery card overlays * Hide zoom slider when not in grid mode
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package paths
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"io/ioutil"
|
||||
"path/filepath"
|
||||
|
||||
@@ -8,8 +9,12 @@ import (
|
||||
"github.com/stashapp/stash/pkg/utils"
|
||||
)
|
||||
|
||||
const thumbDirDepth int = 2
|
||||
const thumbDirLength int = 2 // thumbDirDepth * thumbDirLength must be smaller than the length of checksum
|
||||
|
||||
type generatedPaths struct {
|
||||
Screenshots string
|
||||
Thumbnails string
|
||||
Vtt string
|
||||
Markers string
|
||||
Transcodes string
|
||||
@@ -20,6 +25,7 @@ type generatedPaths struct {
|
||||
func newGeneratedPaths() *generatedPaths {
|
||||
gp := generatedPaths{}
|
||||
gp.Screenshots = filepath.Join(config.GetGeneratedPath(), "screenshots")
|
||||
gp.Thumbnails = filepath.Join(config.GetGeneratedPath(), "thumbnails")
|
||||
gp.Vtt = filepath.Join(config.GetGeneratedPath(), "vtt")
|
||||
gp.Markers = filepath.Join(config.GetGeneratedPath(), "markers")
|
||||
gp.Transcodes = filepath.Join(config.GetGeneratedPath(), "transcodes")
|
||||
@@ -55,3 +61,8 @@ func (gp *generatedPaths) TempDir(pattern string) (string, error) {
|
||||
|
||||
return ret, nil
|
||||
}
|
||||
|
||||
func (gp *generatedPaths) GetThumbnailPath(checksum string, width int) string {
|
||||
fname := fmt.Sprintf("%s_%d.jpg", checksum, width)
|
||||
return filepath.Join(gp.Thumbnails, utils.GetIntraDir(checksum, thumbDirDepth, thumbDirLength), fname)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user