models

package
v0.0.0-...-77c78fe Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2020 License: GPL-2.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type API

type API struct {
	Tmdb   Tmdb   `json:"tmdb"`
	Fanart Fanart `json:"fanart"`
}

API describes the api parameters

type Actor

type Actor struct {
	gorm.Model `json:"-"`
	UID        int    `json:"uid"`
	Name       string `json:"name"`
	ProfileImg string `json:"profile_img"`
}

type Cleaner

type Cleaner struct {
	Interval     int  `json:"interval"`
	MaxAge       int  `json:"max_age"`
	CleanOnStart bool `json:"clean_on_start"`
}

Cleaner describes cleaner-specific parameters

type Config

type Config struct {
	Domain     string     `json:"domain"`
	WebRoot    string     `json:"web_root"`
	BaseURL    string     `json:"base_url"`
	ImageURL   string     `json:"image_url"`
	MediaURL   string     `json:"media_url"`
	UseSSL     bool       `json:"use_ssl"`
	LogPath    string     `json:"log_path"`
	General    General    `json:"general"`
	Store      Store      `json:"store"`
	Sources    []Source   `json:"sources"`
	API        API        `json:"api"`
	Server     Server     `json:"server"`
	Indexer    Indexer    `json:"indexer"`
	Transcoder Transcoder `json:"transcoder"`
	Cleaner    Cleaner    `json:"cleaner"`
}

Config represents the structure of the config.json file.

func (*Config) Extensions

func (c *Config) Extensions()

Extensions compiles regular expressions for file extensions

func (*Config) Init

func (c *Config) Init(path string)

Init reads the config.json file by the provided path and creates an Config instance.

func (*Config) SetUrls

func (c *Config) SetUrls()

SetUrls sets the base, image and media url based on HTTP(S) and the domain

type Episode

type Episode struct {
	gorm.Model
	SeasonID      uint         `json:"season_id"`
	UID           string       `json:"uid"`
	Hash          string       `json:"hash"`
	Name          string       `json:"name"`
	Overview      string       `json:"overview" gorm:"size:1000"`
	AirDate       string       `json:"air_date"`
	SourcePath    string       `json:"-"`
	StillPath     []Image      `json:"still_path"`
	EpisodeNumber int          `json:"episode_number"`
	MediaMetrics  MediaMetrics `json:"media_metrics"`
}

Episode contains data about season episodes

type Fanart

type Fanart struct {
	Key string `json:"key"`
}

Fanart describes the Tmdb portion of the api parameters

type General

type General struct {
	Name string `json:"name"`
}

General describes some general parameters

type Image

type Image struct {
	gorm.Model   `json:"-"`
	MediaID      uint   `json:"-"`
	SeasonID     uint   `json:"-"`
	EpisodeID    uint   `json:"-"`
	Downloaded   bool   `json:"-" gorm:"-"`
	Type         string `json:"type"`
	Sizes        string `json:"sizes"`
	Name         string `json:"name"`
	DownloadPath string `json:"-" gorm:"-"`
}

type Indexer

type Indexer struct {
	Interval    int  `json:"interval"`
	Concurrency int  `json:"concurrency"`
	Retries     int  `json:"retries"`
	Log         bool `json:"log"`
}

Indexer describes indexer-specific parameters

type LogoDetails

type LogoDetails struct {
	Name            string `json:"name"`
	TmdbID          string `json:"tmdb_id"`
	ImdbID          string `json:"imdb_id"`
	Hdmovieclearart []struct {
		ID    string `json:"id"`
		URL   string `json:"url"`
		Lang  string `json:"lang"`
		Likes string `json:"likes"`
	} `json:"hdmovieclearart"`
		ID    string `json:"id"`
		URL   string `json:"url"`
		Lang  string `json:"lang"`
		Likes string `json:"likes"`
	} `json:"hdmovielogo"`
	Movieposter []struct {
		ID    string `json:"id"`
		URL   string `json:"url"`
		Lang  string `json:"lang"`
		Likes string `json:"likes"`
	} `json:"movieposter"`
	Moviebackground []struct {
		ID    string `json:"id"`
		URL   string `json:"url"`
		Lang  string `json:"lang"`
		Likes string `json:"likes"`
	} `json:"moviebackground"`
	Moviedisc []struct {
		ID       string `json:"id"`
		URL      string `json:"url"`
		Lang     string `json:"lang"`
		Likes    string `json:"likes"`
		Disc     string `json:"disc"`
		DiscType string `json:"disc_type"`
	} `json:"moviedisc"`
	Moviethumb []struct {
		ID    string `json:"id"`
		URL   string `json:"url"`
		Lang  string `json:"lang"`
		Likes string `json:"likes"`
	} `json:"moviethumb"`
	Movieart []struct {
		ID    string `json:"id"`
		URL   string `json:"url"`
		Lang  string `json:"lang"`
		Likes string `json:"likes"`
	} `json:"movieart"`
	Moviebanner []struct {
		ID    string `json:"id"`
		URL   string `json:"url"`
		Lang  string `json:"lang"`
		Likes string `json:"likes"`
	} `json:"moviebanner"`
		ID    string `json:"id"`
		URL   string `json:"url"`
		Lang  string `json:"lang"`
		Likes string `json:"likes"`
	} `json:"movielogo"`
}

type Media

type Media struct {
	gorm.Model       `json:"-"`
	WatchingID       uint          `json:"-"`
	UID              int           `json:"uid"`
	Hash             string        `json:"hash"`
	ContentType      string        `json:"content_type"`
	Title            string        `json:"title"`
	Website          string        `json:"website"`
	Genre            string        `json:"genre" gorm:"size:1000"`
	Plot             string        `json:"plot" gorm:"size:1000"`
	Images           []*Image      `json:"images,omitempty"`
	MovieData        *MovieData    `json:"movie_data,omitempty" sql:"DEFAULT:NULL" gorm:"default:NULL"`
	ShowData         *ShowData     `json:"show_data,omitempty" sql:"DEFAULT:NULL" gorm:"default:NULL"`
	Categories       string        `json:"categories"`
	CurrentlyWatched int           `json:"currently_watched"`
	MediaMetrics     *MediaMetrics `json:"media_metrics,omitempty"`
	VideoFramerate   int           `json:"video_framerate"`
	VideoWidth       int           `json:"video_width"`
	VideoHeight      int           `json:"video_height"`
}

Media is the base media model

func (*Media) NotFound

func (m *Media) NotFound() bool

NotFound returns if the media object is not found

type MediaMetrics

type MediaMetrics struct {
	MediaID              uint      `json:"media_id"`
	EpisodeID            uint      `json:"episode_id"`
	TimesWatched         int       `json:"times_watched"`
	TimesPaused          int       `json:"times_paused"`
	TimesExited          int       `json:"times_canceled"`
	WatchedPercentage    float64   `json:"watched_percentage"`
	WatchedAtTimeAverage time.Time `json:"watched_at_time_average"`
	SkipBegin            string    `json:"skip_begin"`
	SkipEnd              string    `json:"skip_end"`
}

MediaMetrics contains data about media metrics

type MetricsMediaRequest

type MetricsMediaRequest struct {
	Metrics []struct {
		Type  string  `json:"type"`
		Time  int64   `json:"time"`
		Hash  string  `json:"hash"`
		Value float64 `json:"value"`
	} `json:"metrics"`
}

type MovieData

type MovieData struct {
	gorm.Model  `json:"-"`
	MediaID     uint   `json:"-"`
	Tagline     string `json:"tagline"`
	ReleaseYear string `json:"release_year"`
	Runtime     int    `json:"runtime"`
	PG          string `json:"pg"`
	SourcePath  string `json:"-"`
	// Actors      []Actor `json:"actors,omitempty" gorm:"many2many:relative_actors;"`
	Trailer     string  `json:"trailer"`
	VoteAverage float64 `json:"vote_average"`
}

MovieData contains movie-specific data

type MovieDetail

