mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 08:49:13 +00:00
fix(feeds): torznab newznab category parsing (#775)
This commit is contained in:
parent
0d6e23f278
commit
81d494ec5c
5 changed files with 12 additions and 12 deletions
|
@ -168,7 +168,7 @@ func (j *NewznabJob) getFeed(ctx context.Context) ([]newznab.FeedItem, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// only append if we successfully added to cache
|
// only append if we successfully added to cache
|
||||||
items = append(items, i)
|
items = append(items, *i)
|
||||||
}
|
}
|
||||||
|
|
||||||
// send to filters
|
// send to filters
|
||||||
|
|
|
@ -232,7 +232,7 @@ func (j *TorznabJob) getFeed(ctx context.Context) ([]torznab.FeedItem, error) {
|
||||||
}
|
}
|
||||||
|
|
||||||
// only append if we successfully added to cache
|
// only append if we successfully added to cache
|
||||||
items = append(items, i)
|
items = append(items, *i)
|
||||||
}
|
}
|
||||||
|
|
||||||
// send to filters
|
// send to filters
|
||||||
|
|
|
@ -18,13 +18,13 @@ func (f Feed) Len() int {
|
||||||
}
|
}
|
||||||
|
|
||||||
type Channel struct {
|
type Channel struct {
|
||||||
Title string `xml:"title"`
|
Title string `xml:"title"`
|
||||||
Items []FeedItem `xml:"item"`
|
Items []*FeedItem `xml:"item"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type Response struct {
|
type Response struct {
|
||||||
Channel struct {
|
Channel struct {
|
||||||
Items []FeedItem `xml:"item"`
|
Items []*FeedItem `xml:"item"`
|
||||||
} `xml:"channel"`
|
} `xml:"channel"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -63,7 +63,7 @@ type Enclosure struct {
|
||||||
Type string `xml:"type,attr"`
|
Type string `xml:"type,attr"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f FeedItem) MapCategoriesFromAttr() {
|
func (f *FeedItem) MapCategoriesFromAttr() {
|
||||||
for _, attr := range f.Attributes {
|
for _, attr := range f.Attributes {
|
||||||
if attr.Name == "category" {
|
if attr.Name == "category" {
|
||||||
catId, err := strconv.Atoi(attr.Value)
|
catId, err := strconv.Atoi(attr.Value)
|
||||||
|
@ -82,7 +82,7 @@ func (f FeedItem) MapCategoriesFromAttr() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f FeedItem) MapCustomCategoriesFromAttr(categories []Category) {
|
func (f *FeedItem) MapCustomCategoriesFromAttr(categories []Category) {
|
||||||
for _, attr := range f.Attributes {
|
for _, attr := range f.Attributes {
|
||||||
if attr.Name == "category" {
|
if attr.Name == "category" {
|
||||||
catId, err := strconv.Atoi(attr.Value)
|
catId, err := strconv.Atoi(attr.Value)
|
||||||
|
|
|
@ -17,13 +17,13 @@ func (f Feed) Len() int {
|
||||||
}
|
}
|
||||||
|
|
||||||
type Channel struct {
|
type Channel struct {
|
||||||
Title string `xml:"title"`
|
Title string `xml:"title"`
|
||||||
Items []FeedItem `xml:"item"`
|
Items []*FeedItem `xml:"item"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type Response struct {
|
type Response struct {
|
||||||
Channel struct {
|
Channel struct {
|
||||||
Items []FeedItem `xml:"item"`
|
Items []*FeedItem `xml:"item"`
|
||||||
} `xml:"channel"`
|
} `xml:"channel"`
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ type ItemAttr struct {
|
||||||
Value string `xml:"value,attr"`
|
Value string `xml:"value,attr"`
|
||||||
}
|
}
|
||||||
|
|
||||||
func (f FeedItem) MapCategories(categories []Category) {
|
func (f *FeedItem) MapCategories(categories []Category) {
|
||||||
for _, category := range f.Category {
|
for _, category := range f.Category {
|
||||||
// less than 10000 it's default categories
|
// less than 10000 it's default categories
|
||||||
if category < 10000 {
|
if category < 10000 {
|
||||||
|
|
|
@ -241,7 +241,7 @@ func (c *client) GetCaps() *Caps {
|
||||||
return c.Capabilities
|
return c.Capabilities
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *client) Search(ctx context.Context, query string) ([]FeedItem, error) {
|
func (c *client) Search(ctx context.Context, query string) ([]*FeedItem, error) {
|
||||||
v := url.Values{}
|
v := url.Values{}
|
||||||
v.Add("q", query)
|
v.Add("q", query)
|
||||||
params := v.Encode()
|
params := v.Encode()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue