mirror of
https://github.com/idanoo/autobrr
synced 2025-07-22 16:29:12 +00:00
feat(clients): add rTorrent support (#421)
This commit is contained in:
parent
765215270a
commit
54d7151894
13 changed files with 692 additions and 541 deletions
|
@ -14,6 +14,7 @@ import (
|
|||
|
||||
delugeClient "github.com/gdm85/go-libdeluge"
|
||||
"github.com/hekmon/transmissionrpc/v2"
|
||||
"github.com/mrobinsn/go-rtorrent/rtorrent"
|
||||
)
|
||||
|
||||
func (s *service) testConnection(client domain.DownloadClient) error {
|
||||
|
@ -24,6 +25,9 @@ func (s *service) testConnection(client domain.DownloadClient) error {
|
|||
case domain.DownloadClientTypeDelugeV1, domain.DownloadClientTypeDelugeV2:
|
||||
return s.testDelugeConnection(client)
|
||||
|
||||
case domain.DownloadClientTypeRTorrent:
|
||||
return s.testRTorrentConnection(client)
|
||||
|
||||
case domain.DownloadClientTypeTransmission:
|
||||
return s.testTransmissionConnection(client)
|
||||
|
||||
|
@ -119,6 +123,21 @@ func (s *service) testDelugeConnection(client domain.DownloadClient) error {
|
|||
return nil
|
||||
}
|
||||
|
||||
func (s *service) testRTorrentConnection(client domain.DownloadClient) error {
|
||||
// create client
|
||||
rt := rtorrent.New(client.Host, true)
|
||||
name, err := rt.Name()
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "error logging into client: %v", client.Host)
|
||||
}
|
||||
|
||||
s.log.Trace().Msgf("test client connection for rTorrent: got client: %v", name)
|
||||
|
||||
s.log.Debug().Msgf("test client connection for rTorrent: success")
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (s *service) testTransmissionConnection(client domain.DownloadClient) error {
|
||||
tbt, err := transmissionrpc.New(client.Host, client.Username, client.Password, &transmissionrpc.AdvancedConfig{
|
||||
HTTPS: client.TLS,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue