jsonschema

package
v0.24.2 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2024 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

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 SaveImageFile

func SaveImageFile(filePath string, image *Image) error

func SaveMovieFile

func SaveMovieFile(filePath string, movie *Movie) error

func SavePerformerFile

func SavePerformerFile(filePath string, performer *Performer) 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"`

	// 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 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"`
}

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 Movie

type Movie 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"`
	URL        string        `json:"url,omitempty"`
	Studio     string        `json:"studio,omitempty"`
	CreatedAt  json.JSONTime `json:"created_at,omitempty"`
	UpdatedAt  json.JSONTime `json:"updated_at,omitempty"`
}

func LoadMovieFile

func LoadMovieFile(filePath string) (*Movie, error)

func (Movie) Filename added in v0.17.0

func (s Movie) Filename() string

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"`
	URL            string `json:"url,omitempty"`
	Twitter        string `json:"twitter,omitempty"`
	Instagram      string `json:"instagram,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"`
	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"`
}

func LoadPerformerFile

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

func (Performer) Filename added in v0.17.0

func (s Performer) 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"`
	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"`
	Movies       []SceneMovie     `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"`
	LastPlayedAt json.JSONTime    `json:"last_played_at,omitempty"`
	ResumeTime   float64          `json:"resume_time,omitempty"`
	PlayCount    int              `json:"play_count,omitempty"`
	PlayDuration float64          `json:"play_duration,omitempty"`
	StashIDs     []models.StashID `json:"stash_ids,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 SceneMarker

type SceneMarker struct {
	Title      string        `json:"title,omitempty"`
	Seconds    string        `json:"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 SceneMovie

type SceneMovie struct {
	MovieName  string `json:"movieName,omitempty"`
	SceneIndex int    `json:"scene_index,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"`
	URL           string           `json:"url,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"`
	Details       string           `json:"details,omitempty"`
	Aliases       []string         `json:"aliases,omitempty"`
	StashIDs      []models.StashID `json:"stash_ids,omitempty"`
	IgnoreAutoTag bool             `json:"ignore_auto_tag,omitempty"`
}

func LoadStudioFile

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

func (Studio) Filename added in v0.17.0

func (s Studio) Filename() string

type Tag

type Tag struct {
	Name          string        `json:"name,omitempty"`
	Description   string        `json:"description,omitempty"`
	Aliases       []string      `json:"aliases,omitempty"`
	Image         string        `json:"image,omitempty"`
	Parents       []string      `json:"parents,omitempty"`
	IgnoreAutoTag bool          `json:"ignore_auto_tag,omitempty"`
	CreatedAt     json.JSONTime `json:"created_at,omitempty"`
	UpdatedAt     json.JSONTime `json:"updated_at,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