mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 08:49:13 +00:00
feat(feeds): improve RSS (#502)
* feat(feeds): improve rss * save last_run time * remove interval check * refactor feed job keys * add rss test * add max_age check * feat(feeds): rss basic freeleech parsing * feat(feeds): rss cookie support * feat(feeds): db get max_age * feat(feeds): update log messages * feat(feeds): pass cookie to release for download * feat(feeds): improve size parsing * feat(feeds): improve datetime check
This commit is contained in:
parent
ac988f28f4
commit
e2bb14afa4
15 changed files with 741 additions and 209 deletions
|
@ -7,6 +7,8 @@ import (
|
|||
|
||||
type FeedCacheRepo interface {
|
||||
Get(bucket string, key string) ([]byte, error)
|
||||
GetByBucket(ctx context.Context, bucket string) ([]FeedCacheItem, error)
|
||||
GetCountByBucket(ctx context.Context, bucket string) (int, error)
|
||||
Exists(bucket string, key string) (bool, error)
|
||||
Put(bucket string, key string, val []byte, ttl time.Time) error
|
||||
Delete(ctx context.Context, bucket string, key string) error
|
||||
|
@ -19,6 +21,8 @@ type FeedRepo interface {
|
|||
Find(ctx context.Context) ([]Feed, error)
|
||||
Store(ctx context.Context, feed *Feed) error
|
||||
Update(ctx context.Context, feed *Feed) error
|
||||
UpdateLastRun(ctx context.Context, feedID int) error
|
||||
UpdateLastRunWithData(ctx context.Context, feedID int, data string) error
|
||||
ToggleEnabled(ctx context.Context, id int, enabled bool) error
|
||||
Delete(ctx context.Context, id int) error
|
||||
}
|
||||
|
@ -31,14 +35,18 @@ type Feed struct {
|
|||
Enabled bool `json:"enabled"`
|
||||
URL string `json:"url"`
|
||||
Interval int `json:"interval"`
|
||||
Timeout int `json:"timeout"`
|
||||
Timeout int `json:"timeout"` // seconds
|
||||
MaxAge int `json:"max_age"` // seconds
|
||||
Capabilities []string `json:"capabilities"`
|
||||
ApiKey string `json:"api_key"`
|
||||
Cookie string `json:"cookie"`
|
||||
Settings map[string]string `json:"settings"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
IndexerID int `json:"indexer_id,omitempty"`
|
||||
Indexerr FeedIndexer `json:"-"`
|
||||
LastRun time.Time `json:"last_run"`
|
||||
LastRunData string `json:"last_run_data"`
|
||||
}
|
||||
|
||||
type FeedIndexer struct {
|
||||
|
@ -53,3 +61,10 @@ const (
|
|||
FeedTypeTorznab FeedType = "TORZNAB"
|
||||
FeedTypeRSS FeedType = "RSS"
|
||||
)
|
||||
|
||||
type FeedCacheItem struct {
|
||||
Bucket string `json:"bucket"`
|
||||
Key string `json:"key"`
|
||||
Value []byte `json:"value"`
|
||||
TTL time.Time `json:"ttl"`
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue