Fixed incorrect file paths on windows

This commit is contained in:
Stash Dev
2019-02-10 09:33:18 -08:00
parent 8efbfc6d72
commit a5442a87a4
3 changed files with 9 additions and 7 deletions

View File

@@ -1,5 +1,7 @@
# Stash # Stash
[![Build Status](https://travis-ci.org/stashapp/stash.svg?branch=master)](https://travis-ci.org/stashapp/stash)
**Stash is a rails app which organizes and serves your porn.** **Stash is a rails app which organizes and serves your porn.**
See a demo [here](https://vimeo.com/275537038) (password is stashapp). See a demo [here](https://vimeo.com/275537038) (password is stashapp).

View File

@@ -7,7 +7,7 @@ import (
"github.com/stashapp/stash/logger" "github.com/stashapp/stash/logger"
"github.com/stashapp/stash/utils" "github.com/stashapp/stash/utils"
"os" "os"
"path" "path/filepath"
) )
type PreviewGenerator struct { type PreviewGenerator struct {
@@ -74,7 +74,7 @@ func (g *PreviewGenerator) generateConcatFile() error {
} }
func (g *PreviewGenerator) generateVideo(encoder *ffmpeg.Encoder) error { func (g *PreviewGenerator) generateVideo(encoder *ffmpeg.Encoder) error {
outputPath := path.Join(g.OutputDirectory, g.VideoFilename) outputPath := filepath.Join(g.OutputDirectory, g.VideoFilename)
outputExists, _ := utils.FileExists(outputPath) outputExists, _ := utils.FileExists(outputPath)
if outputExists { if outputExists {
return nil return nil
@@ -95,20 +95,20 @@ func (g *PreviewGenerator) generateVideo(encoder *ffmpeg.Encoder) error {
encoder.ScenePreviewVideoChunk(g.Info.VideoFile, options) encoder.ScenePreviewVideoChunk(g.Info.VideoFile, options)
} }
videoOutputPath := path.Join(g.OutputDirectory, g.VideoFilename) videoOutputPath := filepath.Join(g.OutputDirectory, g.VideoFilename)
encoder.ScenePreviewVideoChunkCombine(g.Info.VideoFile, g.getConcatFilePath(), videoOutputPath) encoder.ScenePreviewVideoChunkCombine(g.Info.VideoFile, g.getConcatFilePath(), videoOutputPath)
logger.Debug("created video preview: ", videoOutputPath) logger.Debug("created video preview: ", videoOutputPath)
return nil return nil
} }
func (g *PreviewGenerator) generateImage(encoder *ffmpeg.Encoder) error { func (g *PreviewGenerator) generateImage(encoder *ffmpeg.Encoder) error {
outputPath := path.Join(g.OutputDirectory, g.ImageFilename) outputPath := filepath.Join(g.OutputDirectory, g.ImageFilename)
outputExists, _ := utils.FileExists(outputPath) outputExists, _ := utils.FileExists(outputPath)
if outputExists { if outputExists {
return nil return nil
} }
videoPreviewPath := path.Join(g.OutputDirectory, g.VideoFilename) videoPreviewPath := filepath.Join(g.OutputDirectory, g.VideoFilename)
tmpOutputPath := instance.Paths.Generated.GetTmpPath(g.ImageFilename) tmpOutputPath := instance.Paths.Generated.GetTmpPath(g.ImageFilename)
if err := encoder.ScenePreviewVideoToImage(g.Info.VideoFile, 640, videoPreviewPath, tmpOutputPath); err != nil { if err := encoder.ScenePreviewVideoToImage(g.Info.VideoFile, 640, videoPreviewPath, tmpOutputPath); err != nil {
return err return err

View File

@@ -6,7 +6,7 @@ import (
"github.com/stashapp/stash/models" "github.com/stashapp/stash/models"
"github.com/stashapp/stash/utils" "github.com/stashapp/stash/utils"
"os" "os"
"path" "path/filepath"
"strconv" "strconv"
"sync" "sync"
) )
@@ -32,7 +32,7 @@ func (t *GenerateMarkersTask) Start(wg *sync.WaitGroup) {
} }
// Make the folder for the scenes markers // Make the folder for the scenes markers
markersFolder := path.Join(instance.Paths.Generated.Markers, t.Scene.Checksum) markersFolder := filepath.Join(instance.Paths.Generated.Markers, t.Scene.Checksum)
_ = utils.EnsureDir(markersFolder) _ = utils.EnsureDir(markersFolder)
encoder := ffmpeg.NewEncoder(instance.Paths.FixedPaths.FFMPEG) encoder := ffmpeg.NewEncoder(instance.Paths.FixedPaths.FFMPEG)