Documentation
¶
Index ¶
- Constants
- type Capabilities
- type Category
- type Client
- func (c *Client) Capabilities() (Capabilities, error)
- func (c *Client) Details(guid string) (Details, error)
- func (c *Client) DownloadNZB(nzb *NZB) ([]byte, error)
- func (c *Client) LoadRSSFeed(categories []int, num int) ([]*NZB, error)
- func (c *Client) LoadRSSFeedUntilNZBID(categories []int, num int, id string, maxRequests int) ([]*NZB, error)
- func (c *Client) NZBDownloadURL(nzb *NZB) (string, error)
- func (c *Client) PopulateComments(nzb *NZB) error
- func (c *Client) SearchWithIMDB(categories []int, imdbID string) ([]*NZB, error)
- func (c *Client) SearchWithQuery(categories []int, query string, searchType string) ([]*NZB, error)
- func (c *Client) SearchWithTVDB(categories []int, tvDBID int, season int, episode int) ([]*NZB, error)
- func (c *Client) SearchWithTVMaze(categories []int, tvMazeID int, season int, episode int) ([]*NZB, error)
- func (c *Client) SearchWithTVRage(categories []int, tvRageID int, season int, episode int) ([]*NZB, error)
- type Comment
- type Details
- type NZB
- type RawNZB
- type SearchResponse
- type Subcat
- type Time
Constants ¶
const ( CategoryConsoleAll = 1000 CategoryConsoleNDS = 1010 CategoryConsolePSP = 1020 CategoryConsoleWii = 1030 CategoryConsoleXBox = 1040 CategoryConsoleXBox360 = 1050 CategoryConsoleWiiware = 1060 CategoryConsoleXBox360DLC = 1070 CategoryMovieAll = 2000 CategoryMovieForeign = 2010 CategoryMovieOther = 2020 CategoryMovieSD = 2030 CategoryMovieHD = 2040 CategoryMovieUHD = 2045 CategoryMovieBluRay = 2050 CategoryMovie3D = 2060 CategoryAudioAll = 3000 CategoryAudioMP3 = 3010 CategoryAudioVideo = 3020 CategoryAudioAudiobook = 3030 CategoryAudioLossless = 3040 CategoryPCAll = 4000 CategoryPC0day = 4010 CategoryPCISO = 4020 CategoryPCMac = 4030 CategoryPCMobileOther = 4040 CategoryPCGames = 4050 CategoryPCMobileiOS = 4060 CategoryPCMobileAndroid = 4070 CategoryTVAll = 5000 CategoryTVForeign = 5020 CategoryTVSD = 5030 CategoryTVHD = 5040 CategoryTVUHD = 5045 CategoryTVOther = 5050 CategoryTVSport = 5060 CategoryTVAnime = 5060 CategoryXXXAll = 6000 CategoryXXXDVD = 6010 CategoryXXXWMV = 6020 CategoryXXXXviD = 6030 CategoryXXXx264 = 6040 CategoryOtherAll = 7000 CategoryOtherMisc = 7010 CategoryOtherEBook = 7020 CategoryOtherComics = 7030 )
Various constants for categories see: https://inhies.github.io/Newznab-API/categories/
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Capabilities ¶
type Capabilities struct {
Server struct {
Title string `xml:"title,attr" json:"title,omitempty"`
} `xml:"server" json:"server,omitempty"`
Searching struct {
Search struct {
Available string `xml:"available,attr" json:"available,omitempty"`
SupportedParams string `xml:"supportedParams,attr" json:"supported_params,omitempty"`
} `xml:"search" json:"search,omitempty"`
TvSearch struct {
Available string `xml:"available,attr" json:"available,omitempty"`
SupportedParams string `xml:"supportedParams,attr" json:"supported_params,omitempty"`
} `xml:"tv-search" json:"tv_search,omitempty"`
MovieSearch struct {
Available string `xml:"available,attr" json:"available,omitempty"`
SupportedParams string `xml:"supportedParams,attr" json:"supported_params,omitempty"`
} `xml:"movie-search" json:"movie_search,omitempty"`
} `xml:"searching" json:"searching,omitempty"`
Categories struct {
Category []Category `xml:"category" json:"category,omitempty"`
} `xml:"categories" json:"categories,omitempty"`
}
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client is a type for interacting with a newznab or torznab api
func (*Client) Capabilities ¶
func (c *Client) Capabilities() (Capabilities, error)
Capabilities returns the capabilities of this tracker
func (*Client) DownloadNZB ¶
DownloadNZB returns the bytes of the actual NZB file for the given NZB
func (*Client) LoadRSSFeed ¶
LoadRSSFeed returns up to <num> of the most recent NZBs of the given categories.
func (*Client) LoadRSSFeedUntilNZBID ¶
func (c *Client) LoadRSSFeedUntilNZBID(categories []int, num int, id string, maxRequests int) ([]*NZB, error)
LoadRSSFeedUntilNZBID fetches NZBs until a given NZB id is reached.
func (*Client) NZBDownloadURL ¶
NZBDownloadURL returns a URL to download the NZB from
func (*Client) PopulateComments ¶
PopulateComments fills in the Comments for the given NZB
func (*Client) SearchWithIMDB ¶
SearchWithIMDB returns NZBs for the given parameters
func (*Client) SearchWithQuery ¶
SearchWithQuery returns NZBs for the given parameters
func (*Client) SearchWithTVDB ¶
func (c *Client) SearchWithTVDB(categories []int, tvDBID int, season int, episode int) ([]*NZB, error)
SearchWithTVDB returns NZBs for the given parameters
type Comment ¶
type Comment struct {
Title string `json:"title,omitempty"`
Content string `json:"content,omitempty"`
PubDate time.Time `json:"pub_date,omitempty"`
}
Comment represents a user comment left on an NZB record
func (Comment) JSONString ¶
JSONString returns a JSON string representation of this Comment
type Details ¶
type Details struct {
XMLName xml.Name `xml:"rss"`
Text string `xml:",chardata"`
Version string `xml:"version,attr"`
Channel struct {
Text string `xml:",chardata"`
Item struct {
Text string `xml:",chardata"`
Title string `xml:"title"`
Guid struct {
Text string `xml:",chardata"`
IsPermaLink string `xml:"isPermaLink,attr"`
} `xml:"guid"`
Link string `xml:"link"`
Comments string `xml:"comments"`
PubDate string `xml:"pubDate"`
Category string `xml:"category"`
Description string `xml:"description"`
Enclosure struct {
Text string `xml:",chardata"`
URL string `xml:"url,attr"`
Length string `xml:"length,attr"`
Type string `xml:"type,attr"`
} `xml:"enclosure"`
Attr []struct {
Text string `xml:",chardata"`
Name string `xml:"name,attr"`
Value string `xml:"value,attr"`
} `xml:"attr"`
} `xml:"item"`
} `xml:"channel"`
}
type NZB ¶
type NZB struct {
ID string `json:"id,omitempty"`
Title string `json:"title,omitempty"`
Description string `json:"description,omitempty"`
Size int64 `json:"size,omitempty"`
AirDate time.Time `json:"air_date,omitempty"`
PubDate time.Time `json:"pub_date,omitempty"`
UsenetDate time.Time `json:"usenet_date,omitempty"`
NumGrabs int `json:"num_grabs,omitempty"`
NumComments int `json:"num_comments,omitempty"`
Comments []Comment `json:"comments,omitempty"`
Poster string `json:"poster,omitempty"`
Password string `json:"password,omitempty"`
SourceEndpoint string `json:"source_endpoint"`
SourceAPIKey string `json:"source_apikey"`
Category []string `json:"category,omitempty"`
Info string `json:"info,omitempty"`
Genre string `json:"genre,omitempty"`
Group string `json:"group,omitempty"`
Team string `json:"team,omitempty"`
Year int `json:"year,omitempty"`
Resolution string `json:"resolution,omitempty"`
Video string `json:"video,omitempty"`
Audio string `json:"audio,omitempty"`
Framerate string `json:"framerate,omitempty"`
Language string `json:"language,omitempty"`
Subs []string `json:"subs,omitempty"`
CoverURL string `json:"coverurl,omitempty"`
Publisher string `json:"publisher,omitempty"`
BackdropCoverURL string `json:"backdropcoverurl,omitempty"`
Review string `json:"review,omitempty"`
// TV Specific stuff
TVDBID string `json:"tvdbid,omitempty"`
TVRageID string `json:"tvrageid,omitempty"`
TVMazeID string `json:"tvmazeid,omitempty"`
Season string `json:"season,omitempty"`
Episode string `json:"episode,omitempty"`
TVTitle string `json:"tvtitle,omitempty"`
Rating int `json:"rating,omitempty"`
// Movie Specific stuff
IMDBID string `json:"imdb,omitempty"`
IMDBTitle string `json:"imdbtitle,omitempty"`
IMDBYear int `json:"imdbyear,omitempty"`
IMDBScore float32 `json:"imdbscore,omitempty"`
IMDBActors []string `json:"imdbactors,omitempty"`
IMDBDirector string `json:"imdbdirector,omitempty"`
IMDBTagline string `json:"imdbtagline,omitempty"`
IMDBPlot string `json:"imdbplot,omitempty"`
// Audio Specific stuff
Artist string `json:"artist,omitempty"`
Album string `json:"album,omitempty"`
Tracks string `json:"tracks,omitempty"`
// Book Specific stuff
Author string `json:"author,omitempty"`
Pages int `json:"pages,omitempty"`
PublishDate time.Time `json:"publish_date,omitempty"`
BookTitle string `json:"booktitle,omitempty"`
// Torznab specific stuff
Seeders int `json:"seeders,omitempty"`
Peers int `json:"peers,omitempty"`
InfoHash string `json:"infohash,omitempty"`
DownloadURL string `json:"download_url,omitempty"`
IsTorrent bool `json:"is_torrent,omitempty"`
}
NZB represents an NZB found on the index
func (NZB) JSONString ¶
JSONString returns a JSON string representation of this NZB
type RawNZB ¶
type RawNZB struct {
Title string `xml:"title,omitempty"`
Link string `xml:"link,omitempty"`
Size string `xml:"size,omitempty"`
Category struct {
Domain string `xml:"domain,attr"`
Value string `xml:",chardata"`
} `xml:"category,omitempty"`
GUID struct {
GUID string `xml:",chardata"`
IsPermaLink bool `xml:"isPermaLink,attr"`
} `xml:"guid,omitempty"`
Comments string `xml:"comments"`
Description string `xml:"description"`
Author string `xml:"author,omitempty"`
Source struct {
URL string `xml:"url,attr"`
Value string `xml:",chardata"`
} `xml:"source,omitempty"`
Date Time `xml:"pubDate,omitempty"`
Enclosure struct {
URL string `xml:"url,attr"`
Length string `xml:"length,attr"`
Type string `xml:"type,attr"`
} `xml:"enclosure,omitempty"`
Attributes []struct {
XMLName xml.Name
Name string `xml:"name,attr"`
Value string `xml:"value,attr"`
} `xml:"attr"`
}
RawNZB represents a single NZB item in search results.
type SearchResponse ¶
type SearchResponse struct {
Version string `xml:"version,attr"`
ErrorCode int `xml:"code,attr"`
ErrorDesc string `xml:"description,attr"`
Channel struct {
Title string `xml:"title"`
Link struct {
Href string `xml:"href,attr"`
Rel string `xml:"rel,attr"`
Type string `xml:"type,attr"`
} `xml:"http://www.w3.org/2005/Atom link"`
Description string `xml:"description"`
Language string `xml:"language,omitempty"`
Webmaster string `xml:"webmaster,omitempty"`
Category string `xml:"category,omitempty"`
Image struct {
URL string `xml:"url"`
Title string `xml:"title"`
Link string `xml:"link"`
Description string `xml:"description,omitempty"`
Width int `xml:"width,omitempty"`
Height int `xml:"height,omitempty"`
} `xml:"image"`
Response struct {
Offset int `xml:"offset,attr"`
Total int `xml:"total,attr"`
} `xml:"http://www.newznab.com/DTD/2010/feeds/attributes/ response"`
// All NZBs that match the search query, up to the response limit.
NZBs []RawNZB `xml:"item"`
} `xml:"channel"`
}
SearchResponse is a RSS version of the response.