yts

package module
v0.7.2 Latest Latest
Warning

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

Go to latest
Published: Jan 25, 2024 License: MIT Imports: 9 Imported by: 0

README

yflicks-yts

YTS API client library for the yflicks desktop application

Documentation

Index

Constants

View Source
const (
	GenreAll         = "all"
	GenreAction      = "action"
	GenreAdventure   = "adventure"
	GenreAnimation   = "animation"
	GenreBiography   = "biography"
	GenreComedy      = "comedy"
	GenreCrime       = "crime"
	GenreDocumentary = "documentary"
	GenreDrama       = "drama"
	GenreFamily      = "family"
	GenreFantasy     = "fantasy"
	GenreFilmNoir    = "film-noir"
	GenreGameShow    = "game-show"
	GenreHistory     = "history"
	GenreHorror      = "horror"
	GenreMusic       = "music"
	GenreMusical     = "musical"
	GenreMystery     = "mystery"
	GenreNews        = "news"
	GenreRealityTV   = "reality-tv"
	GenreRomance     = "romance"
	GenreSciFi       = "sci-fi"
	GenreSport       = "sport"
	GenreTalkShow    = "talk-show"
	GenreThriller    = "thriller"
	GenreWar         = "war"
	GenreWestern     = "western"
)
View Source
const (
	SortByTitle         = "title"
	SortByYear          = "year"
	SortByRating        = "rating"
	SortByPeers         = "peers"
	SortBySeeds         = "seeds"
	SortByDownloadCount = "download_count"
	SortByLikeCount     = "like_count"
	SortByDateAdded     = "date_added"
)
View Source
const (
	OrderByAsc  = "asc"
	OrderByDesc = "desc"
)
View Source
const APIBaseURL = "https://yts.mx/api/v2"

Variables

This section is empty.

Functions

func GetGenreList added in v0.7.2

func GetGenreList() []string

func GetOrderByList added in v0.7.2

func GetOrderByList() []string

func GetSortByList added in v0.7.2

func GetSortByList() []string

Types

type BaseResponse

type BaseResponse struct {
	Status        string `json:"status"`
	StatusMessage string `json:"status_message"`
	Meta          `json:"@meta"`
}

type Cast

type Cast struct {
	Name          string `json:"name"`
	CharacterName string `json:"character_name"`
	ImdbCode      string `json:"imdb_code"`
	URLSmallImage string `json:"url_small_image"`
}

type Client

type Client struct {
	// contains filtered or unexported fields
}

func NewClient

func NewClient(timeout time.Duration) *Client

func (Client) GetMovieDetails

func (c Client) GetMovieDetails(ctx context.Context, filters *MovieDetailsFilters) (*MovieDetailsResponse, error)

func (Client) GetMovieSuggestions

func (c Client) GetMovieSuggestions(ctx context.Context, movieID int) (*MovieSuggestionsResponse, error)

func (Client) SearchMovies

func (c Client) SearchMovies(ctx context.Context, filters *SearchMoviesFilters) (*SearchMoviesResponse, error)

type Meta

type Meta struct {
	ServerTime     int    `json:"server_time"`
	ServerTimezone string `json:"server_timezone"`
	APIVersion     int    `json:"api_version"`
	ExecutionTime  string `json:"execution_time"`
}

type Movie

type Movie struct {
	MoviePartial
	Summary  string `json:"summary"`
	Synopsis string `json:"synopsis"`
	State    string `json:"state"`
}

type MovieDetails

type MovieDetails struct {
	MoviePartial
	LikeCount              int    `json:"like_count"`
	DescriptionIntro       string `json:"description_intro"`
	MediumScreenshotImage1 string `json:"medium_screenshot_image1"`
	MediumScreenshotImage2 string `json:"medium_screenshot_image2"`
	MediumScreenshotImage3 string `json:"medium_screenshot_image3"`
	LargeScreenshotImage1  string `json:"large_screenshot_image1"`
	LargeScreenshotImage2  string `json:"large_screenshot_image2"`
	LargeScreenshotImage3  string `json:"large_screenshot_image3"`
	Cast                   []Cast `json:"cast"`
}

type MovieDetailsData

type MovieDetailsData struct {
	Movie MovieDetails `json:"movie"`
}

type MovieDetailsFilters

type MovieDetailsFilters struct {
	MovieID    int  `json:"movie_id"    validate:"required,min=1"`
	WithImages bool `json:"with_images" validate:"boolean"`
	WithCast   bool `json:"with_cast"   validate:"boolean"`
}

func DefaultMovieDetailsFilters

func DefaultMovieDetailsFilters(movieID int) *MovieDetailsFilters

type MovieDetailsResponse

type MovieDetailsResponse struct {
	BaseResponse
	Data MovieDetailsData `json:"data"`
}

type MoviePartial

type MoviePartial struct {
	ID                      int       `json:"id"`
	URL                     string    `json:"url"`
	ImdbCode                string    `json:"imdb_code"`
	Title                   string    `json:"title"`
	TitleEnglish            string    `json:"title_english"`
	TitleLong               string    `json:"title_long"`
	Slug                    string    `json:"slug"`
	Year                    int       `json:"year"`
	Rating                  float64   `json:"rating"`
	Runtime                 int       `json:"runtime"`
	Genres                  []string  `json:"genres"`
	DescriptionFull         string    `json:"description_full"`
	YtTrailerCode           string    `json:"yt_trailer_code"`
	Language                string    `json:"language"`
	MpaRating               string    `json:"mpa_rating"`
	BackgroundImage         string    `json:"background_image"`
	BackgroundImageOriginal string    `json:"background_image_original"`
	SmallCoverImage         string    `json:"small_cover_image"`
	MediumCoverImage        string    `json:"medium_cover_image"`
	LargeCoverImage         string    `json:"large_cover_image"`
	Torrents                []Torrent `json:"torrents"`
	DateUploaded            string    `json:"date_uploaded"`
	DateUploadedUnix        int       `json:"date_uploaded_unix"`
}

type MovieSuggestionsData

type MovieSuggestionsData struct {
	MovieCount int     `json:"movie_count"`
	Movies     []Movie `json:"movies"`
}

type MovieSuggestionsResponse

type MovieSuggestionsResponse struct {
	BaseResponse
	Data MovieSuggestionsData `json:"data"`
}

type SearchMoviesData

type SearchMoviesData struct {
	MovieCount int     `json:"movie_count"`
	Limit      int     `json:"limit"`
	PageNumber int     `json:"page_number"`
	Movies     []Movie `json:"movies"`
}

type SearchMoviesFilters

type SearchMoviesFilters struct {
	Limit         int    `json:"limit"           validate:"min=1,max=50"`
	Page          int    `json:"page"            validate:"min=1"`
	Quality       string `json:"quality"         validate:"oneof=all 480p 720p 1080p 1080p.x265 2160p 3D"`
	MinimumRating int    `json:"minimum_rating"  validate:"min=0,max=9"`
	QueryTerm     string `json:"query_term"`
	Genre         string `` /* 251-byte string literal not displayed */
	SortBy        string `json:"sort_by"         validate:"oneof=title year rating peers seeds download_count like_count date_added"`
	OrderBy       string `json:"order_by"        validate:"oneof=asc desc"`
	WithRTRatings bool   `json:"with_rt_ratings" validate:"boolean"`
}

func DefaultSearchMoviesFilter

func DefaultSearchMoviesFilter() *SearchMoviesFilters

type SearchMoviesResponse

type SearchMoviesResponse struct {
	BaseResponse
	Data SearchMoviesData `json:"data"`
}

type StructValidationError added in v0.7.0

type StructValidationError struct {
	Struct   string
	Field    string
	Tag      string
	Value    interface{}
	Expected string
}

func (*StructValidationError) Error added in v0.7.0

func (e *StructValidationError) Error() string

type Torrent

type Torrent struct {
	URL              string `json:"url"`
	Hash             string `json:"hash"`
	Quality          string `json:"quality"`
	Type             string `json:"type"`
	IsRepack         string `json:"is_repack"`
	VideoCodec       string `json:"video_codec"`
	BitDepth         string `json:"bit_depth"`
	AudioChannels    string `json:"audio_channels"`
	Seeds            int    `json:"seeds"`
	Peers            int    `json:"peers"`
	Size             string `json:"size"`
	SizeBytes        int    `json:"size_bytes"`
	DateUploaded     string `json:"date_uploaded"`
	DateUploadedUnix int    `json:"date_uploaded_unix"`
}

Jump to

Keyboard shortcuts

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