From fbabdfb217dd4d62ff577ecb26bdb7e23b8b1720 Mon Sep 17 00:00:00 2001 From: ze0s <43699394+zze0s@users.noreply.github.com> Date: Mon, 1 Jan 2024 17:57:19 +0100 Subject: [PATCH] feat(clients): override arr download client by name (#1328) * feat(clients): override arr client by name * feat(clients): add missing file * feat(clients): add section download client arr --- internal/action/lidarr.go | 16 +++++---- internal/action/radarr.go | 16 +++++---- internal/action/readarr.go | 16 +++++---- internal/action/sonarr.go | 16 +++++---- internal/action/whisparr.go | 16 +++++---- internal/database/action.go | 24 +++++++++---- internal/database/download_client.go | 2 ++ internal/database/download_client_test.go | 1 + internal/database/postgres_migrate.go | 4 +++ internal/database/sqlite_migrate.go | 4 +++ internal/domain/action.go | 1 + internal/domain/client.go | 1 + pkg/lidarr/lidarr.go | 1 + pkg/radarr/radarr.go | 1 + pkg/readarr/readarr.go | 1 + pkg/sonarr/sonarr.go | 1 + pkg/whisparr/whisparr.go | 1 + .../forms/settings/DownloadClientForms.tsx | 34 +++++++++++++++++-- web/src/screens/filters/sections/Actions.tsx | 1 + .../action_components/OtherActions.tsx | 33 ++++++++++++------ web/src/types/Download.d.ts | 1 + web/src/types/Filter.d.ts | 1 + 22 files changed, 143 insertions(+), 49 deletions(-) diff --git a/internal/action/lidarr.go b/internal/action/lidarr.go index d4fb2a5..85ac765 100644 --- a/internal/action/lidarr.go +++ b/internal/action/lidarr.go @@ -43,11 +43,14 @@ func (s *service) lidarr(ctx context.Context, action *domain.Action, release dom cfg.Password = client.Settings.Basic.Password } - externalId := 0 - if client.Settings.ExternalDownloadClientId > 0 { - externalId = client.Settings.ExternalDownloadClientId - } else if action.ExternalDownloadClientID > 0 { - externalId = int(action.ExternalDownloadClientID) + externalClientId := client.Settings.ExternalDownloadClientId + if action.ExternalDownloadClientID > 0 { + externalClientId = int(action.ExternalDownloadClientID) + } + + externalClient := client.Settings.ExternalDownloadClient + if action.ExternalDownloadClient != "" { + externalClient = action.ExternalDownloadClient } r := lidarr.Release{ @@ -57,7 +60,8 @@ func (s *service) lidarr(ctx context.Context, action *domain.Action, release dom MagnetUrl: release.MagnetURI, Size: int64(release.Size), Indexer: release.Indexer, - DownloadClientId: externalId, + DownloadClientId: externalClientId, + DownloadClient: externalClient, DownloadProtocol: string(release.Protocol), Protocol: string(release.Protocol), PublishDate: time.Now().Format(time.RFC3339), diff --git a/internal/action/radarr.go b/internal/action/radarr.go index a854f9a..c591947 100644 --- a/internal/action/radarr.go +++ b/internal/action/radarr.go @@ -42,11 +42,14 @@ func (s *service) radarr(ctx context.Context, action *domain.Action, release dom cfg.Password = client.Settings.Basic.Password } - externalId := 0 - if client.Settings.ExternalDownloadClientId > 0 { - externalId = client.Settings.ExternalDownloadClientId - } else if action.ExternalDownloadClientID > 0 { - externalId = int(action.ExternalDownloadClientID) + externalClientId := client.Settings.ExternalDownloadClientId + if action.ExternalDownloadClientID > 0 { + externalClientId = int(action.ExternalDownloadClientID) + } + + externalClient := client.Settings.ExternalDownloadClient + if action.ExternalDownloadClient != "" { + externalClient = action.ExternalDownloadClient } r := radarr.Release{ @@ -56,7 +59,8 @@ func (s *service) radarr(ctx context.Context, action *domain.Action, release dom MagnetUrl: release.MagnetURI, Size: int64(release.Size), Indexer: release.Indexer, - DownloadClientId: externalId, + DownloadClientId: externalClientId, + DownloadClient: externalClient, DownloadProtocol: string(release.Protocol), Protocol: string(release.Protocol), PublishDate: time.Now().Format(time.RFC3339), diff --git a/internal/action/readarr.go b/internal/action/readarr.go index e6d62f2..9b06a56 100644 --- a/internal/action/readarr.go +++ b/internal/action/readarr.go @@ -42,11 +42,14 @@ func (s *service) readarr(ctx context.Context, action *domain.Action, release do cfg.Password = client.Settings.Basic.Password } - externalId := 0 - if client.Settings.ExternalDownloadClientId > 0 { - externalId = client.Settings.ExternalDownloadClientId - } else if action.ExternalDownloadClientID > 0 { - externalId = int(action.ExternalDownloadClientID) + externalClientId := client.Settings.ExternalDownloadClientId + if action.ExternalDownloadClientID > 0 { + externalClientId = int(action.ExternalDownloadClientID) + } + + externalClient := client.Settings.ExternalDownloadClient + if action.ExternalDownloadClient != "" { + externalClient = action.ExternalDownloadClient } r := readarr.Release{ @@ -56,7 +59,8 @@ func (s *service) readarr(ctx context.Context, action *domain.Action, release do MagnetUrl: release.MagnetURI, Size: int64(release.Size), Indexer: release.Indexer, - DownloadClientId: externalId, + DownloadClientId: externalClientId, + DownloadClient: externalClient, DownloadProtocol: string(release.Protocol), Protocol: string(release.Protocol), PublishDate: time.Now().Format(time.RFC3339), diff --git a/internal/action/sonarr.go b/internal/action/sonarr.go index 845d886..bf51ed3 100644 --- a/internal/action/sonarr.go +++ b/internal/action/sonarr.go @@ -42,11 +42,14 @@ func (s *service) sonarr(ctx context.Context, action *domain.Action, release dom cfg.Password = client.Settings.Basic.Password } - externalId := 0 - if client.Settings.ExternalDownloadClientId > 0 { - externalId = client.Settings.ExternalDownloadClientId - } else if action.ExternalDownloadClientID > 0 { - externalId = int(action.ExternalDownloadClientID) + externalClientId := client.Settings.ExternalDownloadClientId + if action.ExternalDownloadClientID > 0 { + externalClientId = int(action.ExternalDownloadClientID) + } + + externalClient := client.Settings.ExternalDownloadClient + if action.ExternalDownloadClient != "" { + externalClient = action.ExternalDownloadClient } r := sonarr.Release{ @@ -56,7 +59,8 @@ func (s *service) sonarr(ctx context.Context, action *domain.Action, release dom MagnetUrl: release.MagnetURI, Size: int64(release.Size), Indexer: release.Indexer, - DownloadClientId: externalId, + DownloadClientId: externalClientId, + DownloadClient: externalClient, DownloadProtocol: string(release.Protocol), Protocol: string(release.Protocol), PublishDate: time.Now().Format(time.RFC3339), diff --git a/internal/action/whisparr.go b/internal/action/whisparr.go index aca531b..8a78688 100644 --- a/internal/action/whisparr.go +++ b/internal/action/whisparr.go @@ -42,11 +42,14 @@ func (s *service) whisparr(ctx context.Context, action *domain.Action, release d cfg.Password = client.Settings.Basic.Password } - externalId := 0 - if client.Settings.ExternalDownloadClientId > 0 { - externalId = client.Settings.ExternalDownloadClientId - } else if action.ExternalDownloadClientID > 0 { - externalId = int(action.ExternalDownloadClientID) + externalClientId := client.Settings.ExternalDownloadClientId + if action.ExternalDownloadClientID > 0 { + externalClientId = int(action.ExternalDownloadClientID) + } + + externalClient := client.Settings.ExternalDownloadClient + if action.ExternalDownloadClient != "" { + externalClient = action.ExternalDownloadClient } r := whisparr.Release{ @@ -56,7 +59,8 @@ func (s *service) whisparr(ctx context.Context, action *domain.Action, release d MagnetUrl: release.MagnetURI, Size: int64(release.Size), Indexer: release.Indexer, - DownloadClientId: externalId, + DownloadClientId: externalClientId, + DownloadClient: externalClient, DownloadProtocol: string(release.Protocol), Protocol: string(release.Protocol), PublishDate: time.Now().Format(time.RFC3339), diff --git a/internal/database/action.go b/internal/database/action.go index af168e4..6e4c896 100644 --- a/internal/database/action.go +++ b/internal/database/action.go @@ -91,6 +91,7 @@ func (r *ActionRepo) findByFilterID(ctx context.Context, tx *Tx, filterID int, a "webhook_method", "webhook_data", "external_client_id", + "external_client", "client_id", ). From("action"). @@ -116,14 +117,14 @@ func (r *ActionRepo) findByFilterID(ctx context.Context, tx *Tx, filterID int, a for rows.Next() { var a domain.Action - var execCmd, execArgs, watchFolder, category, tags, label, savePath, contentLayout, priorityLayout, webhookHost, webhookType, webhookMethod, webhookData sql.NullString + var execCmd, execArgs, watchFolder, category, tags, label, savePath, contentLayout, priorityLayout, webhookHost, webhookType, webhookMethod, webhookData, externalClient sql.NullString var limitUl, limitDl, limitSeedTime sql.NullInt64 var limitRatio sql.NullFloat64 var externalClientID, clientID sql.NullInt32 var paused, ignoreRules sql.NullBool - if err := rows.Scan(&a.ID, &a.Name, &a.Type, &a.Enabled, &execCmd, &execArgs, &watchFolder, &category, &tags, &label, &savePath, &paused, &ignoreRules, &a.SkipHashCheck, &contentLayout, &priorityLayout, &limitDl, &limitUl, &limitRatio, &limitSeedTime, &a.ReAnnounceSkip, &a.ReAnnounceDelete, &a.ReAnnounceInterval, &a.ReAnnounceMaxAttempts, &webhookHost, &webhookType, &webhookMethod, &webhookData, &externalClientID, &clientID); err != nil { + if err := rows.Scan(&a.ID, &a.Name, &a.Type, &a.Enabled, &execCmd, &execArgs, &watchFolder, &category, &tags, &label, &savePath, &paused, &ignoreRules, &a.SkipHashCheck, &contentLayout, &priorityLayout, &limitDl, &limitUl, &limitRatio, &limitSeedTime, &a.ReAnnounceSkip, &a.ReAnnounceDelete, &a.ReAnnounceInterval, &a.ReAnnounceMaxAttempts, &webhookHost, &webhookType, &webhookMethod, &webhookData, &externalClientID, &externalClient, &clientID); err != nil { return nil, errors.Wrap(err, "error scanning row") } @@ -150,6 +151,7 @@ func (r *ActionRepo) findByFilterID(ctx context.Context, tx *Tx, filterID int, a a.WebhookData = webhookData.String a.ExternalDownloadClientID = externalClientID.Int32 + a.ExternalDownloadClient = externalClient.String a.ClientID = clientID.Int32 actions = append(actions, &a) @@ -243,6 +245,7 @@ func (r *ActionRepo) List(ctx context.Context) ([]domain.Action, error) { "webhook_method", "webhook_data", "external_client_id", + "external_client", "client_id", ). From("action") @@ -263,13 +266,13 @@ func (r *ActionRepo) List(ctx context.Context) ([]domain.Action, error) { for rows.Next() { var a domain.Action - var execCmd, execArgs, watchFolder, category, tags, label, savePath, contentLayout, priorityLayout, webhookHost, webhookType, webhookMethod, webhookData sql.NullString + var execCmd, execArgs, watchFolder, category, tags, label, savePath, contentLayout, priorityLayout, webhookHost, webhookType, webhookMethod, webhookData, externalClient sql.NullString var limitUl, limitDl, limitSeedTime sql.NullInt64 var limitRatio sql.NullFloat64 var externalClientID, clientID sql.NullInt32 var paused, ignoreRules sql.NullBool - if err := rows.Scan(&a.ID, &a.Name, &a.Type, &a.Enabled, &execCmd, &execArgs, &watchFolder, &category, &tags, &label, &savePath, &paused, &ignoreRules, &a.SkipHashCheck, &contentLayout, &priorityLayout, &limitDl, &limitUl, &limitRatio, &limitSeedTime, &a.ReAnnounceSkip, &a.ReAnnounceDelete, &a.ReAnnounceInterval, &a.ReAnnounceMaxAttempts, &webhookHost, &webhookType, &webhookMethod, &webhookData, &externalClientID, &clientID); err != nil { + if err := rows.Scan(&a.ID, &a.Name, &a.Type, &a.Enabled, &execCmd, &execArgs, &watchFolder, &category, &tags, &label, &savePath, &paused, &ignoreRules, &a.SkipHashCheck, &contentLayout, &priorityLayout, &limitDl, &limitUl, &limitRatio, &limitSeedTime, &a.ReAnnounceSkip, &a.ReAnnounceDelete, &a.ReAnnounceInterval, &a.ReAnnounceMaxAttempts, &webhookHost, &webhookType, &webhookMethod, &webhookData, &externalClientID, &externalClient, &clientID); err != nil { return nil, errors.Wrap(err, "error scanning row") } @@ -293,6 +296,7 @@ func (r *ActionRepo) List(ctx context.Context) ([]domain.Action, error) { a.WebhookData = webhookData.String a.ExternalDownloadClientID = externalClientID.Int32 + a.ExternalDownloadClient = externalClient.String a.ClientID = clientID.Int32 actions = append(actions, a) @@ -337,6 +341,7 @@ func (r *ActionRepo) Get(ctx context.Context, req *domain.GetActionRequest) (*do "webhook_method", "webhook_data", "external_client_id", + "external_client", "client_id", "filter_id", ). @@ -359,13 +364,13 @@ func (r *ActionRepo) Get(ctx context.Context, req *domain.GetActionRequest) (*do var a domain.Action - var execCmd, execArgs, watchFolder, category, tags, label, savePath, contentLayout, priorityLayout, webhookHost, webhookType, webhookMethod, webhookData sql.NullString + var execCmd, execArgs, watchFolder, category, tags, label, savePath, contentLayout, priorityLayout, webhookHost, webhookType, webhookMethod, webhookData, externalClient sql.NullString var limitUl, limitDl, limitSeedTime sql.NullInt64 var limitRatio sql.NullFloat64 var externalClientID, clientID, filterID sql.NullInt32 var paused, ignoreRules sql.NullBool - if err := row.Scan(&a.ID, &a.Name, &a.Type, &a.Enabled, &execCmd, &execArgs, &watchFolder, &category, &tags, &label, &savePath, &paused, &ignoreRules, &a.SkipHashCheck, &contentLayout, &priorityLayout, &limitDl, &limitUl, &limitRatio, &limitSeedTime, &a.ReAnnounceSkip, &a.ReAnnounceDelete, &a.ReAnnounceInterval, &a.ReAnnounceMaxAttempts, &webhookHost, &webhookType, &webhookMethod, &webhookData, &externalClientID, &clientID, &filterID); err != nil { + if err := row.Scan(&a.ID, &a.Name, &a.Type, &a.Enabled, &execCmd, &execArgs, &watchFolder, &category, &tags, &label, &savePath, &paused, &ignoreRules, &a.SkipHashCheck, &contentLayout, &priorityLayout, &limitDl, &limitUl, &limitRatio, &limitSeedTime, &a.ReAnnounceSkip, &a.ReAnnounceDelete, &a.ReAnnounceInterval, &a.ReAnnounceMaxAttempts, &webhookHost, &webhookType, &webhookMethod, &webhookData, &externalClientID, &externalClient, &clientID, &filterID); err != nil { if errors.Is(err, sql.ErrNoRows) { return nil, domain.ErrRecordNotFound } @@ -396,6 +401,7 @@ func (r *ActionRepo) Get(ctx context.Context, req *domain.GetActionRequest) (*do a.WebhookData = webhookData.String a.ExternalDownloadClientID = externalClientID.Int32 + a.ExternalDownloadClient = externalClient.String a.ClientID = clientID.Int32 a.FilterID = int(filterID.Int32) @@ -474,6 +480,7 @@ func (r *ActionRepo) Store(ctx context.Context, action domain.Action) (*domain.A "webhook_method", "webhook_data", "external_client_id", + "external_client", "client_id", "filter_id", ). @@ -506,6 +513,7 @@ func (r *ActionRepo) Store(ctx context.Context, action domain.Action) (*domain.A toNullString(action.WebhookMethod), toNullString(action.WebhookData), toNullInt32(action.ExternalDownloadClientID), + toNullString(action.ExternalDownloadClient), toNullInt32(action.ClientID), toNullInt32(int32(action.FilterID)), ). @@ -556,6 +564,7 @@ func (r *ActionRepo) Update(ctx context.Context, action domain.Action) (*domain. Set("webhook_method", toNullString(action.WebhookMethod)). Set("webhook_data", toNullString(action.WebhookData)). Set("external_client_id", toNullInt32(action.ExternalDownloadClientID)). + Set("external_client", toNullString(action.ExternalDownloadClient)). Set("client_id", toNullInt32(action.ClientID)). Set("filter_id", toNullInt32(int32(action.FilterID))). Where(sq.Eq{"id": action.ID}) @@ -616,6 +625,7 @@ func (r *ActionRepo) StoreFilterActions(ctx context.Context, filterID int64, act Set("webhook_method", toNullString(action.WebhookMethod)). Set("webhook_data", toNullString(action.WebhookData)). Set("external_client_id", toNullInt32(action.ExternalDownloadClientID)). + Set("external_client", toNullString(action.ExternalDownloadClient)). Set("client_id", toNullInt32(action.ClientID)). Set("filter_id", toNullInt64(filterID)). Where(sq.Eq{"id": action.ID}) @@ -663,6 +673,7 @@ func (r *ActionRepo) StoreFilterActions(ctx context.Context, filterID int64, act "webhook_method", "webhook_data", "external_client_id", + "external_client", "client_id", "filter_id", ). @@ -695,6 +706,7 @@ func (r *ActionRepo) StoreFilterActions(ctx context.Context, filterID int64, act toNullString(action.WebhookMethod), toNullString(action.WebhookData), toNullInt32(action.ExternalDownloadClientID), + toNullString(action.ExternalDownloadClient), toNullInt32(action.ClientID), toNullInt64(filterID), ). diff --git a/internal/database/download_client.go b/internal/database/download_client.go index ac14716..39aa1c3 100644 --- a/internal/database/download_client.go +++ b/internal/database/download_client.go @@ -185,6 +185,7 @@ func (r *DownloadClientRepo) Store(ctx context.Context, client domain.DownloadCl Basic: client.Settings.Basic, Rules: client.Settings.Rules, ExternalDownloadClientId: client.Settings.ExternalDownloadClientId, + ExternalDownloadClient: client.Settings.ExternalDownloadClient, } settingsJson, err := json.Marshal(&settings) @@ -224,6 +225,7 @@ func (r *DownloadClientRepo) Update(ctx context.Context, client domain.DownloadC Basic: client.Settings.Basic, Rules: client.Settings.Rules, ExternalDownloadClientId: client.Settings.ExternalDownloadClientId, + ExternalDownloadClient: client.Settings.ExternalDownloadClient, } settingsJson, err := json.Marshal(&settings) diff --git a/internal/database/download_client_test.go b/internal/database/download_client_test.go index 3ae38ce..cd4a919 100644 --- a/internal/database/download_client_test.go +++ b/internal/database/download_client_test.go @@ -41,6 +41,7 @@ func getMockDownloadClient() domain.DownloadClient { UploadSpeedThreshold: 0, }, ExternalDownloadClientId: 0, + ExternalDownloadClient: "", }, } } diff --git a/internal/database/postgres_migrate.go b/internal/database/postgres_migrate.go index 68c8983..282f868 100644 --- a/internal/database/postgres_migrate.go +++ b/internal/database/postgres_migrate.go @@ -210,6 +210,7 @@ CREATE TABLE action webhook_data TEXT, webhook_headers TEXT[] DEFAULT '{}', external_client_id INTEGER, + external_client TEXT, client_id INTEGER, filter_id INTEGER, FOREIGN KEY (filter_id) REFERENCES filter (id), @@ -838,5 +839,8 @@ ALTER TABLE filter_external `, `ALTER TABLE action ADD COLUMN priority TEXT; +`, + `ALTER TABLE action + ADD COLUMN external_client TEXT; `, } diff --git a/internal/database/sqlite_migrate.go b/internal/database/sqlite_migrate.go index c83ed10..ebd18d7 100644 --- a/internal/database/sqlite_migrate.go +++ b/internal/database/sqlite_migrate.go @@ -210,6 +210,7 @@ CREATE TABLE action webhook_data TEXT, webhook_headers TEXT[] DEFAULT '{}', external_client_id INTEGER, + external_client TEXT, client_id INTEGER, filter_id INTEGER, FOREIGN KEY (filter_id) REFERENCES filter (id), @@ -1479,5 +1480,8 @@ ALTER TABLE feed_dg_tmp `, `ALTER TABLE action ADD COLUMN priority TEXT; +`, + `ALTER TABLE action + ADD COLUMN external_client TEXT; `, } diff --git a/internal/domain/action.go b/internal/domain/action.go index eca9060..81397bb 100644 --- a/internal/domain/action.go +++ b/internal/domain/action.go @@ -53,6 +53,7 @@ type Action struct { WebhookData string `json:"webhook_data,omitempty"` WebhookHeaders []string `json:"webhook_headers,omitempty"` ExternalDownloadClientID int32 `json:"external_download_client_id,omitempty"` + ExternalDownloadClient string `json:"external_download_client,omitempty"` FilterID int `json:"filter_id,omitempty"` ClientID int32 `json:"client_id,omitempty"` Client *DownloadClient `json:"client,omitempty"` diff --git a/internal/domain/client.go b/internal/domain/client.go index 5d32102..f9c05bf 100644 --- a/internal/domain/client.go +++ b/internal/domain/client.go @@ -45,6 +45,7 @@ type DownloadClientSettings struct { Basic BasicAuth `json:"basic,omitempty"` Rules DownloadClientRules `json:"rules,omitempty"` ExternalDownloadClientId int `json:"external_download_client_id,omitempty"` + ExternalDownloadClient string `json:"external_download_client,omitempty"` } type DownloadClientRules struct { diff --git a/pkg/lidarr/lidarr.go b/pkg/lidarr/lidarr.go index 3d88f82..4209e2c 100644 --- a/pkg/lidarr/lidarr.go +++ b/pkg/lidarr/lidarr.go @@ -72,6 +72,7 @@ type Release struct { Protocol string `json:"protocol"` PublishDate string `json:"publishDate"` DownloadClientId int `json:"downloadClientId,omitempty"` + DownloadClient string `json:"downloadClient,omitempty"` } type PushResponse struct { diff --git a/pkg/radarr/radarr.go b/pkg/radarr/radarr.go index 0873303..a8d2e08 100644 --- a/pkg/radarr/radarr.go +++ b/pkg/radarr/radarr.go @@ -71,6 +71,7 @@ type Release struct { Protocol string `json:"protocol"` PublishDate string `json:"publishDate"` DownloadClientId int `json:"downloadClientId,omitempty"` + DownloadClient string `json:"downloadClient,omitempty"` } type PushResponse struct { diff --git a/pkg/readarr/readarr.go b/pkg/readarr/readarr.go index 86d78e4..0c66257 100644 --- a/pkg/readarr/readarr.go +++ b/pkg/readarr/readarr.go @@ -73,6 +73,7 @@ type Release struct { Protocol string `json:"protocol"` PublishDate string `json:"publishDate"` DownloadClientId int `json:"downloadClientId,omitempty"` + DownloadClient string `json:"downloadClient,omitempty"` } type PushResponse struct { diff --git a/pkg/sonarr/sonarr.go b/pkg/sonarr/sonarr.go index bac22cb..c74d68e 100644 --- a/pkg/sonarr/sonarr.go +++ b/pkg/sonarr/sonarr.go @@ -73,6 +73,7 @@ type Release struct { Protocol string `json:"protocol"` PublishDate string `json:"publishDate"` DownloadClientId int `json:"downloadClientId,omitempty"` + DownloadClient string `json:"downloadClient,omitempty"` } type PushResponse struct { diff --git a/pkg/whisparr/whisparr.go b/pkg/whisparr/whisparr.go index b3105c2..e11d170 100644 --- a/pkg/whisparr/whisparr.go +++ b/pkg/whisparr/whisparr.go @@ -70,6 +70,7 @@ type Release struct { Protocol string `json:"protocol"` PublishDate string `json:"publishDate"` DownloadClientId int `json:"downloadClientId,omitempty"` + DownloadClient string `json:"downloadClient,omitempty"` } type PushResponse struct { diff --git a/web/src/forms/settings/DownloadClientForms.tsx b/web/src/forms/settings/DownloadClientForms.tsx index c7ac183..6db52ff 100644 --- a/web/src/forms/settings/DownloadClientForms.tsx +++ b/web/src/forms/settings/DownloadClientForms.tsx @@ -41,6 +41,8 @@ interface InitialValuesSettings { download_speed_threshold?: number; max_active_downloads?: number; }; + external_download_client_id?: number; + external_download_client?: string; } interface InitialValues { @@ -135,8 +137,6 @@ function FormFieldsArr() { )} - -

Specify what client the arr should use by default. Can be overridden per filter action. You can find the id in the arr by looking at the network responses for download clients.

} /> ); } @@ -432,6 +432,29 @@ function FormFieldsRulesBasic() { ); } +function FormFieldsRulesArr() { + // const { + // values: { settings } + // } = useFormikContext(); + + return ( +
+
+ + Download Client + +

+ Override download client to use. Can also be overridden per Filter Action. +

+
+ +

Specify what client the arr should use by default. Can be overridden per filter action.

} /> + +

DEPRECATED: Use Client name field instead.

} /> + + ); +} + function FormFieldsRulesQbit() { const { values: { settings } @@ -544,7 +567,12 @@ export const rulesComponentMap: componentMapType = { DELUGE_V2: , QBITTORRENT: , PORLA: , - TRANSMISSION: + TRANSMISSION: , + RADARR: , + SONARR: , + LIDARR: , + WHISPARR: , + READARR: , }; interface formButtonsProps { diff --git a/web/src/screens/filters/sections/Actions.tsx b/web/src/screens/filters/sections/Actions.tsx index ed71b1b..6ff9dac 100644 --- a/web/src/screens/filters/sections/Actions.tsx +++ b/web/src/screens/filters/sections/Actions.tsx @@ -70,6 +70,7 @@ export function Actions({ filter, values }: FilterActionsProps) { webhook_data: "", webhook_headers: [], external_download_client_id: 0, + external_download_client: "", client_id: 0 }; diff --git a/web/src/screens/filters/sections/action_components/OtherActions.tsx b/web/src/screens/filters/sections/action_components/OtherActions.tsx index 69f0832..16c6053 100644 --- a/web/src/screens/filters/sections/action_components/OtherActions.tsx +++ b/web/src/screens/filters/sections/action_components/OtherActions.tsx @@ -118,16 +118,29 @@ export const Arr = ({ idx, action, clients }: ClientActionProps) => ( - - Override Download client Id from the one set in Clients. Useful if you - have multiple clients inside the arr. -

- } - /> +
+ + Override Download client name from the one set in Clients. Useful if you + have multiple clients inside the arr. +

+ } + /> + + Override Download client Id from the one set in Clients. Useful if you + have multiple clients inside the arr. +

+ } + /> +
diff --git a/web/src/types/Download.d.ts b/web/src/types/Download.d.ts index 68257cd..89b80bd 100644 --- a/web/src/types/Download.d.ts +++ b/web/src/types/Download.d.ts @@ -49,6 +49,7 @@ interface DownloadClientSettings { basic?: DownloadClientBasicAuth; rules?: DownloadClientRules; external_download_client_id?: number; + external_download_client?: string; } interface DownloadClient { diff --git a/web/src/types/Filter.d.ts b/web/src/types/Filter.d.ts index 173c64c..6e0a786 100644 --- a/web/src/types/Filter.d.ts +++ b/web/src/types/Filter.d.ts @@ -105,6 +105,7 @@ interface Action { webhook_data: string, webhook_headers: string[]; external_download_client_id?: number; + external_download_client?: string; client_id?: number; filter_id?: number; }