stash/pkg/models/paths/paths_scenes.go

60 lines
1.5 KiB
Go
Raw Normal View History

2019-02-09 12:30:49 +00:00
package paths
import (
"path/filepath"
"github.com/stashapp/stash/pkg/fsutil"
2019-02-09 12:30:49 +00:00
)
type scenePaths struct {
generatedPaths
2019-02-09 12:30:49 +00:00
}
func newScenePaths(p Paths) *scenePaths {
sp := scenePaths{
generatedPaths: *p.Generated,
}
2019-02-09 12:30:49 +00:00
return &sp
}
func (sp *scenePaths) GetScreenshotPath(checksum string) string {
return filepath.Join(sp.Screenshots, checksum+".jpg")
2019-02-09 12:30:49 +00:00
}
func (sp *scenePaths) GetThumbnailScreenshotPath(checksum string) string {
return filepath.Join(sp.Screenshots, checksum+".thumb.jpg")
2019-02-09 12:30:49 +00:00
}
func (sp *scenePaths) GetTranscodePath(checksum string) string {
return filepath.Join(sp.Transcodes, checksum+".mp4")
2019-02-09 12:30:49 +00:00
}
func (sp *scenePaths) GetStreamPath(scenePath string, checksum string) string {
transcodePath := sp.GetTranscodePath(checksum)
transcodeExists, _ := fsutil.FileExists(transcodePath)
2019-02-09 12:30:49 +00:00
if transcodeExists {
return transcodePath
}
return scenePath
2019-02-09 12:30:49 +00:00
}
func (sp *scenePaths) GetVideoPreviewPath(checksum string) string {
return filepath.Join(sp.Screenshots, checksum+".mp4")
2019-02-09 12:30:49 +00:00
}
func (sp *scenePaths) GetWebpPreviewPath(checksum string) string {
return filepath.Join(sp.Screenshots, checksum+".webp")
2019-02-09 12:30:49 +00:00
}
func (sp *scenePaths) GetSpriteImageFilePath(checksum string) string {
return filepath.Join(sp.Vtt, checksum+"_sprite.jpg")
2019-02-09 12:30:49 +00:00
}
func (sp *scenePaths) GetSpriteVttFilePath(checksum string) string {
return filepath.Join(sp.Vtt, checksum+"_thumbs.vtt")
}
func (sp *scenePaths) GetInteractiveHeatmapPath(checksum string) string {
return filepath.Join(sp.InteractiveHeatmap, checksum+".png")
}