apiexternal

package
v0.0.0-...-6079cd8 Latest Latest
Warning

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

Go to latest
Published: Dec 19, 2021 License: AGPL-3.0 Imports: 25 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrBadResponse = errors.New("received bad response")

ErrBadResponse means that qbittorrent sent back an unexpected response

View Source
var NewznabClients map[string]newznab.Client

Functions

func NewOmdbClient

func NewOmdbClient(apikey string, seconds int, calls int)

func NewPushOverClient

func NewPushOverClient(apikey string)

func NewTmdbClient

func NewTmdbClient(apikey string, seconds int, calls int)

func NewTraktClient

func NewTraktClient(clientid string, clientsecret string, token oauth2.Token, seconds int, calls int)

func NewTvdbClient

func NewTvdbClient(seconds int, calls int)

func QueryNewznabMovieImdb

func QueryNewznabMovieImdb(indexers []NzbIndexer, imdbid string, categories []int) (results []newznab.NZB, failedindexers []string, err error)

QueryNewznabMovieImdb searches Indexers for imbid - strip tt at beginning!

func QueryNewznabQuery

func QueryNewznabQuery(indexers []NzbIndexer, query string, categories []int, searchtype string) (results []newznab.NZB, failedindexers []string, err error)

QueryNewznabQuery searches Indexers for string

func QueryNewznabQueryUntil

func QueryNewznabQueryUntil(indexers []NzbIndexer, query string, categories []int, searchtype string) (results []newznab.NZB, failedindexers []string, lastindexerids map[string]string, err error)

func QueryNewznabRSS

func QueryNewznabRSS(indexers []NzbIndexer, maxitems int, categories []int) (results []newznab.NZB, failedindexers []string, err error)

QueryNewznabRSS returns x entries of given category

func QueryNewznabRSSLast

func QueryNewznabRSSLast(indexers []NzbIndexer, maxitems int, categories []int, maxrequests int) (results []newznab.NZB, failedindexers []string, lastindexerids map[string]string, err error)

QueryNewznabRSS returns entries of given category up to id

func QueryNewznabTvTvdb

func QueryNewznabTvTvdb(indexers []NzbIndexer, tvdbid int, categories []int, season int, episode int) (results []newznab.NZB, failedindexers []string, err error)

QueryNewznabTvTvdb searches Indexers for tvdbid using season and episodes

func SendToDeluge

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

func SendToQBittorrent

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

func SendToRtorrent

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

func SendToSabnzbd

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

Types

type ImdbCsv

type ImdbCsv struct {
	Position    int    `csv:"Position"`
	Const       string `csv:"const"`
	Created     string `csv:"Created"`
	Modified    string `csv:"Modified"`
	Description string `csv:"Description"`
	Title       string `csv:"Title"`
	URL         string `csv:"URL"`
	TitleType   string `csv:"Title Type"`
	IMDbRating  string `csv:"IMDb Rating"`
	RuntimeMins string `csv:"Runtime (mins)"`
	Year        string `csv:"Year"`
	Genres      string `csv:"Genres"`
	NumVotes    string `csv:"Num Votes"`
	ReleaseDate string `csv:"Release Date"`
	Directors   string `csv:"Directors"`
}

type NzbIndexer

type NzbIndexer struct {
	Name                    string
	URL                     string
	Apikey                  string
	UserID                  int
	SkipSslCheck            bool
	Addquotesfortitlequery  bool
	Additional_query_params string
	LastRssId               string
	Customapi               string
	Customurl               string
	Customrssurl            string
	Customrsscategory       string
	RssDownloadAll          bool
	OutputAsJson            bool
	Limitercalls            int
	Limiterseconds          int
	MaxAge                  int
}

NzbIndexer defines the Indexers to query

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"`
	Type       string `json:"Type"`
	DVD        string `json:"DVD"`
	Plot       string `json:"Plot"`
	BoxOffice  string `json:"BoxOffice"`
	Production string `json:"Production"`
	Website    string `json:"Website"`
}

type OmDBMovieSearch

type OmDBMovieSearch struct {
	Title  string `json:"Title"`
	Year   string `json:"Year"`
	ImdbID string `json:"imdbID"`
	Type   string `json:"Type"`
	Poster string `json:"Poster"`
}

type OmDBMovieSearchGlobal

type OmDBMovieSearchGlobal struct {
	Search       []OmDBMovieSearch `json:"Search"`
	TotalResults int               `json:"TotalResults"`
	Response     bool              `json:"Reponse"`
}

type OmdbClient

type OmdbClient struct {
	OmdbApiKey string
	Client     *RLHTTPClient
}
var OmdbApi OmdbClient

func (OmdbClient) GetMovie

func (o OmdbClient) GetMovie(imdbid string) (OmDBMovie, error)

func (OmdbClient) SearchMovie

func (o OmdbClient) SearchMovie(title string, year string) (OmDBMovieSearchGlobal, error)

type PushOverClient

type PushOverClient struct {
	ApiKey        string
	Limiter       *rate.Limiter
	LimiterWindow *slidingwindow.Limiter
}
var PushoverApi PushOverClient

func (PushOverClient) SendMessage

func (p PushOverClient) SendMessage(messagetext string, title string, recipientkey string) error

type QbtClient

type QbtClient struct {
	URL           string
	Authenticated bool
	Jar           http.CookieJar
	// contains filtered or unexported fields
}

Client creates a connection to qbittorrent and performs requests

func NewQBittorrentClient

func NewQBittorrentClient(url string) *QbtClient

NewClient creates a new client connection to qbittorrent

func (client *QbtClient) DownloadFromLink(link string, options map[string]string) (*http.Response, error)

DownloadFromLink starts downloading a torrent from a link

func (*QbtClient) Login

func (client *QbtClient) Login(username string, password string) (loggedIn bool, err error)

Login logs you in to the qbittorrent client returns the current authentication status

type RLHTTPClient

type RLHTTPClient struct {
	Ratelimiter   *rate.Limiter
	LimiterWindow *slidingwindow.Limiter
	// contains filtered or unexported fields
}

RLHTTPClient Rate Limited HTTP Client

func NewClient

func NewClient(rl *rate.Limiter, rl2 *slidingwindow.Limiter) *RLHTTPClient

NewClient return http client with a ratelimiter

func (*RLHTTPClient) Do

func (c *RLHTTPClient) Do(req *http.Request) (*http.Response, []byte, error)

Do dispatches the HTTP request to the network

func (*RLHTTPClient) DoJson

func (c *RLHTTPClient) DoJson(req *http.Request, jsonobj interface{}) error

Do dispatches the HTTP request to the network

func (*RLHTTPClient) DoNew

func (c *RLHTTPClient) DoNew(req *http.Request) (*http.Response, io.ReadCloser, error)

Do dispatches the HTTP request to the network

type TheMovieDBFind

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

type TheMovieDBFindMovieresults

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

type TheMovieDBFindTvresults

type TheMovieDBFindTvresults struct {
	ID               int       `json:"id"`
	OriginalLanguage string    `json:"original_language"`
	FirstAirDate     time.Time `json:"first_air_date"`
	Name             string    `json:"name"`
	OriginalName     string    `json:"original_name"`
	VoteAverage      int       `json:"vote_average"`
	VoteCount        int       `json:"vote_count"`
	Overview         string    `json:"overview"`
	OriginCountry    []string  `json:"origin_Country"`
	Popularity       string    `json:"popularity"`
}

type TheMovieDBMovie

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

type TheMovieDBMovieTitles

type TheMovieDBMovieTitles struct {
	ID     int                         `json:"id"`
	Titles []TheMovieDBMovieTitlesList `json:"titles"`
}

type TheMovieDBMovieTitlesList

type TheMovieDBMovieTitlesList struct {
	Type     string `json:"type"`
	Title    string `json:"title"`
	Iso31661 string `json:"iso_3166_1"`
}

type TheMovieDBSearch

type TheMovieDBSearch struct {
	TotalPages   int `json:"total_pages"`
	TotalResults int `json:"total_results"`
	Page         int `json:"page"`
	Results      []struct {
		OriginalTitle    string    `json:"original_title"`
		VoteAverage      string    `json:"vote_average"`
		Popularity       string    `json:"popularity"`
		VoteCount        int       `json:"vote_count"`
		ReleaseDate      time.Time `json:"release_date"`
		Title            string    `json:"title"`
		Adult            string    `json:"adult"`
		Overview         string    `json:"overview"`
		ID               int       `json:"id"`
		OriginalLanguage string    `json:"original_language"`
	} `json:"results"`
}

type TheMovieDBSearchTV

type TheMovieDBSearchTV struct {
	TotalPages   int `json:"total_pages"`
	TotalResults int `json:"total_results"`
	Page         int `json:"page"`
	Results      []struct {
		ID               int       `json:"id"`
		OriginalLanguage string    `json:"original_language"`
		FirstAirDate     time.Time `json:"first_air_date"`
		Name             string    `json:"name"`
		OriginalName     string    `json:"original_name"`
		VoteAverage      string    `json:"vote_average"`
		VoteCount        int       `json:"vote_count"`
		Overview         string    `json:"overview"`
		OriginCountry    []string  `json:"origin_Country"`
		Popularity       string    `json:"popularity"`
	} `json:"results"`
}

type TheMovieDBTVExternal

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

type TheTVDBEpisodes

type TheTVDBEpisodes struct {
	Links struct {
		First int `json:"first"`
		Last  int `json:"last"`
	} `json:"links"`
	Data []struct {
		ID                 int    `json:"id"`
		AiredSeason        int    `json:"airedSeason"`
		AiredEpisodeNumber int    `json:"airedEpisodeNumber"`
		EpisodeName        string `json:"episodeName"`
		FirstAired         string `json:"firstAired"`
		Overview           string `json:"overview"`
		Language           struct {
			EpisodeName string `json:"episodeName"`
			Overview    string `json:"overview"`
		} `json:"language"`
		ProductionCode  string  `json:"productionCode"`
		ShowURL         string  `json:"showUrl"`
		SeriesID        int     `json:"seriesId"`
		ImdbID          string  `json:"imdbId"`
		ContentRating   string  `json:"contentRating"`
		SiteRating      float32 `json:"siteRating"`
		SiteRatingCount int     `json:"siteRatingCount"`
		IsMovie         int     `json:"isMovie"`
		Poster          string  `json:"filename"`
	} `json:"data"`
}

type TheTVDBSeries

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

type TmdbClient

type TmdbClient struct {
	ApiKey string
	Client *RLHTTPClient
}
var TmdbApi TmdbClient

func (TmdbClient) FindImdb

func (t TmdbClient) FindImdb(imdbid string) (TheMovieDBFind, error)

func (TmdbClient) FindTvdb

func (t TmdbClient) FindTvdb(thetvdbid int) (TheMovieDBFind, error)

func (TmdbClient) GetMovie

func (t TmdbClient) GetMovie(id int) (TheMovieDBMovie, error)

func (TmdbClient) GetMovieExternal

func (t TmdbClient) GetMovieExternal(id int) (TheMovieDBTVExternal, error)

func (TmdbClient) GetMovieTitles

func (t TmdbClient) GetMovieTitles(id int) (TheMovieDBMovieTitles, error)

func (TmdbClient) GetTVExternal

func (t TmdbClient) GetTVExternal(id int) (TheMovieDBTVExternal, error)

func (TmdbClient) SearchMovie

func (t TmdbClient) SearchMovie(name string) (TheMovieDBSearch, error)

func (TmdbClient) SearchTV

func (t TmdbClient) SearchTV(name string) (TheMovieDBSearchTV, error)

type TraktClient

type TraktClient struct {
	ApiKey       string
	ClientID     string
	ClientSecret string
	Client       *RLHTTPClient
	Auth         *oauth2.Config
	Token        *oauth2.Token
}
var TraktApi TraktClient

func (TraktClient) GetAuthToken

func (t TraktClient) GetAuthToken(clientcode string) *oauth2.Token

func (TraktClient) GetAuthUrl

func (t TraktClient) GetAuthUrl() string

func (TraktClient) GetMovie

func (t TraktClient) GetMovie(movieid string) (TraktMovieExtend, error)

func (TraktClient) GetMovieAliases

func (t TraktClient) GetMovieAliases(movieid string) ([]TraktMovieAliases, error)

func (TraktClient) GetMovieAnticipated

func (t TraktClient) GetMovieAnticipated(limit int) ([]TraktMovieAnticipated, error)

func (TraktClient) GetMoviePopular

func (t TraktClient) GetMoviePopular(limit int) ([]TraktMovie, error)

func (TraktClient) GetMovieTrending

func (t TraktClient) GetMovieTrending(limit int) ([]TraktMovieTrending, error)

func (TraktClient) GetSerie

func (t TraktClient) GetSerie(movieid string) (TraktSerieData, error)

func (TraktClient) GetSerieAliases

func (t TraktClient) GetSerieAliases(movieid string) ([]TraktShowAliases, error)

func (TraktClient) GetSerieAnticipated

func (t TraktClient) GetSerieAnticipated(limit int) ([]TraktSerieAnticipated, error)

func (TraktClient) GetSeriePopular

func (t TraktClient) GetSeriePopular(limit int) ([]TraktSerie, error)

func (TraktClient) GetSerieSeasonEpisodes

func (t TraktClient) GetSerieSeasonEpisodes(movieid string, season int) ([]TraktSerieSeasonEpisodes, error)

func (TraktClient) GetSerieSeasons

func (t TraktClient) GetSerieSeasons(movieid string) ([]TraktSerieSeason, error)

func (TraktClient) GetSerieTrending

func (t TraktClient) GetSerieTrending(limit int) ([]TraktSerieTrending, error)

func (TraktClient) GetUserList

func (t TraktClient) GetUserList(username string, listname string, listtype string, limit int) ([]TraktUserList, error)

func (TraktClient) GetUserListAuth

func (t TraktClient) GetUserListAuth(username string, listname string, listtype string, limit int) ([]TraktUserList, error)

type TraktMovie

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

type TraktMovieAliases

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

type TraktMovieAnticipated

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

type TraktMovieExtend

type TraktMovieExtend struct {
	Title string `json:"title"`
	Year  int    `json:"year"`
	Ids   struct {
		Trakt int    `json:"trakt"`
		Slug  string `json:"slug"`
		Imdb  string `json:"imdb"`
		Tmdb  int    `json:"tmdb"`
	} `json:"ids"`
	Tagline               string   `json:"tagline"`
	Overview              string   `json:"overview"`
	Released              string   `json:"released"`
	Runtime               int      `json:"runtime"`
	Country               string   `json:"country"`
	Trailer               string   `json:"trailer"`
	Homepage              string   `json:"homepage"`
	Status                string   `json:"status"`
	Rating                float32  `json:"rating"`
	Votes                 int      `json:"votes"`
	Comments              int      `json:"comment_count"`
	Language              string   `json:"language"`
	AvailableTranslations []string `json:"available_translations"`
	Genres                []string `json:"genres"`
	Certification         string   `json:"certification"`
}

type TraktMovieTrending

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

type TraktMovies

type TraktMovies struct {
}

type TraktSerie

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

type TraktSerieAnticipated

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

type TraktSerieData

type TraktSerieData struct {
	Title string `json:"title"`
	Year  int    `json:"year"`
	Ids   struct {
		Trakt  int    `json:"trakt"`
		Slug   string `json:"slug"`
		Tvdb   int    `json:"tvdb"`
		Tvrage int    `json:"tvrage"`
		Imdb   string `json:"imdb"`
		Tmdb   int    `json:"tmdb"`
	} `json:"ids"`
	Overview              string    `json:"overview"`
	FirstAired            time.Time `json:"first_aired"`
	Runtime               int       `json:"runtime"`
	Certification         string    `json:"certification"`
	Network               string    `json:"network"`
	Country               string    `json:"country"`
	Trailer               string    `json:"trailer"`
	Homepage              string    `json:"homepage"`
	Status                string    `json:"status"`
	Rating                float32   `json:"rating"`
	Votes                 int       `json:"votes"`
	Comments              int       `json:"comment_count"`
	Language              string    `json:"language"`
	AvailableTranslations []string  `json:"available_translations"`
	Genres                []string  `json:"genres"`
	AiredEpisodes         int       `json:"aired_episodes"`
}

type TraktSerieSeason

type TraktSerieSeason struct {
	Number int `json:"number"`
	Ids    struct {
		Trakt  int    `json:"trakt"`
		Tvdb   int    `json:"tvdb"`
		Tvrage int    `json:"tvrage"`
		Imdb   string `json:"imdb"`
		Tmdb   int    `json:"tmdb"`
	} `json:"ids"`
}

type TraktSerieSeasonEpisodes

type TraktSerieSeasonEpisodes struct {
	Season  int    `json:"season"`
	Episode int    `json:"number"`
	Title   string `json:"title"`
	Ids     struct {
		Trakt  int    `json:"trakt"`
		Tvdb   int    `json:"tvdb"`
		Tvrage int    `json:"tvrage"`
		Imdb   string `json:"imdb"`
		Tmdb   int    `json:"tmdb"`
	} `json:"ids"`
	EpisodeAbs            int       `json:"number_abs"`
	Overview              string    `json:"overview"`
	Rating                float32   `json:"rating"`
	Votes                 int       `json:"votes"`
	Comments              int       `json:"comment_count"`
	AvailableTranslations []string  `json:"available_translations"`
	Runtime               int       `json:"runtime"`
	FirstAired            time.Time `json:"first_aired"`
}

type TraktSerieTrending

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

type TraktShowAliases

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

type TraktUserList

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

type TvdbClient

type TvdbClient struct {
	Client *RLHTTPClient
}
var TvdbApi TvdbClient

func (TvdbClient) GetSeries

func (t TvdbClient) GetSeries(id int, language string) (TheTVDBSeries, error)

func (TvdbClient) GetSeriesEpisodes

func (t TvdbClient) GetSeriesEpisodes(id int, language string) (TheTVDBEpisodes, error)

Jump to

Keyboard shortcuts

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