Merge pull request #103 from WithoutPants/metadata_from_file

Set title, details and date from scene file metadata
This commit is contained in:
StashAppDev
2019-08-19 16:29:25 -07:00
committed by GitHub
4 changed files with 26 additions and 6 deletions

View File

@@ -3,15 +3,16 @@ package manager
import (
"context"
"database/sql"
"path/filepath"
"strconv"
"sync"
"time"
"github.com/stashapp/stash/pkg/database"
"github.com/stashapp/stash/pkg/ffmpeg"
"github.com/stashapp/stash/pkg/logger"
"github.com/stashapp/stash/pkg/models"
"github.com/stashapp/stash/pkg/utils"
"path/filepath"
"strconv"
"sync"
"time"
)
type ScanTask struct {
@@ -115,6 +116,9 @@ func (t *ScanTask) scanScene() {
newScene := models.Scene{
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},