type MovieDetail struct {
	Adult               bool   `json:"adult"`
	BackdropPath        string `json:"backdrop_path"`
	BelongsToCollection struct {
		ID           int    `json:"id"`
		Name         string `json:"name"`
		PosterPath   string `json:"poster_path"`
		BackdropPath string `json:"backdrop_path"`
	} `json:"belongs_to_collection"`
	Budget int `json:"budget"`
	Genres []struct {
		ID   int    `json:"id"`
		Name string `json:"name"`
	} `json:"genres"`
	Homepage            string  `json:"homepage"`
	ID                  int     `json:"id"`
	ImdbID              string  `json:"imdb_id"`
	OriginalLanguage    string  `json:"original_language"`
	OriginalTitle       string  `json:"original_title"`
	Overview            string  `json:"overview"`
	Popularity          float64 `json:"popularity"`
	PosterPath          string  `json:"poster_path"`
	ProductionCompanies []struct {
		ID            int    `json:"id"`
		LogoPath      string `json:"logo_path"`
		Name          string `json:"name"`
		OriginCountry string `json:"origin_country"`
	} `json:"production_companies"`
	ProductionCountries []struct {
		Iso31661 string `json:"iso_3166_1"`
		Name     string `json:"name"`
	} `json:"production_countries"`
	ReleaseDate     string `json:"release_date"`
	Revenue         int    `json:"revenue"`
	Runtime         int    `json:"runtime"`
	SpokenLanguages []struct {
		Iso6391 string `json:"iso_639_1"`
		Name    string `json:"name"`
	} `json:"spoken_languages"`
	Status       string  `json:"status"`
	Tagline      string  `json:"tagline"`
	Title        string  `json:"title"`
	Video        bool    `json:"video"`
	VoteAverage  float64 `json:"vote_average"`
	VoteCount    int     `json:"vote_count"`
	ReleaseDates struct {
		Results []struct {
			Iso31661     string `json:"iso_3166_1"`
			ReleaseDates []struct {
				Certification string    `json:"certification"`
				Iso6391       string    `json:"iso_639_1"`
				Note          string    `json:"note"`
				ReleaseDate   time.Time `json:"release_date"`
				Type          int       `json:"type"`
			} `json:"release_dates"`
		} `json:"results"`
	} `json:"release_dates"`
	Credits struct {
		Cast []struct {
			CastID      int    `json:"cast_id"`
			Character   string `json:"character"`
			CreditID    string `json:"credit_id"`
			Gender      int    `json:"gender"`
			ID          int    `json:"id"`
			Name        string `json:"name"`
			Order       int    `json:"order"`
			ProfilePath string `json:"profile_path"`
		} `json:"cast"`
		Crew []struct {
			CreditID    string      `json:"credit_id"`
			Department  string      `json:"department"`
			Gender      int         `json:"gender"`
			ID          int         `json:"id"`
			Job         string      `json:"job"`
			Name        string      `json:"name"`
			ProfilePath interface{} `json:"profile_path"`
		} `json:"crew"`
	} `json:"credits"`
	Videos struct {
		Results []struct {
			ID       string `json:"id"`
			Iso6391  string `json:"iso_639_1"`
			Iso31661 string `json:"iso_3166_1"`
			Key      string `json:"key"`
			Name     string `json:"name"`
			Site     string `json:"site"`
			Size     int    `json:"size"`
			Type     string `json:"type"`
		} `json:"results"`
	} `json:"videos"`
}

func (*MovieDetail) GetActors

func (d *MovieDetail) GetActors() []Actor

func (*MovieDetail) GetGenres

func (d *MovieDetail) GetGenres() string

func (*MovieDetail) GetImages

func (d *MovieDetail) GetImages() []*Image

func (*MovieDetail) GetTrailers

func (d *MovieDetail) GetTrailers() string

type MovieSearch

type MovieSearch struct {
	Page         int `json:"page"`
	TotalResults int `json:"total_results"`
	TotalPages   int `json:"total_pages"`
	Results      []struct {
		VoteCount        int     `json:"vote_count"`
		ID               int     `json:"id"`
		Video            bool    `json:"video"`
		VoteAverage      float64 `json:"vote_average"`
		Title            string  `json:"title"`
		Popularity       float64 `json:"popularity"`
		PosterPath       string  `json:"poster_path"`
		OriginalLanguage string  `json:"original_language"`
		OriginalTitle    string  `json:"original_title"`
		GenreIds         []int   `json:"genre_ids"`
		BackdropPath     string  `json:"backdrop_path"`
		Adult            bool    `json:"adult"`
		Overview         string  `json:"overview"`
		ReleaseDate      string  `json:"release_date"`
	} `json:"results"`
}

type Network

type Network struct {
	gorm.Model
	ShowDataID uint   `json:"show_data_id"`
	UID        string `json:"uid"`
	Name       string `json:"name"`
	LogoPath   string `json:"logo_path"`
}

Network contains data about production companies

type Result

type Result struct {
	UID            int      `json:"uid"`
	Hash           string   `json:"hash"`
	ContentType    string   `json:"content_type"`
	Title          string   `json:"title"`
	Website        string   `json:"website"`
	Genre          string   `json:"genre"`
	Plot           string   `json:"plot"`
	Images         []*Image `json:"images"`
	Tagline        string   `json:"tagline"`
	ReleaseYear    string   `json:"release_year"`
	Runtime        int      `json:"runtime"`
	PG             string   `json:"pg"`
	SourcePath     string   `json:"source_path"`
	Actors         []Actor  `json:"actors"`
	Trailers       string   `json:"trailer"`
	VoteAverage    float64  `json:"vote_average"`
	VideoFramerate int      `json:"video_framerate"`
	VideoWidth     int      `json:"video_width"`
	VideoHeight    int      `json:"video_height"`
}

type Season

type Season struct {
	gorm.Model
	ShowDataID    uint      `json:"show_data_id"`
	UID           string    `json:"uid"`
	Hash          string    `json:"hash"`
	Name          string    `json:"name"`
	Overview      string    `json:"overview" gorm:"size:1000"`
	AirDate       string    `json:"air_date"`
	SeasonNumber  int       `json:"season_number"`
	Images        []Image   `json:"images" gorm:"foreignkey:SeasonID"`
	Episodes      []Episode `json:"episodes"`
	EpisodesCount int       `json:"episodes_count"`
}

Season contains data about show seasons

type Server

type Server struct {
	Port        int    `json:"port"`
	ReleaseMode string `json:"release_mode"`
	SSLMode     string `json:"ssl_mode"`
	Crt         string `json:"crt"`
	Key         string `json:"key"`
}

Server describes server-specific parameters

type Settings

type Settings struct {
	gorm.Model
	RegisterEnabled bool `json:"register_enabled"`
}

type ShowData

type ShowData struct {
	gorm.Model
	MediaID        uint      `json:"media_id"`
	FirstAirDate   string    `json:"first_air_date"`
	LastAirDate    string    `json:"last_air_date"`
	EpisodeRuntime string    `json:"episode_runtime"`
	Networks       []Network `json:"networks" gorm:"many2many:show_networks;"`
	Seasons        []Season  `json:"seasons"`
	SeasonsCount   string    `json:"seasons_count"`
	EpisodesCount  string    `json:"episodes_count"`
}

ShowData contains show-specific data, like seasons and general show data

type Source

type Source struct {
	Mode            string         `json:"mode"`
	Path            string         `json:"path"`
	IsNSFW          bool           `json:"is_NSFW"`
	ContentType     string         `json:"content_type"`
	Extensions      string         `json:"extensions"`
	ExtensionsType  string         `json:"-"`
	ExtensionsRegex *regexp.Regexp `json:"-"`
}

Source describes a source folder for media files

type Store

type Store struct {
	User     string `json:"user"`
	Password string `json:"password"`
	Database string `json:"database"`
	Host     string `json:"host"`
	Port     int    `json:"port"`
}

Store describes the database connection parameters

type Tmdb

type Tmdb struct {
	Key                string `json:"key"`
	Language           string `json:"language"`
	LanguageIso        string `json:"language_iso"`
	CombinedParameters string `json:"-"`
}

Tmdb describes the Tmdb portion of the api parameters

type Transcoder

type Transcoder struct {
	Concurrency    int  `json:"concurrency"`
	HWAcceleration bool `json:"hw_acceleration"`
}

Transcoder describes transcoder-specific parameters

Jump to

Keyboard shortcuts

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