apiexternal

package
v0.0.0-...-fab78a3 Latest Latest
Warning

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

Go to latest
Published: Jan 16, 2025 License: AGPL-3.0 Imports: 30 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DownloadNZB

func DownloadNZB(filename string, targetpath string, urlv string, idxcfg *config.IndexersConfig) error

DownloadNZB downloads an NZB file from the given URL and saves it to the specified target path. If the filename is empty, it uses the base name of the URL as the filename. It uses the provided IndexersConfig to get a Newznab client and downloads the file using ProcessHTTP. Returns an error if any step fails.

func GetPushoverclient

func GetPushoverclient(apikey string) *client

GetPushoverclient returns a Pushover client instance for the given API key. If a client for the API key does not exist, it creates a new one and adds it to the cache.

func GetTraktAuthToken

func GetTraktAuthToken(clientcode string) *oauth2.Token

GetTraktAuthToken exchanges the authorization code for an OAuth 2.0 token for the Trakt API. It takes the client code and returns the token, or nil and an error if there was an issue exchanging the code.

func GetTraktAuthURL

func GetTraktAuthURL() string

GetTraktAuthURL generates an authorization URL that redirects the user to the Trakt consent page to request permission for the configured scopes. It returns the generated authorization URL.

func GetTraktToken

func GetTraktToken() *oauth2.Token

GetTraktToken returns the token used to authenticate with Trakt. This is a wrapper around the traktAPI.

func NewClient

func NewClient(clientname string, skiptlsverify, disablecompression bool, rl *slidingwindow.Limiter, usedaily bool, rldaily *slidingwindow.Limiter, timeoutseconds uint16) rlHTTPClient

NewClient creates a new HTTP client for making external API requests. It configures rate limiting, TLS verification, compression, timeouts etc. based on the provided parameters.

func NewOmdbClient

func NewOmdbClient(apikey string, seconds uint8, calls int, disabletls bool, timeoutseconds uint16)

NewOmdbClient creates a new omdbClient instance for making requests to the OMDb API. It takes the API key, rate limit seconds, rate limit calls per second, whether to disable TLS, and request timeout in seconds. It sets sane defaults for the rate limiting if 0 values are passed.

func NewQBittorrentClient

func NewQBittorrentClient(urlv string) *qbtClient

NewClient creates a new client connection to qbittorrent.

func NewTmdbClient

func NewTmdbClient(apikey string, seconds uint8, calls int, disabletls bool, timeoutseconds uint16)

NewTmdbClient creates a new TMDb client for making API requests. It takes the TMDb API key, rate limiting settings, TLS setting, and timeout. Returns a tmdbClient instance configured with the provided settings.

func NewTraktClient

func NewTraktClient(clientid, clientsecret string, seconds uint8, calls int, disabletls bool, timeoutseconds uint16)

NewTraktClient initializes a new traktClient instance for making requests to the Trakt API. It takes in credentials and rate limiting settings and sets up the OAuth2 configuration.

func NewTvdbClient

func NewTvdbClient(seconds uint8, calls int, disabletls bool, timeoutseconds uint16)

NewTvdbClient creates a new tvdbClient instance for making requests to the TheTVDB API. It configures rate limiting and TLS based on the provided parameters.

func NewznabCheckLimiter

func NewznabCheckLimiter(cfgindexer *config.IndexersConfig) bool

NewznabCheckLimiter checks if the rate limiter is triggered for the given indexer config. It loops through the newznabClients slice to find the matching client by URL, and calls checkLimiter on it to check if the rate limit has been hit. Returns true if under limit, false if over limit, and error if there was a problem.

func ProcessHTTP

func ProcessHTTP(c *rlHTTPClient, urlv string, checklimiter bool, run func(context.Context, *http.Response) error, headers map[string][]string) error

ProcessHTTP is a helper function that makes a GET request to the provided URL, sets the specified headers, and runs the provided function with the HTTP response. The function uses a context with a timeout of 5 times the client's configured timeout. If the request fails, the function returns the error.

func QueryNewznabMovieImdb

func QueryNewznabMovieImdb(cfgind *config.IndexersConfig, qual *config.QualityConfig, imdbid string, indexerid int, results *NzbSlice) (bool, string, error)

QueryNewznabMovieImdb queries the Newznab indexer for movies matching the given IMDB ID. It builds the query URL based on the config, quality, and other parameters, executes the query, and stores the results in the given slice. Returns an error if one occurs.

func QueryNewznabQuery

func QueryNewznabQuery(cfgp *config.MediaTypeConfig, e *Nzbwithprio, cfgind *config.IndexersConfig, qual *config.QualityConfig, title string, indexerid int, results *NzbSlice) (bool, string, error)

QueryNewznabQuery queries the Newznab API for the given search query, indexer configuration, quality config, categories, mutex, and result slice. It handles escaping the search query, adding quotes if configured, and limiting results. It returns any error that occurs.

func QueryNewznabRSS

func QueryNewznabRSS(ind *config.IndexersConfig, qual *config.QualityConfig, maxitems, indexerid int, results *NzbSlice) (bool, string, error)

QueryNewznabRSS queries the Newznab RSS feed for the given indexer configuration, quality config, max items, categories, mutex, and result slice. It returns a bool indicating if the results were truncated, and an error if one occurred.

func QueryNewznabRSSLast

func QueryNewznabRSSLast(cfgind *config.IndexersConfig, qual *config.QualityConfig, tillid string, indexerid int, results *NzbSlice) (string, error)

QueryNewznabRSSLast queries the Newznab RSS feed for the latest items matching the given configuration and quality parameters. It returns the latest item ID and any error.

func QueryNewznabRSSLastCustom

func QueryNewznabRSSLastCustom(ind *config.IndexersConfig, qual *config.QualityConfig, tillid string, indexerid int, results *NzbSlice) (string, error)

QueryNewznabRSSLastCustom queries the Newznab RSS feed for the latest items matching the given configuration and quality parameters. It handles pagination to retrieve multiple pages of results if needed. It returns the ID of the first result and any error.

func QueryNewznabTvTvdb

func QueryNewznabTvTvdb(cfgind *config.IndexersConfig, qual *config.QualityConfig, tvdbid, indexerid int, season, episode string, useseason, useepisode bool, results *NzbSlice) (bool, string, error)

QueryNewznabTvTvdb queries the Newznab indexer for TV episodes matching the given TVDB ID, season, and episode. It builds the query URL based on the config, quality, and other parameters, executes the query, and stores the results in the given slice. Returns an error if one occurs.

func SendToDeluge

func SendToDeluge(host string, port int, username, password, urlv, dlpath string, moveafter bool, moveafterpath string, addpaused bool) error

SendToDeluge connects to a Deluge server, authenticates, and adds a torrent from a magnet URI or URL. It configures options like download location, moving completed downloads, pausing on add, etc. Returns any error from the connection or add torrent operations.

func SendToQBittorrent

func SendToQBittorrent(host, port, username, password, urlv, dlpath, addpaused string) error

func SendToRtorrent

func SendToRtorrent(hostname string, insecure bool, urlv, dlpath, name string) error

SendToRtorrent sends a torrent file URL to an rTorrent instance for downloading. hostname and insecure specify the rTorrent server. urlv is the torrent file URL. dlpath is the download location path. name is the name to save the torrent as in rTorrent. Returns any error.

func SendToSabnzbd

func SendToSabnzbd(server, apikey, urlv, category, nzbname string, priority int) error

SendToSabnzbd sends a download URL to a Sabnzbd server. It takes the Sabnzbd server address, API key, download URL, category, NZB name, and priority as parameters. It returns any error from creating the Sabnzbd client, authenticating, validating the authentication method, or adding the NZB.

func SendToTransmission

func SendToTransmission(server, username, password, urlv, dlpath string, addpaused bool) error

SendToTransmission configures a Transmission client with the provided credentials and settings, adds the torrent from the given URL to the client, specifying the download path and whether to start paused, and returns any error from the add operation.

func SetTraktToken

func SetTraktToken(tk *oauth2.Token)

SetTraktToken sets the OAuth 2.0 token used to authenticate with the Trakt API.

func UpdateTraktSerieSeasonsAndEpisodes

func UpdateTraktSerieSeasonsAndEpisodes(showid string, id *uint)

GetTraktSerieSeasonsAndEpisodes retrieves all seasons and episodes for the given Trakt show ID from the Trakt API. It takes the show ID and database series ID as parameters. It queries the local database for existing episodes to avoid duplicates. For each season, it calls addtraktdbepisodes to insert any missing episodes into the database. Returns nothing.

func UpdateTvdbSeriesEpisodes

func UpdateTvdbSeriesEpisodes(id int, language string, dbid *uint)

GetTvdbSeriesEpisodes retrieves all episodes for the given TV series ID from TheTVDB API. It accepts the series ID, preferred language, and database series ID. It retrieves the episode data, checks for existing episodes to avoid duplicates, and inserts any missing episodes into the database. If there are multiple pages of results, it fetches additional pages.

Types

type Nzb

type Nzb struct {
	// ID is the unique identifier for the NZB
	ID string `json:"id,omitempty"`

	// Title is the title of the content
	Title string `json:"title,omitempty"`

	// SourceEndpoint is the endpoint of the NZB source
	SourceEndpoint string `json:"source_endpoint"`

	// Season is the season number if this NZB is for a TV show
	Season string `json:"season,omitempty"`

	// Episode is the episode number if this NZB is for a TV show
	Episode string `json:"episode,omitempty"`

	// IMDBID is the IMDb ID if this NZB is for a movie
	IMDBID string `json:"imdb,omitempty"`

	// DownloadURL is the URL to download the NZB
	DownloadURL string `json:"download_url,omitempty"`

	// Size is the size of the NZB in bytes
	Size int64 `json:"size,omitempty"`

	// TVDBID is the TVDB ID if this NZB is for a TV show
	TVDBID int `json:"tvdbid,omitempty"`

	// IsTorrent indicates if this NZB is a torrent
	IsTorrent bool `json:"is_torrent,omitempty"`

	// Indexer is a pointer to the indexer config for this NZB
	Indexer *config.IndexersConfig

	// Quality is a pointer to the quality config for this NZB
	Quality *config.QualityConfig
}

NZB represents an NZB found on the index.

type NzbSlice

type NzbSlice struct {
	Arr []Nzbwithprio
}

func (*NzbSlice) Add

func (n *NzbSlice) Add(nzb *Nzbwithprio)

Add appends the given Nzbwithprio to the NzbSlice's Arr field, with synchronization to ensure thread-safety.

type Nzbwithprio

type Nzbwithprio struct {
	Info                database.ParseInfo                 // The parsed file name information
	NZB                 Nzb                                // The NZB details
	WantedAlternates    []database.DbstaticTwoStringOneInt // Alternate wanted titles
	AdditionalReason    any                                // Any additional reason details
	AdditionalReasonStr string                             // Any additional reason details
	WantedTitle         string                             // The wanted title for this download
	Quality             string                             // The quality of this NZB
	Listname            string                             // The name of the list this NZB is from
	Reason              string                             // The reason for denying this NZB
	AdditionalReasonInt int64                              // Any additional reason details
	NzbmovieID          uint                               // The associated movie ID if this is a movie
	NzbepisodeID        uint                               // The associated episode ID if this is a TV episode
	Dbid                uint                               // The DBMovie or DBEpisode ID
	MinimumPriority     int                                // The minimum priority level
	DontSearch          bool                               // Whether to avoid searching for this
	DontUpgrade         bool                               // Whether to avoid upgrading this
}

Nzbwithprio is a struct containing information about an NZB found on the index It includes the parsed file name info, the NZB details, IDs, title, alternate titles, quality, list name, priority, reasons, and search flags.

func (*Nzbwithprio) Getregexcfg

func (s *Nzbwithprio) Getregexcfg(qual *config.QualityConfig) *config.RegexConfig

getregexcfg returns the regex configuration for the given quality config that matches the indexer name in the given Nzbwithprio entry. It first checks the Indexer list in the quality config, and falls back to the SettingsList global config if no match is found. Returns nil if no match is found.

type OmDBMovie

type OmDBMovie struct {
	Title string `json:"Title"`
	Year  string `json:"Year"`
	// Rated    string `json:"Rated"`
	// Released string `json:"Released"`
	Genre    string `json:"Genre"`
	Language string `json:"Language"`
	Country  string `json:"Country"`
	// Awards     string `json:"Awards"`
	// Metascore  string `json:"Metascore"`
	ImdbRating string `json:"imdbRating"`
	ImdbVotes  string `json:"imdbVotes"`
	ImdbID     string `json:"imdbID"`
	// OmdbType   string `json:"Type"`
	// DVD        string `json:"DVD"`
	Plot string `json:"Plot"`
	// BoxOffice  string `json:"BoxOffice"`
	// Production string `json:"Production"`
	Website string `json:"Website"`
	Runtime string `json:"Runtime"`
}

func GetOmdbMovie

func GetOmdbMovie(imdbid string) (*OmDBMovie, error)

GetOmdbMovie retrieves movie details from the OMDb API by imdbid. It returns a pointer to an OmDBMovie struct and an error. The imdbid parameter specifies the imdbid to look up. It returns logger.ErrNotFound if the imdbid is empty.

type OmDBMovieSearchGlobal

type OmDBMovieSearchGlobal struct {
	Search []struct {
		Title  string `json:"Title"`
		Year   string `json:"Year"`
		ImdbID string `json:"imdbID"`
	} `json:"Search"`
}

func SearchOmdbMovie

func SearchOmdbMovie(title, yearin string) (*OmDBMovieSearchGlobal, error)

SearchOmdbMovie searches the OMDb API for movies matching the given title and release year. The title parameter specifies the movie title to search for. The year parameter optionally specifies a release year to filter by. It returns a pointer to an OmDBMovieSearchGlobal struct containing search results, and an error.

type TheMovieDBFind

type TheMovieDBFind struct {
	MovieResults []TheMovieDBFindMovieresults `json:"movie_results"`
	TvResults    []TheMovieDBFindTvresults    `json:"tv_results"`
}

func FindTmdbImdb

func FindTmdbImdb(imdbid string) (*TheMovieDBFind, error)

FindTmdbImdb searches TheMovieDB API to find a movie based on its IMDb ID. It takes an IMDb ID string as input and returns a TheMovieDBFind struct containing the lookup result. Returns an ErrNotFound error if the IMDb ID is empty.

func FindTmdbTvdb

func FindTmdbTvdb(thetvdbid int) (*TheMovieDBFind, error)

FindTmdbTvdb searches TheMovieDB API to find a TV show based on its TheTVDB ID. It takes a TheTVDB ID int as input and returns a TheMovieDBFind struct containing the lookup result. Returns an ErrNotFound error if the TheTVDB ID is 0.

type TheMovieDBFindMovieresults

type TheMovieDBFindMovieresults struct {
	Overview         string  `json:"overview"`
	ReleaseDate      string  `json:"release_date"`
	Title            string  `json:"title"`
	OriginalLanguage string  `json:"original_language"`
	OriginalTitle    string  `json:"original_title"`
	VoteAverage      float32 `json:"vote_average"`
	Popularity       float32 `json:"popularity"`
	VoteCount        int     `json:"vote_count"`
	ID               int     `json:"id"`
	Adult            bool    `json:"adult"`
}

type TheMovieDBFindTvresults

type TheMovieDBFindTvresults struct {
	// ID               int      `json:"id"`
	OriginalLanguage string  `json:"original_language"`
	FirstAirDate     string  `json:"first_air_date"`
	Name             string  `json:"name"`
	OriginalName     string  `json:"original_name"`
	Overview         string  `json:"overview"`
	VoteAverage      float32 `json:"vote_average"`
	Popularity       float32 `json:"popularity"`
	VoteCount        int     `json:"vote_count"`
}

type TheMovieDBMovie

type TheMovieDBMovie struct {
	SpokenLanguages []struct {
		EnglishName string `json:"english_name"`
		Name        string `json:"name"`
		Iso6391     string `json:"iso_639_1"`
	} `json:"spoken_languages"`
	Genres []struct {
		Name string `json:"name"`
	} `json:"genres"`
	Backdrop         string  `json:"backdrop_path"`
	Poster           string  `json:"poster_path"`
	Status           string  `json:"status"`
	Tagline          string  `json:"tagline"`
	Title            string  `json:"title"`
	ImdbID           string  `json:"imdb_id"`
	OriginalLanguage string  `json:"original_language"`
	OriginalTitle    string  `json:"original_title"`
	Overview         string  `json:"overview"`
	ReleaseDate      string  `json:"release_date"`
	Popularity       float32 `json:"popularity"`
	VoteAverage      float32 `json:"vote_average"`
	Revenue          int     `json:"revenue"`
	Runtime          int     `json:"runtime"`
	Budget           int     `json:"budget"`
	ID               int     `json:"id"`
	VoteCount        int32   `json:"vote_count"`
	Adult            bool    `json:"adult"`
}

func GetTmdbMovie

func GetTmdbMovie(id int) (*TheMovieDBMovie, error)

GetTmdbMovie retrieves movie details from TheMovieDB API by movie ID. It takes an integer movie ID as input and returns a TheMovieDBMovie struct containing the movie details. Returns an error if the ID is invalid or the API call fails.

type TheMovieDBMovieTitles

type TheMovieDBMovieTitles struct {
	// ID     int                         `json:"id"`
	Titles []struct {
		TmdbType string `json:"type"`
		Title    string `json:"title"`
		Iso31661 string `json:"iso_3166_1"`
	} `json:"titles"`
}

func GetTmdbMovieTitles

func GetTmdbMovieTitles(id int) (*TheMovieDBMovieTitles, error)

GetTmdbMovieTitles retrieves the alternative titles for a TMDb movie by ID. It returns a TheMovieDBMovieTitles struct containing the titles, or an error if the ID is invalid or the lookup fails.

type TheMovieDBSearch

type TheMovieDBSearch struct {
	// TotalPages   int                          `json:"total_pages"`
	// TotalResults int                          `json:"total_results"`
	// Page         int                          `json:"page"`
	Results []TheMovieDBFindMovieresults `json:"results"`
}

func SearchTmdbMovie

func SearchTmdbMovie(name string) (*TheMovieDBSearch, error)

SearchTmdbMovie searches for movies on TheMovieDB API by movie name. It takes a movie name string as input and returns a pointer to a TheMovieDBSearch struct containing the search results, or an error if the name is empty or the API call fails.

type TheMovieDBSearchTV

type TheMovieDBSearchTV struct {
	// TotalPages   int                       `json:"total_pages"`
	// TotalResults int                       `json:"total_results"`
	// Page         int                       `json:"page"`
	Results []TheMovieDBFindTvresults `json:"results"`
}

func SearchTmdbTV

func SearchTmdbTV(name string) (*TheMovieDBSearchTV, error)

SearchTmdbTV searches for TV shows on TheMovieDB API. It takes a search query string and returns a TheMovieDBSearchTV struct containing the search results. Returns ErrNotFound error if the search query is empty.

type TheMovieDBTVExternal

type TheMovieDBTVExternal struct {
	ImdbID      string `json:"imdb_id"`
	FreebaseMID string `json:"freebase_mid"`
	FreebaseID  string `json:"freebase_id"`
	FacebookID  string `json:"facebook_id"`
	InstagramID string `json:"instagram_id"`
	TwitterID   string `json:"twitter_id"`
	ID          int    `json:"id"`
	TvdbID      int    `json:"tvdb_id"`
	TvrageID    int    `json:"tvrage_id"`
}

func GetTVExternal

func GetTVExternal(id int) (*TheMovieDBTVExternal, error)

GetTVExternal retrieves the external IDs for a TV show from TheMovieDB. It takes the ID of the TV show and returns a pointer to a TheMovieDBTVExternal struct containing the external IDs. Returns an error if the ID is invalid or the API call fails.

func GetTmdbMovieExternal

func GetTmdbMovieExternal(id int) (*TheMovieDBTVExternal, error)

GetTmdbMovieExternal retrieves the external IDs for a TMDb movie by ID. It returns a TheMovieDBTVExternal struct containing the external IDs, or an error if the ID is invalid or the lookup fails.

type TheTVDBEpisodes

type TheTVDBEpisodes struct {
	Data []struct {
		EpisodeName        string `json:"episodeName"`
		FirstAired         string `json:"firstAired"`
		Overview           string `json:"overview"`
		Poster             string `json:"filename"`
		AiredSeason        int    `json:"airedSeason"`
		AiredEpisodeNumber int    `json:"airedEpisodeNumber"`
	} `json:"data"`
	Links struct {
		First int `json:"first"`
		Last  int `json:"last"`
		Next  int `json:"next"`
	} `json:"links"`
}

type TheTVDBSeries

type TheTVDBSeries struct {
	Data struct {
		Aliases         []string `json:"aliases"`
		Genre           []string `json:"genre"`
		SeriesName      string   `json:"seriesName"`
		Season          string   `json:"season"`
		Status          string   `json:"status"`
		FirstAired      string   `json:"firstAired"`
		Network         string   `json:"network"`
		Runtime         string   `json:"runtime"`
		Language        string   `json:"language"`
		Overview        string   `json:"overview"`
		Rating          string   `json:"rating"`
		ImdbID          string   `json:"imdbId"`
		Slug            string   `json:"slug"`
		Banner          string   `json:"banner"`
		Poster          string   `json:"poster"`
		Fanart          string   `json:"fanart"`
		SiteRating      float32  `json:"siteRating"`
		ID              int      `json:"id"`
		SiteRatingCount int      `json:"siteRatingCount"`
	} `json:"data"`
}

func GetTvdbSeries

func GetTvdbSeries(id int, language string) (*TheTVDBSeries, error)

GetTvdbSeries retrieves TV series data from the TheTVDB API for the given series ID. If a non-empty language is provided, it will be set in the API request headers. Returns the TV series data, or an error if one occurs.

type TraktAlias

type TraktAlias struct {
	Title   string `json:"title"`
	Country string `json:"country"`
}

func GetTraktMovieAliases

func GetTraktMovieAliases(movieid string) []TraktAlias

GetTraktMovieAliases retrieves alias data from the Trakt API for the given movie ID. It takes a Trakt movie ID string as a parameter. Returns a slice of TraktAlias structs containing the alias data, or nil if there is an error or no aliases found.

func GetTraktSerieAliases

func GetTraktSerieAliases(dbserie *database.Dbserie) []TraktAlias

GetTraktSerieAliases retrieves alias data from the Trakt API for the given Dbserie. It first checks if there is a Trakt ID available and uses that to retrieve aliases. If no Trakt ID, it falls back to using the IMDb ID if available. Returns a slice of TraktAlias structs or nil if no aliases found.

type TraktMovie

