mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 12:24:38 +03:00
@@ -81,7 +81,8 @@ func (t *ScanTask) scanScene() {
|
|||||||
qb := models.NewSceneQueryBuilder()
|
qb := models.NewSceneQueryBuilder()
|
||||||
scene, _ := qb.FindByPath(t.FilePath)
|
scene, _ := qb.FindByPath(t.FilePath)
|
||||||
if scene != nil {
|
if scene != nil {
|
||||||
// We already have this item in the database, keep going
|
// We already have this item in the database, check for thumbnails,screenshots
|
||||||
|
t.makeScreenshots(nil, scene.Checksum)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -102,7 +103,7 @@ func (t *ScanTask) scanScene() {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
t.makeScreenshots(*videoFile, checksum)
|
t.makeScreenshots(videoFile, checksum)
|
||||||
|
|
||||||
scene, _ = qb.FindByChecksum(checksum)
|
scene, _ = qb.FindByChecksum(checksum)
|
||||||
ctx := context.TODO()
|
ctx := context.TODO()
|
||||||
@@ -150,19 +151,38 @@ func (t *ScanTask) scanScene() {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *ScanTask) makeScreenshots(probeResult ffmpeg.VideoFile, checksum string) {
|
func (t *ScanTask) makeScreenshots(probeResult *ffmpeg.VideoFile, checksum string) {
|
||||||
thumbPath := instance.Paths.Scene.GetThumbnailScreenshotPath(checksum)
|
thumbPath := instance.Paths.Scene.GetThumbnailScreenshotPath(checksum)
|
||||||
normalPath := instance.Paths.Scene.GetScreenshotPath(checksum)
|
normalPath := instance.Paths.Scene.GetScreenshotPath(checksum)
|
||||||
|
|
||||||
thumbExists, _ := utils.FileExists(thumbPath)
|
thumbExists, _ := utils.FileExists(thumbPath)
|
||||||
normalExists, _ := utils.FileExists(normalPath)
|
normalExists, _ := utils.FileExists(normalPath)
|
||||||
|
|
||||||
if thumbExists && normalExists {
|
if thumbExists && normalExists {
|
||||||
logger.Debug("Screenshots already exist for this path... skipping")
|
logger.Debug("Screenshots already exist for this path... skipping")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
t.makeScreenshot(probeResult, thumbPath, 5, 320)
|
if probeResult == nil {
|
||||||
t.makeScreenshot(probeResult, normalPath, 2, probeResult.Width)
|
var err error
|
||||||
|
probeResult, err = ffmpeg.NewVideoFile(instance.FFProbePath, t.FilePath)
|
||||||
|
|
||||||
|
if err != nil {
|
||||||
|
logger.Error(err.Error())
|
||||||
|
return
|
||||||
|
}
|
||||||
|
logger.Infof("Regenerating images for %s", t.FilePath)
|
||||||
|
}
|
||||||
|
|
||||||
|
if !thumbExists {
|
||||||
|
logger.Debugf("Creating thumbnail for %s", t.FilePath)
|
||||||
|
t.makeScreenshot(*probeResult, thumbPath, 5, 320)
|
||||||
|
}
|
||||||
|
|
||||||
|
if !normalExists {
|
||||||
|
logger.Debugf("Creating screenshot for %s", t.FilePath)
|
||||||
|
t.makeScreenshot(*probeResult, normalPath, 2, probeResult.Width)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *ScanTask) makeScreenshot(probeResult ffmpeg.VideoFile, outputPath string, quality int, width int) {
|
func (t *ScanTask) makeScreenshot(probeResult ffmpeg.VideoFile, outputPath string, quality int, width int) {
|
||||||
|
|||||||
Reference in New Issue
Block a user