feat(actions): simplify macro parsing (#560)

* refactor(action): parse macros

* feat(action): add ctx to arr clients and test
This commit is contained in:
ze0s 2022-12-10 21:48:19 +01:00 committed by GitHub
parent f6e68fae2b
commit 839eb9f3f3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
31 changed files with 323 additions and 334 deletions

View file

@ -5,6 +5,8 @@ import (
"fmt"
"net/url"
"github.com/autobrr/autobrr/pkg/errors"
"github.com/autobrr/go-qbittorrent"
)
@ -69,6 +71,18 @@ const (
DownloadClientTypeReadarr DownloadClientType = "READARR"
)
// Validate basic validation of client
func (c DownloadClient) Validate() error {
// basic validation of client
if c.Host == "" {
return errors.New("validation error: missing host")
} else if c.Type == "" {
return errors.New("validation error: missing type")
}
return nil
}
func (c DownloadClient) BuildLegacyHost() string {
if c.Type == DownloadClientTypeQbittorrent {
return c.qbitBuildLegacyHost()