go-newznab: github.com/mrobinsn/go-newznab/newznab Index | Files

package newznab

import "github.com/mrobinsn/go-newznab/newznab"

Index

Package Files

newznab.go structs.go

Constants

const (
    // TV Categories
    // CategoryTVAll is for all shows
    CategoryTVAll = 5000
    // CategoryTVForeign is for foreign shows
    CategoryTVForeign = 5020
    // CategoryTVSD is for standard-definition shows
    CategoryTVSD = 5030
    // CategoryTVHD is for high-definition shows
    CategoryTVHD = 5040
    // CategoryTVUHD is for UHD shows
    CategoryTVUHD = 5045
    // CategoryTVOther is for other shows
    CategoryTVOther = 5050
    // CategoryTVSport is for sports shows
    CategoryTVSport = 5060

    // Movie categories
    // CategoryMovieAll is for all movies
    CategoryMovieAll = 2000
    // CategoryMovieForeign is for foreign movies
    CategoryMovieForeign = 2010
    // CategoryMovieOther is for other movies
    CategoryMovieOther = 2020
    // CategoryMovieSD is for standard-definition movies
    CategoryMovieSD = 2030
    // CategoryMovieHD is for high-definition movies
    CategoryMovieHD = 2040
    // CategoryMovieUHD is for UHD movies
    CategoryMovieUHD = 2045
    // CategoryMovieBluRay is for blu-ray movies
    CategoryMovieBluRay = 2050
    // CategoryMovie3D is for 3-D movies
    CategoryMovie3D = 2060
)

Various constants for categories

type Capabilities Uses

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 []struct {
            ID     string `xml:"id,attr" json:"id,omitempty"`
            Name   string `xml:"name,attr" json:"name,omitempty"`
            Subcat []struct {
                ID   string `xml:"id,attr" json:"id,omitempty"`
                Name string `xml:"name,attr" json:"name,omitempty"`
            }   `xml:"subcat" json:"subcat,omitempty"`
        } `xml:"category" json:"category,omitempty"`
    }   `xml:"categories" json:"categories,omitempty"`
}

type Client Uses

type Client struct {
    // contains filtered or unexported fields
}

Client is a type for interacting with a newznab or torznab api

func New Uses

func New(baseURL string, apikey string, userID int, insecure bool) Client

New returns a new instance of Client

func (Client) Capabilities Uses

func (c Client) Capabilities() (Capabilities, error)

Capabilities returns the capabilities of this tracker

func (Client) DownloadNZB Uses

func (c Client) DownloadNZB(nzb NZB) ([]byte, error)

DownloadNZB returns the bytes of the actual NZB file for the given NZB

func (Client) LoadRSSFeed Uses

func (c Client) LoadRSSFeed(categories []int, num int) ([]NZB, error)

LoadRSSFeed returns up to <num> of the most recent NZBs of the given categories.

func (Client) LoadRSSFeedUntilNZBID Uses

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 Uses

func (c Client) NZBDownloadURL(nzb NZB) (string, error)

NZBDownloadURL returns a URL to download the NZB from

func (Client) PopulateComments Uses

func (c Client) PopulateComments(nzb *NZB) error

PopulateComments fills in the Comments for the given NZB

func (Client) SearchWithIMDB Uses

func (c Client) SearchWithIMDB(categories []int, imdbID string) ([]NZB, error)

SearchWithIMDB returns NZBs for the given parameters

func (Client) SearchWithQuery Uses

func (c Client) SearchWithQuery(categories []int, query string, searchType string) ([]NZB, error)

SearchWithQuery returns NZBs for the given parameters

func (Client) SearchWithTVDB Uses

func (c Client) SearchWithTVDB(categories []int, tvDBID int, season int, episode int) ([]NZB, error)

SearchWithTVDB returns NZBs for the given parameters

func (Client) SearchWithTVMaze Uses

func (c Client) SearchWithTVMaze(categories []int, tvMazeID int, season int, episode int) ([]NZB, error)

SearchWithTVMaze returns NZBs for the given parameters

func (Client) SearchWithTVRage Uses

func (c Client) SearchWithTVRage(categories []int, tvRageID int, season int, episode int) ([]NZB, error)

SearchWithTVRage returns NZBs for the given parameters

type Comment Uses

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 Uses

func (c Comment) JSONString() string

JSONString returns a JSON string representation of this Comment

type NZB Uses

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"`

    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"`

    Resolution string `json:"resolution,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"`
    CoverURL  string  `json:"coverurl,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 Uses

func (n NZB) JSONString() string

JSONString returns a JSON string representation of this NZB

type RawNZB Uses

type RawNZB struct {
    Title    string `xml:"title,omitempty"`
    Link     string `xml:"link,omitempty"`
    Size     int64  `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 Uses

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.

type Time Uses

type Time struct {
    time.Time
}

func (*Time) MarshalXML Uses

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

func (*Time) UnmarshalXML Uses

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

Package newznab imports 11 packages (graph). Updated 2019-04-09. Refresh now. Tools for package owners.