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:
Kyle Sanderson 2023-03-04 11:27:18 -08:00 committed by GitHub
parent b2d93d50c5
commit 13a74f7cc8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
29 changed files with 1588 additions and 37 deletions

View file

@ -10,6 +10,7 @@ import (
"github.com/autobrr/autobrr/pkg/porla"
"github.com/autobrr/autobrr/pkg/radarr"
"github.com/autobrr/autobrr/pkg/readarr"
"github.com/autobrr/autobrr/pkg/sabnzbd"
"github.com/autobrr/autobrr/pkg/sonarr"
"github.com/autobrr/autobrr/pkg/whisparr"
"github.com/autobrr/go-qbittorrent"
@ -51,6 +52,9 @@ func (s *service) testConnection(ctx context.Context, client domain.DownloadClie
case domain.DownloadClientTypeReadarr:
return s.testReadarrConnection(ctx, client)
case domain.DownloadClientTypeSabnzbd:
return s.testSabnzbdConnection(ctx, client)
default:
return errors.New("unsupported client")
}
@ -285,3 +289,23 @@ func (s *service) testPorlaConnection(client domain.DownloadClient) error {
return nil
}
func (s *service) testSabnzbdConnection(ctx context.Context, client domain.DownloadClient) error {
opts := sabnzbd.Options{
Addr: client.Host,
ApiKey: client.Settings.APIKey,
BasicUser: client.Settings.Basic.Username,
BasicPass: client.Settings.Basic.Password,
Log: nil,
}
sab := sabnzbd.New(opts)
version, err := sab.Version(ctx)
if err != nil {
return errors.Wrap(err, "error getting version from sabnzbd")
}
s.log.Debug().Msgf("test client connection for sabnzbd: success got version: %s", version.Version)
return nil
}