Help us shape the future of Go! Take the 2026 Go Developer Survey

jsonschema

package
v0.31.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 13, 2026 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Overview

Package jsonschema provides the JSON schema models used for importing and exporting data.

Index

Constants

View Source
const (
	DirEntryTypeFolder = "folder"
	DirEntryTypeVideo  = "video"
	DirEntryTypeImage  = "image"
	DirEntryTypeFile   = "file"
)

Variables

This section is empty.

Functions

func CompareJSON

func CompareJSON(a interface{}, b interface{}) bool

func SaveFileFile added in v0.17.0

func SaveFileFile(filePath string, file DirEntry) error

func SaveFolderFile added in v0.17.0

func SaveFolderFile(filePath string, folder *Folder) error

func SaveGalleryFile

func SaveGalleryFile(filePath string, gallery *Gallery) error

func SaveGroupFile added in v0.27.0

func SaveGroupFile(filePath string, movie *Group) error

func SaveImageFile

func SaveImageFile(filePath string, image *Image) error

func SavePerformerFile

func SavePerformerFile(filePath string, performer *Performer) error

func SaveSavedFilterFile added in v0.28.0

func SaveSavedFilterFile(filePath string, image *SavedFilter) error

func SaveSceneFile

func SaveSceneFile(filePath string, scene *Scene) error

func SaveStudioFile

func SaveStudioFile(filePath string, studio *Studio) error

func SaveTagFile

func SaveTagFile(filePath string, tag *Tag) error

Types

type BaseDirEntry added in v0.17.0

type BaseDirEntry struct {
	ZipFile string        `json:"zip_file,omitempty"`
	ModTime json.JSONTime `json:"mod_time"`

	Type string `json:"type,omitempty"`

	Path string `json:"path,omitempty"`

	CreatedAt json.JSONTime `json:"created_at,omitempty"`
	UpdatedAt json.JSONTime `json:"updated_at,omitempty"`
}

func (*BaseDirEntry) DirEntry added in v0.17.0

func (f *BaseDirEntry) DirEntry() *BaseDirEntry

func (*BaseDirEntry) Filename added in v0.17.0

func (f *BaseDirEntry) Filename() string

func (*BaseDirEntry) IsFile added in v0.17.0

func (f *BaseDirEntry) IsFile() bool

type BaseFile added in v0.17.0

type BaseFile struct {
	BaseDirEntry

	Fingerprints []Fingerprint `json:"fingerprints,omitempty"`
	Size         int64         `json:"size"`
}

func (*BaseFile) IsFile added in v0.17.0

func (f *BaseFile) IsFile() bool

type DirEntry added in v0.17.0

type DirEntry interface {
	IsFile() bool
	Filename() string
	DirEntry() *BaseDirEntry
}

func LoadFileFile added in v0.17.0

func LoadFileFile(filePath string) (DirEntry, error)

type Fingerprint added in v0.17.0

type Fingerprint struct {
	Type        string      `json:"type,omitempty"`
	Fingerprint interface{} `json:"fingerprint,omitempty"`
}

type Folder added in v0.17.0

type Folder struct {
	BaseDirEntry

	Path string `json:"path,omitempty"`

	CreatedAt json.JSONTime `json:"created_at,omitempty"`
	UpdatedAt json.JSONTime `json:"updated_at,omitempty"`
}

func LoadFolderFile added in v0.17.0

func LoadFolderFile(filePath string) (*Folder, error)

func (*Folder) Filename added in v0.17.0

func (f *Folder) Filename() string
type Gallery struct {
	ZipFiles     []string               `json:"zip_files,omitempty"`
	FolderPath   string                 `json:"folder_path,omitempty"`
	Title        string                 `json:"title,omitempty"`
	Code         string                 `json:"code,omitempty"`
	URLs         []string               `json:"urls,omitempty"`
	Date         string                 `json:"date,omitempty"`
	Details      string                 `json:"details,omitempty"`
	Photographer string                 `json:"photographer,omitempty"`
	Rating       int                    `json:"rating,omitempty"`
	Organized    bool                   `json:"organized,omitempty"`
	Chapters     []GalleryChapter       `json:"chapters,omitempty"`
	Studio       string                 `json:"studio,omitempty"`
	Performers   []string               `json:"performers,omitempty"`
	Tags         []string               `json:"tags,omitempty"`
	CreatedAt    json.JSONTime          `json:"created_at,omitempty"`
	UpdatedAt    json.JSONTime          `json:"updated_at,omitempty"`
	CustomFields map[string]interface{} `json:"custom_fields,omitempty"`

	// deprecated - for import only
	URL string `json:"url,omitempty"`
}

