Documentation ¶
Index ¶
- type Episode
- type Series
- func (s *Series) GetSearchQuery(episode Episode) string
- func (s *Series) GetSearchTerms(episode Episode) []string
- func (s *Series) GetTorrent(filters torrents.SearchFilters, episode Episode) (*torrents.Torrent, error)
- func (s *Series) GetTorrents(filters torrents.SearchFilters, episode Episode) ([]torrents.Torrent, error)
- func (s *Series) NextEpisode(tkn *TVDBToken) (Episode, error)
- type TVDBCredentials
- type TVDBToken
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Episode ¶
type Episode struct { Season uint `toml:"season" json:"season"` Episode uint `toml:"episode" json:"episode"` Title string `toml:"title" json:"title"` Aired *time.Time `toml:"aired" json:"aired"` }
Episode represents a unique episode of a series, identified by a pair of a season and episode number.
func ParseEpisodeString ¶
ParseEpisodeString will extract the season and episode number from a string description, such as S03E07.
func (Episode) HasAired ¶
HasAired returns true if the episode's airing date and time is prior to the current date and time.
func (Episode) IsAfter ¶
IsAfter returns true if this episode is sequentially after the given episode.
func (Episode) LongString ¶
LongString returns the string Season xx Episode yy representation of an episode.
type Series ¶
type Series struct { ID int `toml:"id" json:"id"` Title string `toml:"title" json:"title"` MinQuality torrents.VideoQuality `toml:"min_quality" json:"min_quality"` VerifiedUploader bool `toml:"only_trusted" json:"only_trusted"` LastEpisode Episode `toml:"last_episode" json:"last_episode"` Actions utils.WatchlistActions `toml:"actions" json:"actions"` }
Series holds the title of a series along with the next episode expected to come out.
func (*Series) GetSearchQuery ¶ added in v0.14.0
GetSearchQuery returns the normalized title of the series along with its episode number, as it will be used when searching for torrents.
func (*Series) GetSearchTerms ¶ added in v0.14.0
GetSearchTerms returns a list of strings that should exit in a torrent for the given episode of the series.
func (*Series) GetTorrent ¶
func (s *Series) GetTorrent(filters torrents.SearchFilters, episode Episode) (*torrents.Torrent, error)
GetTorrent will search The Pirate Bay and return the best torrent that complies with the given filters.
func (*Series) GetTorrents ¶
func (s *Series) GetTorrents(filters torrents.SearchFilters, episode Episode) ([]torrents.Torrent, error)
GetTorrents will attempt to find a torrent for an episode of this series.
type TVDBCredentials ¶
type TVDBCredentials struct { APIKey string `toml:"api_key" json:"apikey"` UserKey string `toml:"user_key" json:"userkey"` Username string `toml:"username" json:"username"` }
TVDBCredentials holds the credentials used to authenticate with the TVDB API.
func EnvTVDBCredentials ¶
func EnvTVDBCredentials() TVDBCredentials
EnvTVDBCredentials returns a TVDBCredentials struct variable which contains the credentials found in the TVDB_API_KEY, TVDB_USER_KEY and TVDB_USERNAME environment variables.
func (*TVDBCredentials) Login ¶
func (cred *TVDBCredentials) Login() (TVDBToken, error)
Login submits a POST request to the /login API endpoint, which is used to obtain a JWT token for authenticating with the rest of the API.
type TVDBToken ¶
type TVDBToken struct {
Token string `json:"token"`
}
TVDBToken holds a token which represents an authenticated session with the TVDB API.
func (*TVDBToken) LastEpisode ¶
LastEpisode uses the TVDB API to retrieve the last episode that aired for a particular series.
func (*TVDBToken) NextEpisode ¶
NextEpisode uses the TVDB API to make a best guess as to which episode is sequentially next to the one given.