torznab

package
v1.8.1 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2016 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CustomCategoryOffset = 100000
)

Variables

View Source
var (
	CategoryOther              = Category{0, "Other"}
	CategoryOther_Misc         = Category{10, "Other/Misc"}
	CategoryOther_Hashed       = Category{20, "Other/Hashed"}
	CategoryConsole            = Category{1000, "Console"}
	CategoryConsole_NDS        = Category{1010, "Console/NDS"}
	CategoryConsole_PSP        = Category{1020, "Console/PSP"}
	CategoryConsole_Wii        = Category{1030, "Console/Wii"}
	CategoryConsole_XBOX       = Category{1040, "Console/Xbox"}
	CategoryConsole_XBOX360    = Category{1050, "Console/Xbox360"}
	CategoryConsole_WiiwareVC  = Category{1060, "Console/Wiiware/V"}
	CategoryConsole_XBOX360DLC = Category{1070, "Console/Xbox360"}
	CategoryConsole_PS3        = Category{1080, "Console/PS3"}
	CategoryConsole_Other      = Category{1999, "Console/Other"}
	CategoryConsole_3DS        = Category{1110, "Console/3DS"}
	CategoryConsole_PSVita     = Category{1120, "Console/PS Vita"}
	CategoryConsole_WiiU       = Category{1130, "Console/WiiU"}
	CategoryConsole_XBOXOne    = Category{1140, "Console/XboxOne"}
	CategoryConsole_PS4        = Category{1180, "Console/PS4"}
	CategoryMovies             = Category{2000, "Movies"}
	CategoryMovies_Foreign     = Category{2010, "Movies/Foreign"}
	CategoryMovies_Other       = Category{2020, "Movies/Other"}
	CategoryMovies_SD          = Category{2030, "Movies/SD"}
	CategoryMovies_HD          = Category{2040, "Movies/HD"}
	CategoryMovies_3D          = Category{2050, "Movies/3D"}
	CategoryMovies_BluRay      = Category{2060, "Movies/BluRay"}
	CategoryMovies_DVD         = Category{2070, "Movies/DVD"}
	CategoryMovies_WEBDL       = Category{2080, "Movies/WEBDL"}
	CategoryAudio              = Category{3000, "Audio"}
	CategoryAudio_MP3          = Category{3010, "Audio/MP3"}
	CategoryAudio_Video        = Category{3020, "Audio/Video"}
	CategoryAudio_Audiobook    = Category{3030, "Audio/Audiobook"}
	CategoryAudio_Lossless     = Category{3040, "Audio/Lossless"}
	CategoryAudio_Other        = Category{3999, "Audio/Other"}
	CategoryAudio_Foreign      = Category{3060, "Audio/Foreign"}
	CategoryPC                 = Category{4000, "PC"}
	CategoryPC_0day            = Category{4010, "PC/0day"}
	CategoryPC_ISO             = Category{4020, "PC/ISO"}
	CategoryPC_Mac             = Category{4030, "PC/Mac"}
	CategoryPC_PhoneOther      = Category{4040, "PC/Phone-Other"}
	CategoryPC_Games           = Category{4050, "PC/Games"}
	CategoryPC_PhoneIOS        = Category{4060, "PC/Phone-IOS"}
	CategoryPC_PhoneAndroid    = Category{4070, "PC/Phone-Android"}
	CategoryTV                 = Category{5000, "TV"}
	CategoryTV_WEBDL           = Category{5010, "TV/WEB-DL"}
	CategoryTV_FOREIGN         = Category{5020, "TV/Foreign"}
	CategoryTV_SD              = Category{5030, "TV/SD"}
	CategoryTV_HD              = Category{5040, "TV/HD"}
	CategoryTV_Other           = Category{5999, "TV/Other"}
	CategoryTV_Sport           = Category{5060, "TV/Sport"}
	CategoryTV_Anime           = Category{5070, "TV/Anime"}
	CategoryTV_Documentary     = Category{5080, "TV/Documentary"}
	CategoryXXX                = Category{6000, "XXX"}
	CategoryXXX_DVD            = Category{6010, "XXX/DVD"}
	CategoryXXX_WMV            = Category{6020, "XXX/WMV"}
	CategoryXXX_XviD           = Category{6030, "XXX/XviD"}
	CategoryXXX_x264           = Category{6040, "XXX/x264"}
	CategoryXXX_Other          = Category{6999, "XXX/Other"}
	CategoryXXX_Imageset       = Category{6060, "XXX/Imageset"}
	CategoryXXX_Packs          = Category{6070, "XXX/Packs"}
	CategoryBooks              = Category{7000, "Books"}
	CategoryBooks_Magazines    = Category{7010, "Books/Magazines"}
	CategoryBooks_Ebook        = Category{7020, "Books/Ebook"}
	CategoryBooks_Comics       = Category{7030, "Books/Comics"}
	CategoryBooks_Technical    = Category{7040, "Books/Technical"}
	CategoryBooks_Foreign      = Category{7060, "Books/Foreign"}
	CategoryBooks_Unknown      = Category{7999, "Books/Unknown"}
)

Categories from the Newznab spec https://github.com/nZEDb/nZEDb/blob/0.x/docs/newznab_api_specification.txt#L627

View Source
var (
	ErrIncorrectUserCreds     = err{100, "Incorrect user credentials"}
	ErrAccountSuspended       = err{101, "Account suspended"}
	ErrInsufficientPrivs      = err{102, "Insufficient privileges/not authorized"}
	ErrRegistrationDenied     = err{103, "Registration denied"}
	ErrRegistrationsAreClosed = err{104, "Registrations are closed"}
	ErrEmailAddressTaken      = err{105, "Invalid registration (Email Address Taken)"}
	ErrEmailAddressBadFormat  = err{106, "Invalid registration (Email Address Bad Format)"}
	ErrRegistrationFailed     = err{107, "Registration Failed (Data error)"}
	ErrMissingParameter       = err{200, "Missing parameter"}
	ErrIncorrectParameter     = err{201, "Incorrect parameter"}
	ErrNoSuchFunction         = err{202, "No such function. (Function not defined in this specification)."}
	ErrFunctionNotAvailable   = err{203, "Function not available. (Optional function is not implemented)."}
	ErrNoSuchItem             = err{300, "No such item."}
	ErrItemAlreadyExists      = err{300, "Item already exists."}
	ErrUnknownError           = err{900, "Unknown error"}
	ErrAPIDisabled            = err{910, "API Disabled"}
)

Functions

func Error

func Error(w http.ResponseWriter, description string, err err)

Types

type Capabilities

type Capabilities struct {
	SearchModes []SearchMode
	Categories  Categories
}

func (Capabilities) HasSearchMode

func (c Capabilities) HasSearchMode(key string) (bool, []string)

func (Capabilities) MarshalXML

func (c Capabilities) MarshalXML(e *xml.Encoder, start xml.StartElement) error

func (Capabilities) ServeHTTP

func (c Capabilities) ServeHTTP(w http.ResponseWriter, r *http.Request)

type Categories

type Categories []Category

func (Categories) Len

func (slice Categories) Len() int

func (Categories) Less

func (slice Categories) Less(i, j int) bool

func (Categories) Subset

func (slice Categories) Subset(ids ...int) Categories

func (Categories) Swap

func (slice Categories) Swap(i, j int)

type Category

type Category struct {
	ID   int
	Name string
}

func ParentCategory

func ParentCategory(c Category) Category

func (Category) String

func (c Category) String() string

type Indexer

type Indexer interface {
	Info() Info
	Search(query Query) ([]ResultItem, error)
	Download(urlStr string) (io.ReadCloser, http.Header, error)
	Capabilities() Capabilities
}

type Info

type Info struct {
	ID          string
	Title       string
	Description string
	Link        string
	Language    string
	Category    string
}

type Query

type Query struct {
	Type          string
	Q, Ep, Season string
	Limit, Offset int
	Extended      bool
	Categories    []int
	APIKey        string
}

Query represents a torznab query

func ParseQuery

func ParseQuery(v url.Values) (Query, error)

ParseQuery takes the query string parameters for a torznab query and parses them

func (Query) Encode added in v1.4.0

func (query Query) Encode() string

Encode returns the query as a url query string

func (Query) Episode

func (query Query) Episode() (s string)

Episode returns either the season + episode in the format S00E00 or just the season as S00 if no episode has been specified.

func (Query) Keywords

func (query Query) Keywords() string

Keywords returns the query formatted as search keywords

func (Query) String added in v1.4.0

func (query Query) String() string

type ResultFeed

type ResultFeed struct {
	Info  Info
	Items []ResultItem
}

func (ResultFeed) MarshalXML

func (rf ResultFeed) MarshalXML(e *xml.Encoder, start xml.StartElement) error

type ResultItem

type ResultItem struct {
	Site        string
	Title       string
	Description string
	GUID        string
	Comments    string
	Link        string
	Category    int
	Size        uint64
	PublishDate time.Time

	Seeders         int
	Peers           int
	MinimumRatio    float64
	MinimumSeedTime time.Duration
}

func (ResultItem) MarshalXML

func (ri ResultItem) MarshalXML(e *xml.Encoder, start xml.StartElement) error

type SearchMode

type SearchMode struct {
	Key             string
	Available       bool
	SupportedParams []string
}

Jump to

Keyboard shortcuts

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