Feature: Lidarr (#15)

* feat(web): add lidarr download client

* feat: add lidarr download client
This commit is contained in:
Ludvig Lundgren 2021-08-22 02:17:13 +02:00 committed by GitHub
parent fce6c7149a
commit e6cfc77e85
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
16 changed files with 582 additions and 15 deletions

View file

@ -4,6 +4,7 @@ import (
"time"
"github.com/autobrr/autobrr/internal/domain"
"github.com/autobrr/autobrr/pkg/lidarr"
"github.com/autobrr/autobrr/pkg/qbittorrent"
"github.com/autobrr/autobrr/pkg/radarr"
"github.com/autobrr/autobrr/pkg/sonarr"
@ -25,6 +26,9 @@ func (s *service) testConnection(client domain.DownloadClient) error {
case domain.DownloadClientTypeSonarr:
return s.testSonarrConnection(client)
case domain.DownloadClientTypeLidarr:
return s.testLidarrConnection(client)
}
return nil
@ -128,3 +132,21 @@ func (s *service) testSonarrConnection(client domain.DownloadClient) error {
return nil
}
func (s *service) testLidarrConnection(client domain.DownloadClient) error {
r := lidarr.New(lidarr.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("lidarr: connection test failed: %v", client.Host)
return err
}
return nil
}