mirror of
https://github.com/idanoo/autobrr
synced 2025-07-22 16:29:12 +00:00
Feature: Sonarr (#14)
* feat: add sonarr download client * feat(web): add sonarr download client and actions * feat: add sonarr to filter actions
This commit is contained in:
parent
455284a94b
commit
fce6c7149a
15 changed files with 594 additions and 5 deletions
|
@ -6,6 +6,7 @@ import (
|
|||
"github.com/autobrr/autobrr/internal/domain"
|
||||
"github.com/autobrr/autobrr/pkg/qbittorrent"
|
||||
"github.com/autobrr/autobrr/pkg/radarr"
|
||||
"github.com/autobrr/autobrr/pkg/sonarr"
|
||||
|
||||
delugeClient "github.com/gdm85/go-libdeluge"
|
||||
"github.com/rs/zerolog/log"
|
||||
|
@ -21,6 +22,9 @@ func (s *service) testConnection(client domain.DownloadClient) error {
|
|||
|
||||
case domain.DownloadClientTypeRadarr:
|
||||
return s.testRadarrConnection(client)
|
||||
|
||||
case domain.DownloadClientTypeSonarr:
|
||||
return s.testSonarrConnection(client)
|
||||
}
|
||||
|
||||
return nil
|
||||
|
@ -106,3 +110,21 @@ func (s *service) testRadarrConnection(client domain.DownloadClient) error {
|
|||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *service) testSonarrConnection(client domain.DownloadClient) error {
|
||||
r := sonarr.New(sonarr.Config{
|
||||
Hostname: client.Host,
|
||||
APIKey: client.Settings.APIKey,
|
||||
BasicAuth: client.Settings.Basic.Auth,
|
||||
Username: client.Settings.Basic.Username,
|
||||
Password: client.Settings.Basic.Password,
|
||||
})
|
||||
|
||||
_, err := r.Test()
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msgf("sonarr: connection test failed: %v", client.Host)
|
||||
return err
|
||||
}
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue