Documentation ¶
Index ¶
- type Category
- type Client
- func (c *Client) DownloadEntry(entry Entry) ([]byte, error)
- func (c *Client) EntryDownloadURL(entry Entry) *url.URL
- func (c *Client) Search(values url.Values) (Entries, error)
- func (c *Client) SearchRSS(values url.Values) (Entries, error)
- func (c *Client) SearchRSSUntilEntryID(categories []Category, num int, id uuid.UUID, maxRequests int) (entries Entries, err error)
- func (c *Client) SearchRecentEntries(categories []Category, num int) (Entries, error)
- func (c *Client) SearchWithIMDB(categories []Category, imdbID string) (Entries, error)
- func (c *Client) SearchWithQuery(categories []Category, query string, searchType string) (Entries, error)
- func (c *Client) SearchWithTVDB(categories []Category, tvDBID int, season int, episode int) (Entries, error)
- func (c *Client) SearchWithTVRage(categories []Category, tvRageID int, season int, episode int) (Entries, error)
- type Comment
- type Comments
- type Content
- type Entries
- type Entry
- type EntryCategorisation
- type EntryDates
- type EntryGeneral
- type EntryMeta
- type File
- type ModePath
- type Movie
- type NZBFile
- type Source
- type TV
- type TorrentFile
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Category ¶
type Category int
Category describes a newznab category
const ( // TV Categories // CategoryTVAll is for all shows CategoryTVAll Category = 5000 // CategoryTVForeign is for foreign shows CategoryTVForeign Category = 5020 // CategoryTVSD is for standard-definition shows CategoryTVSD Category = 5030 // CategoryTVHD is for high-definition shows CategoryTVHD Category = 5040 // CategoryTVOther is for other shows CategoryTVOther Category = 5050 // CategoryTVSport is for sports shows CategoryTVSport Category = 5060 // Movie categories // CategoryMovieAll is for all movies CategoryMovieAll Category = 2000 // CategoryMovieForeign is for foreign movies CategoryMovieForeign Category = 2010 // CategoryMovieOther is for other movies CategoryMovieOther Category = 2020 // CategoryMovieSD is for standard-definition movies CategoryMovieSD Category = 2030 // CategoryMovieHD is for high-definition movies CategoryMovieHD Category = 2040 // CategoryMovieBluRay is for blu-ray movies CategoryMovieBluRay Category = 2050 // CategoryMovie3D is for 3-D movies CategoryMovie3D Category = 2060 )
Newznab category constants
type Client ¶
type Client struct { // an optional key to authenticate to the API with APIKey string // an optional user ID to authenticate to the API with APIUserID int // the base URL to use for interactions with the API BaseURL *url.URL // http client to use for interactions with the API HTTPClient *http.Client // contains filtered or unexported fields }
Client is a type for interacting with the newznab API
func (*Client) DownloadEntry ¶
DownloadEntry returns the bytes of the actual NZB or other file for the given entry
func (*Client) EntryDownloadURL ¶
EntryDownloadURL returns the URL to download the entry from
func (*Client) Search ¶
Search performs an arbitrary API query against the torznab indexer, and parses and returns the newznab entries the API responded with
func (*Client) SearchRSS ¶
SearchRSS performs an arbitrary RSS query against the torznab indexer, and parses and returns the newznab entries the RSS API responded with
func (*Client) SearchRSSUntilEntryID ¶
func (c *Client) SearchRSSUntilEntryID(categories []Category, num int, id uuid.UUID, maxRequests int) (entries Entries, err error)
SearchRSSUntilEntryID fetches the RSS feed in chunks until it finds the entry with the given ID, then stops and returns the newznab entries fetched thus far. If it reaches maxRequests, it will return what was fetched up until that point.
func (*Client) SearchRecentEntries ¶
SearchRecentEntries returns up to <num> of the most recent newznab entries
func (*Client) SearchWithIMDB ¶
SearchWithIMDB returns NZBs for the given parameters
func (*Client) SearchWithQuery ¶
func (c *Client) SearchWithQuery(categories []Category, query string, searchType string) (Entries, error)
SearchWithQuery returns NZBs for the given parameters
type Comments ¶
type Comments struct { // number of comments on the newznab entry Number uint64 // actual comments on the newznab entry Comments []Comment }
Comments describes comments on an entry, and information relating to those comments
type Content ¶
type Content interface { // IsContent is a dummy function that does nothing IsContent() // Aired returns the air date of the content Aired() time.Time // SetAired sets the air date of the content SetAired(date time.Time) // Title returns the canonical title of the content Title() string }
Content describes the actual content that an entry corresponds to; that is, it describes the movie or episode
type Entry ¶
type Entry struct { // information relating to the newznab entry, rather than the // content within Meta EntryMeta // general information from the newznab entry General EntryGeneral // information relating to the content of the file the newznab entry corresponds // to Content Content // information relating to the file itself that the newznab entry corresponds to File File }
Entry describes an individual newznab entry found on an index
func (*Entry) PopulateComments ¶
populateComments fetches and updates the Comments for the given newznab entry
func (*Entry) PopulateFile ¶
PopulateFile populates File. If File is already set to a specific implementation, that implementation's Populate() method will be called, else, File will be set to a new instance of NZBFile, and its Populate() method called.
type EntryCategorisation ¶
type EntryCategorisation struct { // newznab categories that the entry belongs to Category []string // info string for the newznab entry Info string // genre that the content of the newznab entry belongs to Genre string }
EntryCategorisation describes information relating to the categorisation of the newznab entry, such as genre, category, etc.
type EntryDates ¶
type EntryDates struct { // time the Entry was published Published time.Time // what is this? Usenet time.Time }
EntryDates describes published and usenet dates for an Entry
type EntryGeneral ¶
type EntryGeneral struct { // title of the newznab entry Title string // description of the newznab entry Description string // information relating to the categorisation of the Entry Categorisation EntryCategorisation }
EntryGeneral describes general information for an Entry
type EntryMeta ¶
type EntryMeta struct { // entry's GUID ID uuid.UUID // entry dates Dates EntryDates // information relating to the source of the entry Source Source // comments on the Entry Comments Comments // number of times the newznab entry has been accessed Grabs uint64 }
EntryMeta describes information about an Entry itself, rather than the content it describes
type File ¶
type File interface { // Size is a function that returns the size of the file contents in bytes Size() uint64 // URL is a function which returns a url where the raw file being described // may be downloaded from URL() *url.URL // Bytes is a function that returns the bytes of the actual file that File // describes; e.g. it might return the bytes of a NZB or Torrent file, // depending on the implementation Bytes() ([]byte, error) // BytesReader is a function that returns an io.Reader for the bytes of the // actual file that File describes; e.g. it may return an io.Reader for the // bytes of a NZB or Torrent file, depending on the implemenattion BytesReader() (io.Reader, error) // Populate is a function that updates the information contained within File // by downloading the raw file, and parsing it Populate(c *Client, e *Entry) error }
File describes the actual file that an entry corresponds to
type ModePath ¶
type ModePath string
ModePath is a string type that describes the path to append to a base URL to use either API or RSS mode
type Movie ¶
type Movie struct { // the air date of the movie according to the newznab entry AirDate time.Time // ID of the entry for the movie in IMDB IMDBID int64 // title of the movie as recorded by the IMDB entry IMDBTitle string // year of movie release as recorded by IMDB IMDBYear time.Time // score of the movie as recorded by IMDB IMDBScore float64 // URL for a cover image for the movie Cover *url.URL }
Movie is a Content implementation that describes a movie
func (Movie) IsContent ¶
func (Movie) IsContent()
IsContent is a dummy function that implements the Content interface
type NZBFile ¶
NZBFile is a File implementation that describes a NZB
func (NZBFile) BytesReader ¶
BytesReader returns an io.Reader for the bytes of the usual XML representation of the NZB file
type Source ¶
type Source struct { // base endpoint of the indexer this entry was retrieved from Endpoint *url.URL // api key used to access the indexer that this entry was retrieved from APIKey string }
Source describes information relating to the source of an entry
type TV ¶
type TV struct { // air date for the episode according to the entry AirDate time.Time // ID for the entry for the episode in TheTVDB TVDBID int64 // ID for the entry for the episode in TVRage TVRageID int64 // absolute number of the season Season uint // number of the episode; entry dependent whether it is absolute or relative Episode uint // canonical title of the episode CanonicalTitle string // rating of the episode as recorded in the newznab entry Rating float64 }
TV is a Content implementation that describes an episode of a TV series
func (TV) IsContent ¶
func (TV) IsContent()
IsContent is a dummy function that implements the Content interface
type TorrentFile ¶
type TorrentFile struct { // size of the torrent contents in bytes ContentsSize uint64 // number of seeders on the torrent Seeders uint64 // number of peers on the torrent Peers uint64 // SHA1 hash of the info part of the torrent InfoHash []byte `json:"infohash,omitempty"` // bytes of the raw torrent file Raw []byte // URL to download torrent file from DownloadURL *url.URL }
TorrentFile is a File implementation that describes a torrent file
func (TorrentFile) Bytes ¶
func (t TorrentFile) Bytes() ([]byte, error)
Bytes returns the bytes of the raw torrent file
func (TorrentFile) BytesReader ¶
func (t TorrentFile) BytesReader() (io.Reader, error)
BytesReader returns an io.Reader for the bytes of the raw torrent file
func (*TorrentFile) Populate ¶
func (t *TorrentFile) Populate(c *Client, e *Entry) (err error)
Populate populates the TorrentFile, with the information contained within the raw torrent file.
func (TorrentFile) Size ¶
func (t TorrentFile) Size() uint64
Size returns the size of the torrent contents in bytes
func (TorrentFile) URL ¶
func (t TorrentFile) URL() *url.URL
URL returns a URL where the raw torrent file may be downloaded from