2021-02-14 16:18:26 +00:00
|
|
|
package rss
|
|
|
|
|
|
|
|
|
|
import (
|
2022-04-01 20:42:05 +01:00
|
|
|
"net/http"
|
|
|
|
|
"time"
|
|
|
|
|
|
2021-02-14 16:18:26 +00:00
|
|
|
"github.com/robfig/cron/v3"
|
|
|
|
|
"github.com/rs/zerolog"
|
2022-04-14 16:18:06 +01:00
|
|
|
|
|
|
|
|
"github.com/l3uddz/nabarr/cache"
|
|
|
|
|
"github.com/l3uddz/nabarr/cmd/nabarr/pvr"
|
2026-03-03 16:53:54 +00:00
|
|
|
"github.com/l3uddz/nabarr/media"
|
2021-02-14 16:18:26 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
type feedItem struct {
|
|
|
|
|
Name string `yaml:"name"`
|
|
|
|
|
URL string `yaml:"url"`
|
|
|
|
|
Cron string `yaml:"cron"`
|
|
|
|
|
CacheDuration time.Duration `yaml:"cache_duration"`
|
|
|
|
|
Pvrs []string `yaml:"pvrs"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type Config struct {
|
|
|
|
|
Feeds []feedItem `yaml:"feeds"`
|
|
|
|
|
|
|
|
|
|
Verbosity string `yaml:"verbosity,omitempty"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type rssJob struct {
|
2026-03-03 16:53:54 +00:00
|
|
|
name string
|
|
|
|
|
log zerolog.Logger
|
|
|
|
|
http *http.Client
|
|
|
|
|
mediaClient *media.Client
|
2021-02-21 14:01:21 +00:00
|
|
|
|
|
|
|
|
url string
|
|
|
|
|
pvrs map[string]pvr.PVR
|
2021-02-14 16:18:26 +00:00
|
|
|
|
|
|
|
|
attempts int
|
|
|
|
|
errors []error
|
|
|
|
|
|
|
|
|
|
cron *cron.Cron
|
|
|
|
|
cache *cache.Client
|
|
|
|
|
cacheDuration time.Duration
|
|
|
|
|
cacheFiltersHash string
|
|
|
|
|
jobID cron.EntryID
|
|
|
|
|
}
|