mirror of
https://github.com/stashapp/stash.git
synced 2025-12-17 04:14:39 +03:00
Model refactor (#3915)
* Add mockery config file * Move basic file/folder structs to models * Fix hack due to import loop * Move file interfaces to models * Move folder interfaces to models * Move scene interfaces to models * Move scene marker interfaces to models * Move image interfaces to models * Move gallery interfaces to models * Move gallery chapter interfaces to models * Move studio interfaces to models * Move movie interfaces to models * Move performer interfaces to models * Move tag interfaces to models * Move autotag interfaces to models * Regenerate mocks
This commit is contained in:
@@ -6,8 +6,6 @@ import (
|
||||
"path/filepath"
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
"github.com/stashapp/stash/pkg/file"
|
||||
)
|
||||
|
||||
// Scene stores the metadata for a single video scene.
|
||||
@@ -26,7 +24,7 @@ type Scene struct {
|
||||
|
||||
// transient - not persisted
|
||||
Files RelatedVideoFiles
|
||||
PrimaryFileID *file.ID
|
||||
PrimaryFileID *FileID
|
||||
// transient - path of primary file - empty if no files
|
||||
Path string
|
||||
// transient - oshash of primary file - empty if no files
|
||||
@@ -57,13 +55,13 @@ func (s *Scene) LoadURLs(ctx context.Context, l URLLoader) error {
|
||||
}
|
||||
|
||||
func (s *Scene) LoadFiles(ctx context.Context, l VideoFileLoader) error {
|
||||
return s.Files.load(func() ([]*file.VideoFile, error) {
|
||||
return s.Files.load(func() ([]*VideoFile, error) {
|
||||
return l.GetFiles(ctx, s.ID)
|
||||
})
|
||||
}
|
||||
|
||||
func (s *Scene) LoadPrimaryFile(ctx context.Context, l file.Finder) error {
|
||||
return s.Files.loadPrimary(func() (*file.VideoFile, error) {
|
||||
func (s *Scene) LoadPrimaryFile(ctx context.Context, l FileGetter) error {
|
||||
return s.Files.loadPrimary(func() (*VideoFile, error) {
|
||||
if s.PrimaryFileID == nil {
|
||||
return nil, nil
|
||||
}
|
||||
@@ -73,10 +71,10 @@ func (s *Scene) LoadPrimaryFile(ctx context.Context, l file.Finder) error {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var vf *file.VideoFile
|
||||
var vf *VideoFile
|
||||
if len(f) > 0 {
|
||||
var ok bool
|
||||
vf, ok = f[0].(*file.VideoFile)
|
||||
vf, ok = f[0].(*VideoFile)
|
||||
if !ok {
|
||||
return nil, errors.New("not a video file")
|
||||
}
|
||||
@@ -173,7 +171,7 @@ type ScenePartial struct {
|
||||
PerformerIDs *UpdateIDs
|
||||
MovieIDs *UpdateMovieIDs
|
||||
StashIDs *UpdateStashIDs
|
||||
PrimaryFileID *file.ID
|
||||
PrimaryFileID *FileID
|
||||
}
|
||||
|
||||
func NewScenePartial() ScenePartial {
|
||||
|
||||
Reference in New Issue
Block a user