torznab

package
v1.43.0 Latest Latest
Warning

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

Go to latest
Published: Jun 18, 2024 License: GPL-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

View Source
const (
	CustomCategoryOffset = 100000
)

Variables

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

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

Functions

This section is empty.

Types

type BasicAuth

type BasicAuth struct {
	Username string
	Password string
}

type CapCategories

type CapCategories struct {
	Categories []Category `xml:"category"`
}

type CapCategory

type CapCategory struct {
	ID            string        `xml:"id,attr"`
	Name          string        `xml:"name,attr"`
	SubCategories []CapCategory `xml:"subcat"`
}

type Capabilities

type Capabilities struct {
	Search     Searching
	Categories Categories
}

type Caps

type Caps struct {
	XMLName      xml.Name      `xml:"caps"`
	Server       Server        `xml:"server"`
	Limits       Limits        `xml:"limits"`
	Retention    Retention     `xml:"retention"`
	Registration Registration  `xml:"registration"`
	Searching    Searching     `xml:"searching"`
	Categories   CapCategories `xml:"categories"`
	Groups       Groups        `xml:"groups"`
	Genres       Genres        `xml:"genres"`
	Tags         Tags          `xml:"tags"`
}

type CapsResponse

type CapsResponse struct {
	Caps Caps `xml:"caps"`
}

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        `xml:"id,attr"`
	Name          string     `xml:"name,attr"`
	SubCategories []Category `xml:"subcat"`
}

func ParentCategory

func ParentCategory(c Category) Category

func (Category) FromString

func (c Category) FromString(str string)

func (Category) String

func (c Category) String() string

type Channel

type Channel struct {
	Title string      `xml:"title"`
	Items []*FeedItem `xml:"item"`
}

type Client

type Client interface {
	FetchFeed(ctx context.Context) (*Feed, error)
	FetchCaps(ctx context.Context) (*Caps, error)
	GetCaps() *Caps
}

func NewClient

func NewClient(config Config) Client

type Config

type Config struct {
	Host    string
	ApiKey  string
	Timeout time.Duration

	UseBasicAuth bool
	BasicAuth    BasicAuth

	Log *log.Logger
}

type Feed

type Feed struct {
	Channel Channel `xml:"channel"`
	Raw     string
}

func (Feed) Len

func (f Feed) Len() int

type FeedItem

type FeedItem struct {
	Title           string `xml:"title,omitempty"`
	GUID            string `xml:"guid,omitempty"`
	PubDate         Time   `xml:"pubDate,omitempty"`
	Prowlarrindexer struct {
		Text string `xml:",chardata"`
		ID   string `xml:"id,attr"`
	} `xml:"prowlarrindexer"`
	Comments   string `xml:"comments"`
	Size       string `xml:"size"`
	Link       string `xml:"link"`
	Category   []int  `xml:"category,omitempty"`
	Categories Categories

	// attributes
	TvdbId string `xml:"tvdb,omitempty"`
	//TvMazeId string
	ImdbId string `xml:"imdb,omitempty"`
	TmdbId string `xml:"tmdb,omitempty"`

	Attributes []ItemAttr `xml:"attr"`
}

func (*FeedItem) MapCategories

func (f *FeedItem) MapCategories(categories []Category)

type Genre

type Genre struct {
	ID         string `xml:"id,attr"`
	Categoryid string `xml:"categoryid,attr"`
	Name       string `xml:"name,attr"`
}

type Genres

type Genres struct {
	Genre Genre `xml:"genre"`
}

type Group

type Group struct {
	ID          string `xml:"id,attr"`
	Name        string `xml:"name,attr"`
	Description string `xml:"description,attr"`
	Lastupdate  string `xml:"lastupdate,attr"`
}

type Groups

type Groups struct {
	Group Group `xml:"group"`
}

type ItemAttr

type ItemAttr struct {
	Name  string `xml:"name,attr"`
	Value string `xml:"value,attr"`
}

type Limits

type Limits struct {
	Max     string `xml:"max,attr"`
	Default string `xml:"default,attr"`
}

type Registration

type Registration struct {
	Available string `xml:"available,attr"`
	Open      string `xml:"open,attr"`
}

type Response

type Response struct {
	Channel struct {
		Items []*FeedItem `xml:"item"`
	} `xml:"channel"`
}

type Retention

type Retention struct {
	Days string `xml:"days,attr"`
}
type Search struct {
	Available       string `xml:"available,attr"`
	SupportedParams string `xml:"supportedParams,attr"`
}

type Searching

type Searching struct {
	Search      Search `xml:"search"`
	TvSearch    Search `xml:"tv-search"`
	MovieSearch Search `xml:"movie-search"`
	AudioSearch Search `xml:"audio-search"`
	BookSearch  Search `xml:"book-search"`
}

type Server

type Server struct {
	Version   string `xml:"version,attr"`
	Title     string `xml:"title,attr"`
	Strapline string `xml:"strapline,attr"`
	Email     string `xml:"email,attr"`
	URL       string `xml:"url,attr"`
	Image     string `xml:"image,attr"`
}

type Tag

type Tag struct {
	Name        string `xml:"name,attr"`
	Description string `xml:"description,attr"`
}

type Tags

type Tags struct {
	Tag []Tag `xml:"tag"`
}

type Time

type Time struct {
	time.Time
}

Time credits: https://github.com/mrobinsn/go-newznab/blob/cd89d9c56447859fa1298dc9a0053c92c45ac7ef/newznab/structs.go#L150

func (*Time) MarshalXML

func (t *Time) MarshalXML(e *xml.Encoder, start xml.StartElement) error

func (*Time) UnmarshalXML

func (t *Time) UnmarshalXML(d *xml.Decoder, start xml.StartElement) error

Jump to

Keyboard shortcuts

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