rss: use filters hash relative to its own pvrs
This commit is contained in:
@@ -30,7 +30,7 @@ func (c *Client) AddJob(feed feedItem) error {
|
||||
cron: c.cron,
|
||||
cache: c.cache,
|
||||
cacheDuration: feed.CacheDuration,
|
||||
cacheFiltersHash: c.cacheFiltersHash,
|
||||
cacheFiltersHash: "",
|
||||
}
|
||||
|
||||
// add pvrs
|
||||
@@ -40,6 +40,7 @@ func (c *Client) AddJob(feed feedItem) error {
|
||||
return fmt.Errorf("pvr object does not exist: %v", p)
|
||||
}
|
||||
job.pvrs[p] = po
|
||||
job.cacheFiltersHash += po.GetFiltersHash()
|
||||
}
|
||||
|
||||
// schedule job
|
||||
|
||||
@@ -5,7 +5,6 @@ import (
|
||||
"fmt"
|
||||
"github.com/l3uddz/nabarr/media"
|
||||
"github.com/lucperkins/rek"
|
||||
"sort"
|
||||
"strings"
|
||||
"time"
|
||||
)
|
||||
@@ -72,11 +71,6 @@ func (j *rssJob) getFeed() ([]media.FeedItem, error) {
|
||||
return items, nil
|
||||
}
|
||||
|
||||
// sort response items
|
||||
sort.SliceStable(b.Channel.Items, func(i, j int) bool {
|
||||
return b.Channel.Items[i].PubDate.After(b.Channel.Items[j].PubDate.Time)
|
||||
})
|
||||
|
||||
// process feed items
|
||||
for p, i := range b.Channel.Items {
|
||||
// ignore items
|
||||
|
||||
14
rss/rss.go
14
rss/rss.go
@@ -11,22 +11,20 @@ import (
|
||||
)
|
||||
|
||||
type Client struct {
|
||||
cron *cron.Cron
|
||||
cache *cache.Client
|
||||
cacheFiltersHash string
|
||||
pvrs map[string]pvr.PVR
|
||||
cron *cron.Cron
|
||||
cache *cache.Client
|
||||
pvrs map[string]pvr.PVR
|
||||
|
||||
log zerolog.Logger
|
||||
}
|
||||
|
||||
func New(c Config, cc *cache.Client, cfh string, pvrs map[string]pvr.PVR) *Client {
|
||||
func New(c Config, cc *cache.Client, pvrs map[string]pvr.PVR) *Client {
|
||||
return &Client{
|
||||
cron: cron.New(cron.WithChain(
|
||||
cron.Recover(cron.DefaultLogger),
|
||||
)),
|
||||
cache: cc,
|
||||
cacheFiltersHash: cfh,
|
||||
pvrs: pvrs,
|
||||
cache: cc,
|
||||
pvrs: pvrs,
|
||||
|
||||
log: logger.New(c.Verbosity).With().Logger(),
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user