-
-
Notifications
You must be signed in to change notification settings - Fork 762
/
json_utils.go
44 lines (33 loc) · 1.41 KB
/
json_utils.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
package manager
import (
"path/filepath"
"github.com/stashapp/stash/pkg/models/jsonschema"
"github.com/stashapp/stash/pkg/models/paths"
)
type jsonUtils struct {
json paths.JSONPaths
}
func (jp *jsonUtils) savePerformer(fn string, performer *jsonschema.Performer) error {
return jsonschema.SavePerformerFile(filepath.Join(jp.json.Performers, fn), performer)
}
func (jp *jsonUtils) saveStudio(fn string, studio *jsonschema.Studio) error {
return jsonschema.SaveStudioFile(filepath.Join(jp.json.Studios, fn), studio)
}
func (jp *jsonUtils) saveTag(fn string, tag *jsonschema.Tag) error {
return jsonschema.SaveTagFile(filepath.Join(jp.json.Tags, fn), tag)
}
func (jp *jsonUtils) saveMovie(fn string, movie *jsonschema.Movie) error {
return jsonschema.SaveMovieFile(filepath.Join(jp.json.Movies, fn), movie)
}
func (jp *jsonUtils) saveScene(fn string, scene *jsonschema.Scene) error {
return jsonschema.SaveSceneFile(filepath.Join(jp.json.Scenes, fn), scene)
}
func (jp *jsonUtils) saveImage(fn string, image *jsonschema.Image) error {
return jsonschema.SaveImageFile(filepath.Join(jp.json.Images, fn), image)
}
func (jp *jsonUtils) saveGallery(fn string, gallery *jsonschema.Gallery) error {
return jsonschema.SaveGalleryFile(filepath.Join(jp.json.Galleries, fn), gallery)
}
func (jp *jsonUtils) saveFile(fn string, file jsonschema.DirEntry) error {
return jsonschema.SaveFileFile(filepath.Join(jp.json.Files, fn), file)
}