func LoadGalleryFile

func LoadGalleryFile(filePath string) (*Gallery, error)

func (Gallery) Filename added in v0.17.0

func (s Gallery) Filename(basename string, hash string) string

type GalleryChapter added in v0.20.0

type GalleryChapter struct {
	Title      string        `json:"title,omitempty"`
	ImageIndex int           `json:"image_index,omitempty"`
	CreatedAt  json.JSONTime `json:"created_at,omitempty"`
	UpdatedAt  json.JSONTime `json:"updated_at,omitempty"`
}

type GalleryRef added in v0.17.0

type GalleryRef struct {
	ZipFiles   []string `json:"zip_files,omitempty"`
	FolderPath string   `json:"folder_path,omitempty"`
	// Title is used only if FolderPath and ZipPaths is empty
	Title string `json:"title,omitempty"`
}

GalleryRef is used to identify a Gallery. Only one field should be populated.

func (GalleryRef) String added in v0.17.0

func (r GalleryRef) String() string

type Group added in v0.27.0

type Group struct {
	Name       string                `json:"name,omitempty"`
	Aliases    string                `json:"aliases,omitempty"`
	Duration   int                   `json:"duration,omitempty"`
	Date       string                `json:"date,omitempty"`
	Rating     int                   `json:"rating,omitempty"`
	Director   string                `json:"director,omitempty"`
	Synopsis   string                `json:"synopsis,omitempty"`
	FrontImage string                `json:"front_image,omitempty"`
	BackImage  string                `json:"back_image,omitempty"`
	URLs       []string              `json:"urls,omitempty"`
	Studio     string                `json:"studio,omitempty"`
	Tags       []string              `json:"tags,omitempty"`
	SubGroups  []SubGroupDescription `json:"sub_groups,omitempty"`
	CreatedAt  json.JSONTime         `json:"created_at,omitempty"`
	UpdatedAt  json.JSONTime         `json:"updated_at,omitempty"`

	CustomFields map[string]interface{} `json:"custom_fields,omitempty"`

	// deprecated - for import only
	URL string `json:"url,omitempty"`
}

func LoadGroupFile added in v0.27.0

func LoadGroupFile(filePath string) (*Group, error)

func (Group) Filename added in v0.27.0

func (s Group) Filename() string

type Image

type Image struct {
	Title  string `json:"title,omitempty"`
	Code   string `json:"code,omitempty"`
	Studio string `json:"studio,omitempty"`
	Rating int    `json:"rating,omitempty"`

	// deprecated - for import only
	URL string `json:"url,omitempty"`

	URLs         []string               `json:"urls,omitempty"`
	Date         string                 `json:"date,omitempty"`
	Details      string                 `json:"details,omitempty"`
	Photographer string                 `json:"photographer,omitempty"`
	Organized    bool                   `json:"organized,omitempty"`
	OCounter     int                    `json:"o_counter,omitempty"`
	Galleries    []GalleryRef           `json:"galleries,omitempty"`
	Performers   []string               `json:"performers,omitempty"`
	Tags         []string               `json:"tags,omitempty"`
	Files        []string               `json:"files,omitempty"`
	CreatedAt    json.JSONTime          `json:"created_at,omitempty"`
	UpdatedAt    json.JSONTime          `json:"updated_at,omitempty"`
	CustomFields map[string]interface{} `json:"custom_fields,omitempty"`
}

func LoadImageFile

func LoadImageFile(filePath string) (*Image, error)

func (Image) Filename added in v0.17.0

func (s Image) Filename(basename string, hash string) string

type ImageFile

type ImageFile struct {
	*BaseFile
	Format string `json:"format,omitempty"`
	Width  int    `json:"width,omitempty"`
	Height int    `json:"height,omitempty"`
}

type MovieSynopsisBC added in v0.16.0

type MovieSynopsisBC struct {
	Synopsis string `json:"sypnopsis,omitempty"`
}

Backwards Compatible synopsis for the movie

type Performer

type Performer struct {
	Name           string   `json:"name,omitempty"`
	Disambiguation string   `json:"disambiguation,omitempty"`
	Gender         string   `json:"gender,omitempty"`
	URLs           []string `json:"urls,omitempty"`
	Birthdate      string   `json:"birthdate,omitempty"`
	Ethnicity      string   `json:"ethnicity,omitempty"`
	Country        string   `json:"country,omitempty"`
	EyeColor       string   `json:"eye_color,omitempty"`
	// this should be int, but keeping string for backwards compatibility
	Height        string             `json:"height,omitempty"`
	Measurements  string             `json:"measurements,omitempty"`
	FakeTits      string             `json:"fake_tits,omitempty"`
	PenisLength   float64            `json:"penis_length,omitempty"`
	Circumcised   string             `json:"circumcised,omitempty"`
	CareerLength  string             `json:"career_length,omitempty"` // deprecated - for import only
	CareerStart   string             `json:"career_start,omitempty"`
	CareerEnd     string             `json:"career_end,omitempty"`
	Tattoos       string             `json:"tattoos,omitempty"`
	Piercings     string             `json:"piercings,omitempty"`
	Aliases       StringOrStringList `json:"aliases,omitempty"`
	Favorite      bool               `json:"favorite,omitempty"`
	Tags          []string           `json:"tags,omitempty"`
	Image         string             `json:"image,omitempty"`
	CreatedAt     json.JSONTime      `json:"created_at,omitempty"`
	UpdatedAt     json.JSONTime      `json:"updated_at,omitempty"`
	Rating        int                `json:"rating,omitempty"`
	Details       string             `json:"details,omitempty"`
	DeathDate     string             `json:"death_date,omitempty"`
	HairColor     string             `json:"hair_color,omitempty"`
	Weight        int                `json:"weight,omitempty"`
	StashIDs      []models.StashID   `json:"stash_ids,omitempty"`
	IgnoreAutoTag bool               `json:"ignore_auto_tag,omitempty"`

	CustomFields map[string]interface{} `json:"custom_fields,omitempty"`

	// deprecated - for import only
	URL       string `json:"url,omitempty"`
	Twitter   string `json:"twitter,omitempty"`
	Instagram string `json:"instagram,omitempty"`
}

func LoadPerformerFile

func LoadPerformerFile(filePath string) (*Performer, error)

func (Performer) Filename added in v0.17.0

func (s Performer) Filename() string

type SavedFilter added in v0.28.0

type SavedFilter struct {
	Mode         models.FilterMode      `db:"mode" json:"mode"`
	Name         string                 `db:"name" json:"name"`
	FindFilter   *models.FindFilterType `json:"find_filter"`
	ObjectFilter map[string]interface{} `json:"object_filter"`
	UIOptions    map[string]interface{} `json:"ui_options"`
}

func LoadSavedFilterFile added in v0.28.0

func LoadSavedFilterFile(filePath string) (*SavedFilter, error)

func (SavedFilter) Filename added in v0.28.0

func (s SavedFilter) Filename() string

type Scene

type Scene struct {
	Title  string `json:"title,omitempty"`
	Code   string `json:"code,omitempty"`
	Studio string `json:"studio,omitempty"`

	// deprecated - for import only
	URL string `json:"url,omitempty"`

	URLs      []string `json:"urls,omitempty"`
	Date      string   `json:"date,omitempty"`
	Rating    int      `json:"rating,omitempty"`
	Organized bool     `json:"organized,omitempty"`

	// deprecated - for import only
	OCounter int `json:"o_counter,omitempty"`

	Details    string        `json:"details,omitempty"`
	Director   string        `json:"director,omitempty"`
	Galleries  []GalleryRef  `json:"galleries,omitempty"`
	Performers []string      `json:"performers,omitempty"`
	Groups     []SceneGroup  `json:"movies,omitempty"`
	Tags       []string      `json:"tags,omitempty"`
	Markers    []SceneMarker `json:"markers,omitempty"`
	Files      []string      `json:"files,omitempty"`
	Cover      string        `json:"cover,omitempty"`
	CreatedAt  json.JSONTime `json:"created_at,omitempty"`
	UpdatedAt  json.JSONTime `json:"updated_at,omitempty"`

	// deprecated - for import only
	LastPlayedAt json.JSONTime `json:"last_played_at,omitempty"`

	ResumeTime float64 `json:"resume_time,omitempty"`

	// deprecated - for import only
	PlayCount int `json:"play_count,omitempty"`

	PlayHistory []json.JSONTime `json:"play_history,omitempty"`
	OHistory    []json.JSONTime `json:"o_history,omitempty"`

	PlayDuration float64          `json:"play_duration,omitempty"`
	StashIDs     []models.StashID `json:"stash_ids,omitempty"`

	CustomFields map[string]interface{} `json:"custom_fields,omitempty"`
}

func LoadSceneFile

func LoadSceneFile(filePath string) (*Scene, error)

func (Scene) Filename added in v0.17.0

