mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 00:39:13 +00:00
feat(download-client): add support for Porla (#553)
* Add support for the 'Test' button to work * Make Porla show up in filter actions select * Add an empty Porla action * Make Porla action find download client * Make implementation actually add torrent to Porla * Fix qBittorrent import * Finish up Porla action * Check length on commitish before slicing * Move Porla to the other DL clients * Add Porla to type name map * Move Porla to beneath the other download clients
This commit is contained in:
parent
b95c1e6913
commit
870e109f6c
12 changed files with 271 additions and 2 deletions
|
@ -7,6 +7,7 @@ import (
|
|||
"github.com/autobrr/autobrr/internal/domain"
|
||||
"github.com/autobrr/autobrr/pkg/errors"
|
||||
"github.com/autobrr/autobrr/pkg/lidarr"
|
||||
"github.com/autobrr/autobrr/pkg/porla"
|
||||
"github.com/autobrr/autobrr/pkg/radarr"
|
||||
"github.com/autobrr/autobrr/pkg/readarr"
|
||||
"github.com/autobrr/autobrr/pkg/sonarr"
|
||||
|
@ -32,6 +33,9 @@ func (s *service) testConnection(ctx context.Context, client domain.DownloadClie
|
|||
case domain.DownloadClientTypeTransmission:
|
||||
return s.testTransmissionConnection(ctx, client)
|
||||
|
||||
case domain.DownloadClientTypePorla:
|
||||
return s.testPorlaConnection(client)
|
||||
|
||||
case domain.DownloadClientTypeRadarr:
|
||||
return s.testRadarrConnection(ctx, client)
|
||||
|
||||
|
@ -258,3 +262,26 @@ func (s *service) testReadarrConnection(ctx context.Context, client domain.Downl
|
|||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *service) testPorlaConnection(client domain.DownloadClient) error {
|
||||
p := porla.NewClient(porla.Settings{
|
||||
Hostname: client.Host,
|
||||
AuthToken: client.Settings.APIKey,
|
||||
})
|
||||
|
||||
version, err := p.Version()
|
||||
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "porla: failed to get version: %v", client.Host)
|
||||
}
|
||||
|
||||
commitish := version.Commitish
|
||||
|
||||
if len(commitish) > 8 {
|
||||
commitish = commitish[:8]
|
||||
}
|
||||
|
||||
s.log.Debug().Msgf("test client connection for porla: found version %s (commit %s)", version.Version, commitish)
|
||||
|
||||
return nil
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue