autobrr/internal/domain/feed.go
ze0s b50688159e
feat(feeds): add generic RSS support (#410)
* feat(feeds): add generic rss support

* feat(feeds/web): add generic rss support

* implement rss downloading

* gosum + mod

* re-add size from Custom field.

* implement uploader + category

* sync

* remove double assignment (+torznab)

* didn't save the rss file >.>

* cleanup

* fixfeeds): create rss indexer

* fix(feeds): stop feed

* feat(feeds): support nexusphp rss enclosure link

* feat(feeds): check size for custom size

* fix(feeds): race condition and only stop enabled feeds

* fix(feeds): unify indexer implementation badge

Co-authored-by: Kyle Sanderson <kyle.leet@gmail.com>
2022-08-20 00:34:46 +02:00

54 lines
1.7 KiB
Go

package domain
import (
"context"
"time"
)
type FeedCacheRepo interface {
Get(bucket string, key string) ([]byte, 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
DeleteBucket(ctx context.Context, bucket string) error
}
type FeedRepo interface {
FindByID(ctx context.Context, id int) (*Feed, error)
FindByIndexerIdentifier(ctx context.Context, indexer string) (*Feed, error)
Find(ctx context.Context) ([]Feed, error)
Store(ctx context.Context, feed *Feed) error
Update(ctx context.Context, feed *Feed) error
ToggleEnabled(ctx context.Context, id int, enabled bool) error
Delete(ctx context.Context, id int) error
}
type Feed struct {
ID int `json:"id"`
Name string `json:"name"`
Indexer string `json:"indexer"`
Type string `json:"type"`
Enabled bool `json:"enabled"`
URL string `json:"url"`
Interval int `json:"interval"`
Capabilities []string `json:"capabilities"`
ApiKey string `json:"api_key"`
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:"-"`
}
type FeedIndexer struct {
ID int `json:"id"`
Name string `json:"name"`
Identifier string `json:"identifier"`
}
type FeedType string
const (
FeedTypeTorznab FeedType = "TORZNAB"
FeedTypeRSS FeedType = "RSS"
)