type TraktMovie struct {
	IDs struct {
		Slug   string `json:"slug"`
		Imdb   string `json:"imdb"`
		Trakt  int    `json:"trakt"`
		Tmdb   int    `json:"tmdb"`
		Tvdb   int    `json:"tvdb"`
		Tvrage int    `json:"tvrage"`
	} `json:"ids"`
	Title string `json:"title"`
	Year  int    `json:"year"`
}

func GetTraktMoviePopular

func GetTraktMoviePopular(limit *string) []TraktMovie

GetTraktMoviePopular retrieves a list of popular movies from the Trakt API. The limit parameter allows specifying the maximum number of movies to return. It returns a slice of TraktMovie structs containing the movie data, or nil if there was an error.

type TraktMovieAnticipated

type TraktMovieAnticipated struct {
	// ListCount int        `json:"list_count"`
	Movie TraktMovie `json:"movie"`
}

func GetTraktMovieAnticipated

func GetTraktMovieAnticipated(limit *string) []TraktMovieAnticipated

GetTraktMovieAnticipated retrieves a list of anticipated movies from the Trakt API. The limit parameter allows specifying the maximum number of movies to return. It returns a slice of TraktMovieAnticipated structs containing the movie data, or nil if there was an error.

type TraktMovieExtend

type TraktMovieExtend struct {
	IDs struct {
		Slug   string `json:"slug"`
		Imdb   string `json:"imdb"`
		Trakt  int    `json:"trakt"`
		Tmdb   int    `json:"tmdb"`
		Tvdb   int    `json:"tvdb"`
		Tvrage int    `json:"tvrage"`
	} `json:"ids"`
	Genres   []string `json:"genres"`
	Title    string   `json:"title"`
	Tagline  string   `json:"tagline"`
	Overview string   `json:"overview"`
	Released string   `json:"released"`
	Status   string   `json:"status"`
	Language string   `json:"language"`
	Rating   float32  `json:"rating"`
	Runtime  int      `json:"runtime"`
	Comments int      `json:"comment_count"`
	Votes    int32    `json:"votes"`
	Year     uint16   `json:"year"`
}

func GetTraktMovie

func GetTraktMovie(movieid string) (*TraktMovieExtend, error)

GetTraktMovie retrieves extended data for a Trakt movie by ID. It takes a movie ID string as input. Returns a TraktMovieExtend struct containing the movie data, or nil and an error if the movie is not found or there is an error fetching data.

type TraktMovieTrending

type TraktMovieTrending struct {
	// Watchers int        `json:"watchers"`
	Movie TraktMovie `json:"movie"`
}

func GetTraktMovieTrending

func GetTraktMovieTrending(limit *string) []TraktMovieTrending

GetTraktMovieTrending retrieves a list of trending movies from the Trakt API. The limit parameter allows specifying the maximum number of movies to return. It returns a slice of TraktMovieTrending structs containing the movie data, or nil if there was an error.

type TraktSerie

type TraktSerie struct {
	IDs struct {
		Slug   string `json:"slug"`
		Imdb   string `json:"imdb"`
		Trakt  int    `json:"trakt"`
		Tmdb   int    `json:"tmdb"`
		Tvdb   int    `json:"tvdb"`
		Tvrage int    `json:"tvrage"`
	} `json:"ids"`
	Title string `json:"title"`
	Year  int    `json:"year"`
}

func GetTraktSeriePopular

func GetTraktSeriePopular(limit *string) []TraktSerie

GetTraktSeriePopular retrieves popular TV shows from Trakt based on the number of watches and list additions. It takes an optional limit parameter to limit the number of results returned. Returns a slice of TraktSerie structs containing the popular show data.

type TraktSerieAnticipated

type TraktSerieAnticipated struct {
	// ListCount int        `json:"list_count"`
	Serie TraktSerie `json:"show"`
}

func GetTraktSerieAnticipated

func GetTraktSerieAnticipated(limit *string) []TraktSerieAnticipated

GetTraktSerieAnticipated retrieves the most anticipated TV shows from Trakt based on the number of list adds. It takes an optional limit parameter to limit the number of results returned. Returns a slice of TraktSerieAnticipated structs containing the anticipated show data.

