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:
WithoutPants
2020-10-13 10:12:46 +11:00
committed by GitHub
parent df3252e24f
commit aca2c7c5f4
147 changed files with 12483 additions and 946 deletions

View File

@@ -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)
}