series

package
v0.17.0 Latest Latest
Warning

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

Go to latest
Published: Feb 3, 2021 License: MIT Imports: 10 Imported by: 2

Documentation

Index

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

func ParseEpisodeString(episodeStr string) Episode

ParseEpisodeString will extract the season and episode number from a string description, such as S03E07.

func (Episode) HasAired

func (ep Episode) HasAired() bool

HasAired returns true if the episode's airing date and time is prior to the current date and time.

func (Episode) IsAfter

func (ep Episode) IsAfter(episode Episode) bool

IsAfter returns true if this episode is sequentially after the given episode.

func (Episode) LongString

func (ep Episode) LongString() string

LongString returns the string Season xx Episode yy representation of an episode.

func (Episode) String

func (ep Episode) String() string

String returns the string SxxEyy 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

func (s *Series) GetSearchQuery(episode Episode) string

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

func (s *Series) GetSearchTerms(episode Episode) []string

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.

func (*Series) NextEpisode

func (s *Series) NextEpisode(tkn *TVDBToken) (Episode, error)

NextEpisode uses the TVDB API to make a best guess as to which is the next episode to this series' LastEpisode.

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

func (tkn *TVDBToken) LastEpisode(seriesID int) (Episode, error)

LastEpisode uses the TVDB API to retrieve the last episode that aired for a particular series.

func (*TVDBToken) NextEpisode

func (tkn *TVDBToken) NextEpisode(seriesID int, episode Episode) (nextEpisode Episode, err error)

NextEpisode uses the TVDB API to make a best guess as to which episode is sequentially next to the one given.

func (*TVDBToken) Search

func (tkn *TVDBToken) Search(searchName string) (id int, name string, err error)

Search will search the TVDB for the given series name and return its ID.

Jump to

Keyboard shortcuts

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