mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 08:49:13 +00:00
feat: add usenet support (#543)
* feat(autobrr): implement usenet support * feat(sonarr): implement usenet support * feat(radarr): implement usenet support * feat(announce): implement usenet support * announce: cast a line * feat(release): prevent unknown protocol transfer * release: lines for days. * feat: add newznab and sabnzbd support * feat: add category to sabnzbd * feat(newznab): map categories * feat(newznab): map categories --------- Co-authored-by: ze0s <43699394+zze0s@users.noreply.github.com> Co-authored-by: ze0s <ze0s@riseup.net>
This commit is contained in:
parent
b2d93d50c5
commit
13a74f7cc8
29 changed files with 1588 additions and 37 deletions
|
@ -89,6 +89,7 @@ const (
|
|||
ActionTypeLidarr ActionType = "LIDARR"
|
||||
ActionTypeWhisparr ActionType = "WHISPARR"
|
||||
ActionTypeReadarr ActionType = "READARR"
|
||||
ActionTypeSabnzbd ActionType = "SABNZBD"
|
||||
)
|
||||
|
||||
type ActionContentLayout string
|
||||
|
|
|
@ -79,6 +79,7 @@ const (
|
|||
DownloadClientTypeLidarr DownloadClientType = "LIDARR"
|
||||
DownloadClientTypeWhisparr DownloadClientType = "WHISPARR"
|
||||
DownloadClientTypeReadarr DownloadClientType = "READARR"
|
||||
DownloadClientTypeSabnzbd DownloadClientType = "SABNZBD"
|
||||
)
|
||||
|
||||
// Validate basic validation of client
|
||||
|
|
|
@ -64,6 +64,7 @@ type FeedType string
|
|||
|
||||
const (
|
||||
FeedTypeTorznab FeedType = "TORZNAB"
|
||||
FeedTypeNewznab FeedType = "NEWZNAB"
|
||||
FeedTypeRSS FeedType = "RSS"
|
||||
)
|
||||
|
||||
|
|
|
@ -48,9 +48,37 @@ type IndexerDefinition struct {
|
|||
SettingsMap map[string]string `json:"-"`
|
||||
IRC *IndexerIRC `json:"irc,omitempty"`
|
||||
Torznab *Torznab `json:"torznab,omitempty"`
|
||||
Newznab *Newznab `json:"newznab,omitempty"`
|
||||
RSS *FeedSettings `json:"rss,omitempty"`
|
||||
}
|
||||
|
||||
type IndexerImplementation string
|
||||
|
||||
const (
|
||||
IndexerImplementationIRC IndexerImplementation = "irc"
|
||||
IndexerImplementationTorznab IndexerImplementation = "torznab"
|
||||
IndexerImplementationNewznab IndexerImplementation = "newznab"
|
||||
IndexerImplementationRSS IndexerImplementation = "rss"
|
||||
IndexerImplementationLegacy IndexerImplementation = ""
|
||||
)
|
||||
|
||||
func (i IndexerImplementation) String() string {
|
||||
switch i {
|
||||
case IndexerImplementationIRC:
|
||||
return "irc"
|
||||
case IndexerImplementationTorznab:
|
||||
return "torznab"
|
||||
case IndexerImplementationNewznab:
|
||||
return "newznab"
|
||||
case IndexerImplementationRSS:
|
||||
return "rss"
|
||||
case IndexerImplementationLegacy:
|
||||
return ""
|
||||
}
|
||||
|
||||
return ""
|
||||
}
|
||||
|
||||
func (i IndexerDefinition) HasApi() bool {
|
||||
for _, a := range i.Supports {
|
||||
if a == "api" {
|
||||
|
@ -77,6 +105,7 @@ type IndexerDefinitionCustom struct {
|
|||
SettingsMap map[string]string `json:"-"`
|
||||
IRC *IndexerIRC `json:"irc,omitempty"`
|
||||
Torznab *Torznab `json:"torznab,omitempty"`
|
||||
Newznab *Newznab `json:"newznab,omitempty"`
|
||||
RSS *FeedSettings `json:"rss,omitempty"`
|
||||
Parse *IndexerIRCParse `json:"parse,omitempty"`
|
||||
}
|
||||
|
@ -99,6 +128,7 @@ func (i *IndexerDefinitionCustom) ToIndexerDefinition() *IndexerDefinition {
|
|||
SettingsMap: i.SettingsMap,
|
||||
IRC: i.IRC,
|
||||
Torznab: i.Torznab,
|
||||
Newznab: i.Newznab,
|
||||
RSS: i.RSS,
|
||||
}
|
||||
|
||||
|
@ -126,6 +156,11 @@ type Torznab struct {
|
|||
Settings []IndexerSetting `json:"settings"`
|
||||
}
|
||||
|
||||
type Newznab struct {
|
||||
MinInterval int `json:"minInterval"`
|
||||
Settings []IndexerSetting `json:"settings"`
|
||||
}
|
||||
|
||||
type FeedSettings struct {
|
||||
MinInterval int `json:"minInterval"`
|
||||
Settings []IndexerSetting `json:"settings"`
|
||||
|
|
|
@ -154,16 +154,44 @@ type ReleaseProtocol string
|
|||
|
||||
const (
|
||||
ReleaseProtocolTorrent ReleaseProtocol = "torrent"
|
||||
ReleaseProtocolNzb ReleaseProtocol = "nzb"
|
||||
)
|
||||
|
||||
func (r ReleaseProtocol) String() string {
|
||||
switch r {
|
||||
case ReleaseProtocolTorrent:
|
||||
return "torrent"
|
||||
case ReleaseProtocolNzb:
|
||||
return "nzb"
|
||||
default:
|
||||
return "torrent"
|
||||
}
|
||||
}
|
||||
|
||||
type ReleaseImplementation string
|
||||
|
||||
const (
|
||||
ReleaseImplementationIRC ReleaseImplementation = "IRC"
|
||||
ReleaseImplementationTorznab ReleaseImplementation = "TORZNAB"
|
||||
ReleaseImplementationNewznab ReleaseImplementation = "NEWZNAB"
|
||||
ReleaseImplementationRSS ReleaseImplementation = "RSS"
|
||||
)
|
||||
|
||||
func (r ReleaseImplementation) String() string {
|
||||
switch r {
|
||||
case ReleaseImplementationIRC:
|
||||
return "IRC"
|
||||
case ReleaseImplementationTorznab:
|
||||
return "TORZNAB"
|
||||
case ReleaseImplementationNewznab:
|
||||
return "NEWZNAB"
|
||||
case ReleaseImplementationRSS:
|
||||
return "RSS"
|
||||
default:
|
||||
return "IRC"
|
||||
}
|
||||
}
|
||||
|
||||
type ReleaseQueryParams struct {
|
||||
Limit uint64
|
||||
Offset uint64
|
||||
|
@ -291,7 +319,9 @@ func (r *Release) DownloadTorrentFile() error {
|
|||
}
|
||||
|
||||
func (r *Release) downloadTorrentFile(ctx context.Context) error {
|
||||
if r.HasMagnetUri() {
|
||||
if r.Protocol != ReleaseProtocolTorrent {
|
||||
return errors.New("download_file: protocol is not %s: %s", ReleaseProtocolTorrent, r.Protocol)
|
||||
} else if r.HasMagnetUri() {
|
||||
return fmt.Errorf("error trying to download magnet link: %s", r.MagnetURI)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue