mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 20:34:37 +03:00
Make scene metadata from file metadata optional (#259)
This commit is contained in:
@@ -16,8 +16,8 @@ import (
|
||||
)
|
||||
|
||||
type ScanTask struct {
|
||||
FilePath string
|
||||
NameFromMetadata bool
|
||||
FilePath string
|
||||
UseFileMetadata bool
|
||||
}
|
||||
|
||||
func (t *ScanTask) Start(wg *sync.WaitGroup) {
|
||||
@@ -92,8 +92,8 @@ func (t *ScanTask) scanScene() {
|
||||
return
|
||||
}
|
||||
|
||||
// Override title to be filename if nameFromMetadata is false
|
||||
if !t.NameFromMetadata {
|
||||
// Override title to be filename if UseFileMetadata is false
|
||||
if !t.UseFileMetadata {
|
||||
videoFile.SetTitleFromPath()
|
||||
}
|
||||
|
||||
@@ -127,8 +127,6 @@ func (t *ScanTask) scanScene() {
|
||||
Checksum: checksum,
|
||||
Path: t.FilePath,
|
||||
Title: sql.NullString{String: videoFile.Title, Valid: true},
|
||||
Details: sql.NullString{String: videoFile.Comment, Valid: true},
|
||||
Date: models.SQLiteDate{String: videoFile.CreationTime.Format("2006-01-02")},
|
||||
Duration: sql.NullFloat64{Float64: videoFile.Duration, Valid: true},
|
||||
VideoCodec: sql.NullString{String: videoFile.VideoCodec, Valid: true},
|
||||
AudioCodec: sql.NullString{String: videoFile.AudioCodec, Valid: true},
|
||||
@@ -140,6 +138,11 @@ func (t *ScanTask) scanScene() {
|
||||
CreatedAt: models.SQLiteTimestamp{Timestamp: currentTime},
|
||||
UpdatedAt: models.SQLiteTimestamp{Timestamp: currentTime},
|
||||
}
|
||||
|
||||
if t.UseFileMetadata {
|
||||
newScene.Details = sql.NullString{String: videoFile.Comment, Valid: true}
|
||||
newScene.Date = models.SQLiteDate{String: videoFile.CreationTime.Format("2006-01-02")}
|
||||
}
|
||||
_, err = qb.Create(newScene, tx)
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user