Documentation
¶
Index ¶
- Constants
- Variables
- type Caps
- type CapsCategories
- type CapsLimits
- type CapsSearch
- type CapsSearching
- type CapsServer
- type Category
- type Client
- type Error
- type RssDate
- type SearchRequest
- type SearchResult
- type SearchResultChannel
- type SearchResultItem
- type SearchResultItemEnclosure
- type SearchResultItemTorznabAttr
- type SearchResultResponse
- type Subcategory
- type Xmler
Constants ¶
View Source
const ( AttrInfoHash = "infohash" AttrMagnetUrl = "magneturl" // AttrCategory is the Category ID AttrCategory = "category" AttrSize = "size" AttrPublishDate = "publishdate" AttrSeeders = "seeders" AttrLeechers = "leechers" AttrPeers = "peers" // AttrFiles is the number of files in the torrent AttrFiles = "files" AttrYear = "year" AttrSeason = "season" AttrEpisode = "episode" // AttrVideo is the video codec AttrVideo = "video" AttrResolution = "resolution" AttrTeam = "team" AttrImdb = "imdb" AttrTmdb = "tmdb" )
View Source
const ( FunctionCaps = "caps" FunctionSearch = "search" FunctionMovie = "movie" FunctionTv = "tvsearch" FunctionMusic = "music" FunctionBook = "book" )
View Source
const ( ParamType = "t" ParamQuery = "q" ParamCat = "cat" ParamImdbId = "imdbid" ParamTmdbId = "tmdbid" ParamSeason = "season" ParamEpisode = "ep" ParamLimit = "limit" ParamOffset = "offset" )
View Source
const RssDateDefaultFormat = "Mon, 02 Jan 2006 15:04:05 -0700"
Variables ¶
View Source
var ( CategoryMovies = categoriesMap[2000] CategoryMoviesSD = categoriesMap[2030] CategoryMoviesHD = categoriesMap[2040] CategoryMoviesUHD = categoriesMap[2045] CategoryMovies3D = categoriesMap[2060] CategoryAudio = categoriesMap[3000] CategoryAudioAudiobook = categoriesMap[3030] CategoryPC = categoriesMap[4000] CategoryPCGames = categoriesMap[4050] CategoryTV = categoriesMap[5000] CategoryTVSD = categoriesMap[5030] CategoryTVHD = categoriesMap[5040] CategoryTVUHD = categoriesMap[5045] CategoryXXX = categoriesMap[6000] CategoryXXXOther = categoriesMap[6070] CategoryBooks = categoriesMap[7000] CategoryBooksEBook = categoriesMap[7020] CategoryBooksComics = categoriesMap[7030] CategoryOther = categoriesMap[8000] )
View Source
var TopLevelCategories = []Category{ CategoryMovies, CategoryAudio, CategoryPC, CategoryTV, CategoryXXX, CategoryBooks, CategoryOther, }
Functions ¶
This section is empty.
Types ¶
type Caps ¶
type Caps struct {
XMLName xml.Name `xml:"caps"`
Server CapsServer `xml:"server"`
Limits CapsLimits `xml:"limits"`
Searching CapsSearching `xml:"searching"`
Categories CapsCategories `xml:"categories"`
Tags string `xml:"tags"`
}
type CapsCategories ¶
type CapsCategories struct {
Categories []Category `xml:"category"`
}
type CapsLimits ¶
type CapsSearch ¶
type CapsSearching ¶
type CapsSearching struct {
Search CapsSearch `xml:"search,omitempty"`
TvSearch CapsSearch `xml:"tv-search,omitempty"`
MovieSearch CapsSearch `xml:"movie-search,omitempty"`
MusicSearch CapsSearch `xml:"music-search,omitempty"`
AudioSearch CapsSearch `xml:"audio-search,omitempty"`
BookSearch CapsSearch `xml:"book-search,omitempty"`
}
type CapsServer ¶
type CapsServer struct {
Title string `xml:"title,attr"`
}
type Category ¶
type Category struct {
ID int `xml:"id,attr"`
Name string `xml:"name,attr"`
Subcat []Subcategory `xml:"subcat"`
}
type Client ¶
type Client interface {
Caps(context.Context) (Caps, error)
Search(context.Context, SearchRequest) (SearchResult, error)
}
type Error ¶
type Error struct {
XMLName xml.Name `xml:"error"`
// Code the Error code.
//
// From https://torznab.github.io/spec-1.3-draft/external/newznab/api.html#newznab-error-codes:
//
// 100 Incorrect user credentials
// 101 Account suspended
// 102 Insufficient privileges/not authorized
// 103 Registration denied
// 104 Registrations are closed
// 105 Invalid registration (Email Address Taken)
// 106 Invalid registration (Email Address Bad Format)
// 107 Registration Failed (Data error)
// 200 Missing parameter
// 201 Incorrect parameter
// 202 No such function. (Function not defined in this specification).
// 203 Function not available. (Optional function is not implemented).
// 300 No such item.
// 300 Item already exists.
// 900 Unknown error
// 910 API Disabled
Code int `xml:"error,attr"`
Description string `xml:"description,attr"`
}
Error represents an error that should be encoded to an XML response according to the Torznab specification.
type SearchRequest ¶
type SearchResult ¶
type SearchResult struct {
XMLName xml.Name `xml:"rss"`
RssVersion rssVersion `xml:"version,attr"`
AtomNs customNs `xml:"xmlns:atom,attr"`
TorznabNs customNs `xml:"xmlns:torznab,attr"`
Channel SearchResultChannel `xml:"channel"`
}
func (SearchResult) Xml ¶
func (r SearchResult) Xml() ([]byte, error)
type SearchResultChannel ¶
type SearchResultChannel struct {
Title string `xml:"title,omitempty"`
Link string `xml:"link,omitempty"`
Description string `xml:"description,omitempty"`
Language string `xml:"language,omitempty"`
PubDate RssDate `xml:"pubDate,omitempty"`
LastBuildDate RssDate `xml:"lastBuildDate,omitempty"`
Docs string `xml:"docs,omitempty"`
Generator string `xml:"generator,omitempty"`
Response SearchResultResponse `xml:"http://www.newznab.com/DTD/2010/feeds/attributes/ response"`
Items []SearchResultItem `xml:"item"`
}
type SearchResultItem ¶
type SearchResultItem struct {
Title string `xml:"title"`
GUID string `xml:"guid,omitempty"`
PubDate RssDate `xml:"pubDate,omitempty"`
Category string `xml:"category,omitempty"`
Link string `xml:"link,omitempty"`
Size uint `xml:"size"`
Description string `xml:"description,omitempty"`
Comments string `xml:"comments,omitempty"`
Enclosure SearchResultItemEnclosure `xml:"enclosure"`
TorznabAttrs []SearchResultItemTorznabAttr `xml:"torznab:attr"`
}
type SearchResultResponse ¶
type Subcategory ¶
Source Files
¶
Click to show internal directories.
Click to hide internal directories.