type TraktSerieData

type TraktSerieData struct {
	IDs struct {
		Slug   string `json:"slug"`
		Imdb   string `json:"imdb"`
		Trakt  int    `json:"trakt"`
		Tmdb   int    `json:"tmdb"`
		Tvdb   int    `json:"tvdb"`
		Tvrage int    `json:"tvrage"`
	} `json:"ids"`
	Genres     []string  `json:"genres"`
	Title      string    `json:"title"`
	Overview   string    `json:"overview"`
	Network    string    `json:"network"`
	Country    string    `json:"country"`
	Status     string    `json:"status"`
	Language   string    `json:"language"`
	FirstAired time.Time `json:"first_aired"`
	Rating     float32   `json:"rating"`
	Year       int       `json:"year"`
	Runtime    int       `json:"runtime"`
}

func GetTraktSerie

func GetTraktSerie(showid string) (*TraktSerieData, error)

GetTraktSerie retrieves extended data for a Trakt TV show by its Trakt ID. It takes the Trakt show ID as a string parameter. It returns a TraktSerieData struct containing the show data, or nil and an error if the show ID is invalid or there was an error retrieving data.

type TraktSerieSeason

type TraktSerieSeason struct {
	Number string `json:"number"`
}

func GetTraktSerieSeasons

func GetTraktSerieSeasons(showid string) ([]TraktSerieSeason, error)

GetTraktSerieSeasons retrieves a list of season numbers for a Trakt TV show by ID. It returns a slice of season numbers as strings, or nil if there is an error.

type TraktSerieSeasonEpisodes

type TraktSerieSeasonEpisodes struct {
	Title      string    `json:"title"`
	Overview   string    `json:"overview"`
	FirstAired time.Time `json:"first_aired"`
	Season     int       `json:"season"`
	Episode    int       `json:"number"`
	Runtime    int       `json:"runtime"`
}

func GetTraktSerieSeasonEpisodes

func GetTraktSerieSeasonEpisodes(showid, season string) ([]TraktSerieSeasonEpisodes, error)

GetTraktSerieSeasonEpisodes retrieves all episodes for the given show ID and season from the Trakt API. It takes the show ID and season number as parameters. Returns a slice of TraktSerieSeasonEpisodes structs containing the episode data, or nil if there is an error.

func Testaddtraktdbepisodes

func Testaddtraktdbepisodes() ([]TraktSerieSeasonEpisodes, error)

type TraktSerieTrending

type TraktSerieTrending struct {
	// Watchers int        `json:"watchers"`
	Serie TraktSerie `json:"show"`
}

func GetTraktSerieTrending

func GetTraktSerieTrending(limit *string) []TraktSerieTrending

GetTraktSerieTrending retrieves the trending TV shows from Trakt based on the limit parameter. It returns a slice of TraktSerieTrending structs containing the trending show data.

type TraktUserList

type TraktUserList struct {
	// Rank      int        `json:"rank"`
	// ID        int        `json:"id"`
	// Notes     string     `json:"notes"`
	Movie     TraktMovie `json:"movie"`
	Serie     TraktSerie `json:"show"`
	TraktType string     `json:"type"`
}

func GetTraktUserList

func GetTraktUserList(username, listname, listtype string, limit *string) ([]TraktUserList, error)

GetTraktUserList retrieves a Trakt user list by username, list name, list type, and optional limit. It returns a slice of TraktUserList structs containing the list data, and an error.

func GetTraktUserListAuth

func GetTraktUserListAuth(username, listname, listtype string, limit *string) ([]TraktUserList, error)

GetTraktUserListAuth retrieves a Trakt user list with authentication. It takes the username, list name, list type, and optional limit parameters and returns the user list items as an array of TraktUserList structs and an error. Returns ErrNotFound if username, listname or listtype are empty.

Jump to

Keyboard shortcuts

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