func (s Scene) Filename(id int, basename string, hash string) string

type SceneFile

type SceneFile struct {
	ModTime    json.JSONTime `json:"mod_time,omitempty"`
	Size       string        `json:"size"`
	Duration   string        `json:"duration"`
	VideoCodec string        `json:"video_codec"`
	AudioCodec string        `json:"audio_codec"`
	Format     string        `json:"format"`
	Width      int           `json:"width"`
	Height     int           `json:"height"`
	Framerate  string        `json:"framerate"`
	Bitrate    int           `json:"bitrate"`
}

type SceneGroup added in v0.27.0

type SceneGroup struct {
	GroupName  string `json:"movieName,omitempty"`
	SceneIndex int    `json:"scene_index,omitempty"`
}

type SceneMarker

type SceneMarker struct {
	Title      string        `json:"title,omitempty"`
	Seconds    string        `json:"seconds,omitempty"`
	EndSeconds string        `json:"end_seconds,omitempty"`
	PrimaryTag string        `json:"primary_tag,omitempty"`
	Tags       []string      `json:"tags,omitempty"`
	CreatedAt  json.JSONTime `json:"created_at,omitempty"`
	UpdatedAt  json.JSONTime `json:"updated_at,omitempty"`
}

type StringOrStringList added in v0.19.0

type StringOrStringList []string

func (*StringOrStringList) UnmarshalJSON added in v0.19.0

func (s *StringOrStringList) UnmarshalJSON(data []byte) error

type Studio

type Studio struct {
	Name          string           `json:"name,omitempty"`
	URLs          []string         `json:"urls,omitempty"`
	ParentStudio  string           `json:"parent_studio,omitempty"`
	Image         string           `json:"image,omitempty"`
	CreatedAt     json.JSONTime    `json:"created_at,omitempty"`
	UpdatedAt     json.JSONTime    `json:"updated_at,omitempty"`
	Rating        int              `json:"rating,omitempty"`
	Favorite      bool             `json:"favorite,omitempty"`
	Details       string           `json:"details,omitempty"`
	Aliases       []string         `json:"aliases,omitempty"`
	StashIDs      []models.StashID `json:"stash_ids,omitempty"`
	Tags          []string         `json:"tags,omitempty"`
	IgnoreAutoTag bool             `json:"ignore_auto_tag,omitempty"`
	Organized     bool             `json:"organized,omitempty"`

	CustomFields map[string]interface{} `json:"custom_fields,omitempty"`

	// deprecated - for import only
	URL string `json:"url,omitempty"`
}

func LoadStudioFile

func LoadStudioFile(filePath string) (*Studio, error)

func (Studio) Filename added in v0.17.0

func (s Studio) Filename() string

type SubGroupDescription added in v0.27.0

type SubGroupDescription struct {
	Group       string `json:"name,omitempty"`
	Description string `json:"description,omitempty"`
}

type Tag

type Tag struct {
	Name          string                 `json:"name,omitempty"`
	SortName      string                 `json:"sort_name,omitempty"`
	Description   string                 `json:"description,omitempty"`
	Favorite      bool                   `json:"favorite,omitempty"`
	Aliases       []string               `json:"aliases,omitempty"`
	Image         string                 `json:"image,omitempty"`
	Parents       []string               `json:"parents,omitempty"`
	IgnoreAutoTag bool                   `json:"ignore_auto_tag,omitempty"`
	StashIDs      []models.StashID       `json:"stash_ids,omitempty"`
	CreatedAt     json.JSONTime          `json:"created_at,omitempty"`
	UpdatedAt     json.JSONTime          `json:"updated_at,omitempty"`
	CustomFields  map[string]interface{} `json:"custom_fields,omitempty"`
}

func LoadTagFile

func LoadTagFile(filePath string) (*Tag, error)

func (Tag) Filename added in v0.17.0

func (s Tag) Filename() string

type VideoFile added in v0.17.0

type VideoFile struct {
	*BaseFile
	Format     string  `json:"format,omitempty"`
	Width      int     `json:"width,omitempty"`
	Height     int     `json:"height,omitempty"`
	Duration   float64 `json:"duration,omitempty"`
	VideoCodec string  `json:"video_codec,omitempty"`
	AudioCodec string  `json:"audio_codec,omitempty"`
	FrameRate  float64 `json:"frame_rate,omitempty"`
	BitRate    int64   `json:"bitrate,omitempty"`

	Interactive      bool `json:"interactive,omitempty"`
	InteractiveSpeed *int `json:"interactive_speed,omitempty"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL