Strip file extension from scene title when scanning (#1022)

This commit is contained in:
bnkai
2021-01-07 02:38:30 +02:00
committed by GitHub
parent 4fc0d47087
commit 1882b44951
13 changed files with 39 additions and 22 deletions

View File

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