diff --git a/internal/manager/manager_tasks.go b/internal/manager/manager_tasks.go index 1453ad74f..3572bf6f0 100644 --- a/internal/manager/manager_tasks.go +++ b/internal/manager/manager_tasks.go @@ -63,7 +63,7 @@ func (s *Manager) ScanSubscribe(ctx context.Context) <-chan bool { type ScanMetadataInput struct { Paths []string `json:"paths"` - config.ScanMetadataOptions + config.ScanMetadataOptions `mapstructure:",squash"` // Filter options for the scan Filter *ScanMetaDataFilterInput `json:"filter"` diff --git a/pkg/sqlite/scene.go b/pkg/sqlite/scene.go index e11eb0f0e..5e5d8dca1 100644 --- a/pkg/sqlite/scene.go +++ b/pkg/sqlite/scene.go @@ -642,7 +642,18 @@ func (qb *SceneStore) Size(ctx context.Context) (float64, error) { } func (qb *SceneStore) Duration(ctx context.Context) (float64, error) { - q := dialect.Select(goqu.SUM(qb.queryTable().Col("duration"))).From(qb.queryTable()) + table := qb.table() + videoFileTable := videoFileTableMgr.table + + q := dialect.Select( + goqu.SUM(videoFileTable.Col("duration"))).From(table).InnerJoin( + scenesFilesJoinTable, + goqu.On(scenesFilesJoinTable.Col("scene_id").Eq(table.Col(idColumn))), + ).InnerJoin( + videoFileTable, + goqu.On(videoFileTable.Col("file_id").Eq(scenesFilesJoinTable.Col("file_id"))), + ) + var ret float64 if err := querySimple(ctx, q, &ret); err != nil { return 0, err