mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 20:34:37 +03:00
Strip file extension from scene title when scanning (#1022)
This commit is contained in:
@@ -26,6 +26,7 @@ import (
|
||||
type ScanTask struct {
|
||||
FilePath string
|
||||
UseFileMetadata bool
|
||||
StripFileExtension bool
|
||||
calculateMD5 bool
|
||||
fileNamingAlgorithm models.HashAlgorithm
|
||||
GenerateSprite bool
|
||||
@@ -374,7 +375,7 @@ func (t *ScanTask) scanScene() *models.Scene {
|
||||
|
||||
// check for container
|
||||
if !scene.Format.Valid {
|
||||
videoFile, err := ffmpeg.NewVideoFile(instance.FFProbePath, t.FilePath)
|
||||
videoFile, err := ffmpeg.NewVideoFile(instance.FFProbePath, t.FilePath, t.StripFileExtension)
|
||||
if err != nil {
|
||||
logger.Error(err.Error())
|
||||
return nil
|
||||
@@ -455,7 +456,7 @@ func (t *ScanTask) scanScene() *models.Scene {
|
||||
return nil
|
||||
}
|
||||
|
||||
videoFile, err := ffmpeg.NewVideoFile(instance.FFProbePath, t.FilePath)
|
||||
videoFile, err := ffmpeg.NewVideoFile(instance.FFProbePath, t.FilePath, t.StripFileExtension)
|
||||
if err != nil {
|
||||
logger.Error(err.Error())
|
||||
return nil
|
||||
@@ -464,7 +465,7 @@ func (t *ScanTask) scanScene() *models.Scene {
|
||||
|
||||
// Override title to be filename if UseFileMetadata is false
|
||||
if !t.UseFileMetadata {
|
||||
videoFile.SetTitleFromPath()
|
||||
videoFile.SetTitleFromPath(t.StripFileExtension)
|
||||
}
|
||||
|
||||
var checksum string
|
||||
@@ -588,7 +589,7 @@ func (t *ScanTask) rescanScene(scene *models.Scene, fileModTime time.Time) (*mod
|
||||
}
|
||||
|
||||
// regenerate the file details as well
|
||||
videoFile, err := ffmpeg.NewVideoFile(instance.FFProbePath, t.FilePath)
|
||||
videoFile, err := ffmpeg.NewVideoFile(instance.FFProbePath, t.FilePath, t.StripFileExtension)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@@ -648,7 +649,7 @@ func (t *ScanTask) makeScreenshots(probeResult *ffmpeg.VideoFile, checksum strin
|
||||
|
||||
if probeResult == nil {
|
||||
var err error
|
||||
probeResult, err = ffmpeg.NewVideoFile(instance.FFProbePath, t.FilePath)
|
||||
probeResult, err = ffmpeg.NewVideoFile(instance.FFProbePath, t.FilePath, t.StripFileExtension)
|
||||
|
||||
if err != nil {
|
||||
logger.Error(err.Error())
|
||||
|
||||
Reference in New Issue
Block a user