mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 00:39:13 +00:00
feat(downloadclient): set downloadClientId for arr clients (#1081)
feat(downloadclient): arrs set downloadClientId
This commit is contained in:
parent
1bfbe38335
commit
0d3e10f094
22 changed files with 154 additions and 66 deletions
|
@ -43,19 +43,28 @@ func (s *service) lidarr(ctx context.Context, action *domain.Action, release dom
|
|||
cfg.Password = client.Settings.Basic.Password
|
||||
}
|
||||
|
||||
arr := lidarr.New(cfg)
|
||||
externalId := 0
|
||||
if client.Settings.ExternalDownloadClientId > 0 {
|
||||
externalId = client.Settings.ExternalDownloadClientId
|
||||
} else if action.ExternalDownloadClientID > 0 {
|
||||
externalId = int(action.ExternalDownloadClientID)
|
||||
}
|
||||
|
||||
r := lidarr.Release{
|
||||
Title: release.TorrentName,
|
||||
InfoUrl: release.InfoURL,
|
||||
DownloadUrl: release.DownloadURL,
|
||||
MagnetUrl: release.MagnetURI,
|
||||
Size: int64(release.Size),
|
||||
Indexer: release.Indexer,
|
||||
DownloadProtocol: "torrent",
|
||||
Protocol: "torrent",
|
||||
DownloadClientId: externalId,
|
||||
DownloadProtocol: string(release.Protocol),
|
||||
Protocol: string(release.Protocol),
|
||||
PublishDate: time.Now().Format(time.RFC3339),
|
||||
}
|
||||
|
||||
arr := lidarr.New(cfg)
|
||||
|
||||
rejections, err := arr.Push(ctx, r)
|
||||
if err != nil {
|
||||
s.log.Error().Err(err).Msgf("lidarr: failed to push release: %v", r)
|
||||
|
|
|
@ -42,19 +42,28 @@ func (s *service) radarr(ctx context.Context, action *domain.Action, release dom
|
|||
cfg.Password = client.Settings.Basic.Password
|
||||
}
|
||||
|
||||
arr := radarr.New(cfg)
|
||||
externalId := 0
|
||||
if client.Settings.ExternalDownloadClientId > 0 {
|
||||
externalId = client.Settings.ExternalDownloadClientId
|
||||
} else if action.ExternalDownloadClientID > 0 {
|
||||
externalId = int(action.ExternalDownloadClientID)
|
||||
}
|
||||
|
||||
r := radarr.Release{
|
||||
Title: release.TorrentName,
|
||||
InfoUrl: release.InfoURL,
|
||||
DownloadUrl: release.DownloadURL,
|
||||
MagnetUrl: release.MagnetURI,
|
||||
Size: int64(release.Size),
|
||||
Indexer: release.Indexer,
|
||||
DownloadClientId: externalId,
|
||||
DownloadProtocol: string(release.Protocol),
|
||||
Protocol: string(release.Protocol),
|
||||
PublishDate: time.Now().Format(time.RFC3339),
|
||||
}
|
||||
|
||||
arr := radarr.New(cfg)
|
||||
|
||||
rejections, err := arr.Push(ctx, r)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "radarr failed to push release: %v", r)
|
||||
|
|
|
@ -42,19 +42,28 @@ func (s *service) readarr(ctx context.Context, action *domain.Action, release do
|
|||
cfg.Password = client.Settings.Basic.Password
|
||||
}
|
||||
|
||||
arr := readarr.New(cfg)
|
||||
externalId := 0
|
||||
if client.Settings.ExternalDownloadClientId > 0 {
|
||||
externalId = client.Settings.ExternalDownloadClientId
|
||||
} else if action.ExternalDownloadClientID > 0 {
|
||||
externalId = int(action.ExternalDownloadClientID)
|
||||
}
|
||||
|
||||
r := readarr.Release{
|
||||
Title: release.TorrentName,
|
||||
InfoUrl: release.InfoURL,
|
||||
DownloadUrl: release.DownloadURL,
|
||||
MagnetUrl: release.MagnetURI,
|
||||
Size: int64(release.Size),
|
||||
Indexer: release.Indexer,
|
||||
DownloadProtocol: "torrent",
|
||||
Protocol: "torrent",
|
||||
DownloadClientId: externalId,
|
||||
DownloadProtocol: string(release.Protocol),
|
||||
Protocol: string(release.Protocol),
|
||||
PublishDate: time.Now().Format(time.RFC3339),
|
||||
}
|
||||
|
||||
arr := readarr.New(cfg)
|
||||
|
||||
rejections, err := arr.Push(ctx, r)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "readarr: failed to push release: %v", r)
|
||||
|
|
|
@ -92,8 +92,7 @@ func (s *service) RunAction(ctx context.Context, action *domain.Action, release
|
|||
rejections, err = s.sabnzbd(ctx, action, *release)
|
||||
|
||||
default:
|
||||
s.log.Warn().Msgf("unsupported action type: %v", action.Type)
|
||||
return rejections, err
|
||||
return nil, errors.New("unsupported action type: %s", action.Type)
|
||||
}
|
||||
|
||||
payload := &domain.NotificationPayload{
|
||||
|
|
|
@ -42,19 +42,28 @@ func (s *service) sonarr(ctx context.Context, action *domain.Action, release dom
|
|||
cfg.Password = client.Settings.Basic.Password
|
||||
}
|
||||
|
||||
arr := sonarr.New(cfg)
|
||||
externalId := 0
|
||||
if client.Settings.ExternalDownloadClientId > 0 {
|
||||
externalId = client.Settings.ExternalDownloadClientId
|
||||
} else if action.ExternalDownloadClientID > 0 {
|
||||
externalId = int(action.ExternalDownloadClientID)
|
||||
}
|
||||
|
||||
r := sonarr.Release{
|
||||
Title: release.TorrentName,
|
||||
InfoUrl: release.InfoURL,
|
||||
DownloadUrl: release.DownloadURL,
|
||||
MagnetUrl: release.MagnetURI,
|
||||
Size: int64(release.Size),
|
||||
Indexer: release.Indexer,
|
||||
DownloadClientId: externalId,
|
||||
DownloadProtocol: string(release.Protocol),
|
||||
Protocol: string(release.Protocol),
|
||||
PublishDate: time.Now().Format(time.RFC3339),
|
||||
}
|
||||
|
||||
arr := sonarr.New(cfg)
|
||||
|
||||
rejections, err := arr.Push(ctx, r)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "sonarr: failed to push release: %v", r)
|
||||
|
|
|
@ -42,19 +42,28 @@ func (s *service) whisparr(ctx context.Context, action *domain.Action, release d
|
|||
cfg.Password = client.Settings.Basic.Password
|
||||
}
|
||||
|
||||
arr := whisparr.New(cfg)
|
||||
externalId := 0
|
||||
if client.Settings.ExternalDownloadClientId > 0 {
|
||||
externalId = client.Settings.ExternalDownloadClientId
|
||||
} else if action.ExternalDownloadClientID > 0 {
|
||||
externalId = int(action.ExternalDownloadClientID)
|
||||
}
|
||||
|
||||
r := whisparr.Release{
|
||||
Title: release.TorrentName,
|
||||
InfoUrl: release.InfoURL,
|
||||
DownloadUrl: release.DownloadURL,
|
||||
MagnetUrl: release.MagnetURI,
|
||||
Size: int64(release.Size),
|
||||
Indexer: release.Indexer,
|
||||
DownloadProtocol: "torrent",
|
||||
Protocol: "torrent",
|
||||
DownloadClientId: externalId,
|
||||
DownloadProtocol: string(release.Protocol),
|
||||
Protocol: string(release.Protocol),
|
||||
PublishDate: time.Now().Format(time.RFC3339),
|
||||
}
|
||||
|
||||
arr := whisparr.New(cfg)
|
||||
|
||||
rejections, err := arr.Push(ctx, r)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "whisparr: failed to push release: %v", r)
|
||||
|
|
|
@ -89,6 +89,7 @@ func (r *ActionRepo) findByFilterID(ctx context.Context, tx *Tx, filterID int) (
|
|||
"webhook_type",
|
||||
"webhook_method",
|
||||
"webhook_data",
|
||||
"external_client_id",
|
||||
"client_id",
|
||||
).
|
||||
From("action").
|
||||
|
@ -114,10 +115,10 @@ func (r *ActionRepo) findByFilterID(ctx context.Context, tx *Tx, filterID int) (
|
|||
var limitUl, limitDl, limitSeedTime sql.NullInt64
|
||||
var limitRatio sql.NullFloat64
|
||||
|
||||
var clientID sql.NullInt32
|
||||
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, &limitDl, &limitUl, &limitRatio, &limitSeedTime, &a.ReAnnounceSkip, &a.ReAnnounceDelete, &a.ReAnnounceInterval, &a.ReAnnounceMaxAttempts, &webhookHost, &webhookType, &webhookMethod, &webhookData, &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, &limitDl, &limitUl, &limitRatio, &limitSeedTime, &a.ReAnnounceSkip, &a.ReAnnounceDelete, &a.ReAnnounceInterval, &a.ReAnnounceMaxAttempts, &webhookHost, &webhookType, &webhookMethod, &webhookData, &externalClientID, &clientID); err != nil {
|
||||
return nil, errors.Wrap(err, "error scanning row")
|
||||
}
|
||||
|
||||
|
@ -142,6 +143,7 @@ func (r *ActionRepo) findByFilterID(ctx context.Context, tx *Tx, filterID int) (
|
|||
a.WebhookMethod = webhookMethod.String
|
||||
a.WebhookData = webhookData.String
|
||||
|
||||
a.ExternalDownloadClientID = externalClientID.Int32
|
||||
a.ClientID = clientID.Int32
|
||||
|
||||
actions = append(actions, &a)
|
||||
|
@ -233,6 +235,7 @@ func (r *ActionRepo) List(ctx context.Context) ([]domain.Action, error) {
|
|||
"webhook_type",
|
||||
"webhook_method",
|
||||
"webhook_data",
|
||||
"external_client_id",
|
||||
"client_id",
|
||||
).
|
||||
From("action")
|
||||
|
@ -256,10 +259,10 @@ func (r *ActionRepo) List(ctx context.Context) ([]domain.Action, error) {
|
|||
var execCmd, execArgs, watchFolder, category, tags, label, savePath, contentLayout, webhookHost, webhookType, webhookMethod, webhookData sql.NullString
|
||||
var limitUl, limitDl, limitSeedTime sql.NullInt64
|
||||
var limitRatio sql.NullFloat64
|
||||
var clientID sql.NullInt32
|
||||
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, &limitDl, &limitUl, &limitRatio, &limitSeedTime, &a.ReAnnounceSkip, &a.ReAnnounceDelete, &a.ReAnnounceInterval, &a.ReAnnounceMaxAttempts, &webhookHost, &webhookType, &webhookMethod, &webhookData, &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, &limitDl, &limitUl, &limitRatio, &limitSeedTime, &a.ReAnnounceSkip, &a.ReAnnounceDelete, &a.ReAnnounceInterval, &a.ReAnnounceMaxAttempts, &webhookHost, &webhookType, &webhookMethod, &webhookData, &externalClientID, &clientID); err != nil {
|
||||
return nil, errors.Wrap(err, "error scanning row")
|
||||
}
|
||||
|
||||
|
@ -281,6 +284,7 @@ func (r *ActionRepo) List(ctx context.Context) ([]domain.Action, error) {
|
|||
a.WebhookMethod = webhookMethod.String
|
||||
a.WebhookData = webhookData.String
|
||||
|
||||
a.ExternalDownloadClientID = externalClientID.Int32
|
||||
a.ClientID = clientID.Int32
|
||||
|
||||
actions = append(actions, a)
|
||||
|
@ -323,6 +327,7 @@ func (r *ActionRepo) Get(ctx context.Context, req *domain.GetActionRequest) (*do
|
|||
"webhook_type",
|
||||
"webhook_method",
|
||||
"webhook_data",
|
||||
"external_client_id",
|
||||
"client_id",
|
||||
"filter_id",
|
||||
).
|
||||
|
@ -348,10 +353,10 @@ func (r *ActionRepo) Get(ctx context.Context, req *domain.GetActionRequest) (*do
|
|||
var execCmd, execArgs, watchFolder, category, tags, label, savePath, contentLayout, webhookHost, webhookType, webhookMethod, webhookData sql.NullString
|
||||
var limitUl, limitDl, limitSeedTime sql.NullInt64
|
||||
var limitRatio sql.NullFloat64
|
||||
var clientID, filterID sql.NullInt32
|
||||
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, &limitDl, &limitUl, &limitRatio, &limitSeedTime, &a.ReAnnounceSkip, &a.ReAnnounceDelete, &a.ReAnnounceInterval, &a.ReAnnounceMaxAttempts, &webhookHost, &webhookType, &webhookMethod, &webhookData, &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, &limitDl, &limitUl, &limitRatio, &limitSeedTime, &a.ReAnnounceSkip, &a.ReAnnounceDelete, &a.ReAnnounceInterval, &a.ReAnnounceMaxAttempts, &webhookHost, &webhookType, &webhookMethod, &webhookData, &externalClientID, &clientID, &filterID); err != nil {
|
||||
if errors.Is(err, sql.ErrNoRows) {
|
||||
return nil, domain.ErrRecordNotFound
|
||||
}
|
||||
|
@ -380,6 +385,7 @@ func (r *ActionRepo) Get(ctx context.Context, req *domain.GetActionRequest) (*do
|
|||
a.WebhookMethod = webhookMethod.String
|
||||
a.WebhookData = webhookData.String
|
||||
|
||||
a.ExternalDownloadClientID = externalClientID.Int32
|
||||
a.ClientID = clientID.Int32
|
||||
a.FilterID = int(filterID.Int32)
|
||||
|
||||
|
@ -454,6 +460,7 @@ func (r *ActionRepo) Store(ctx context.Context, action domain.Action) (*domain.A
|
|||
"webhook_type",
|
||||
"webhook_method",
|
||||
"webhook_data",
|
||||
"external_client_id",
|
||||
"client_id",
|
||||
"filter_id",
|
||||
).
|
||||
|
@ -484,6 +491,7 @@ func (r *ActionRepo) Store(ctx context.Context, action domain.Action) (*domain.A
|
|||
toNullString(action.WebhookType),
|
||||
toNullString(action.WebhookMethod),
|
||||
toNullString(action.WebhookData),
|
||||
toNullInt32(action.ExternalDownloadClientID),
|
||||
toNullInt32(action.ClientID),
|
||||
toNullInt32(int32(action.FilterID)),
|
||||
).
|
||||
|
@ -532,6 +540,7 @@ func (r *ActionRepo) Update(ctx context.Context, action domain.Action) (*domain.
|
|||
Set("webhook_type", toNullString(action.WebhookType)).
|
||||
Set("webhook_method", toNullString(action.WebhookMethod)).
|
||||
Set("webhook_data", toNullString(action.WebhookData)).
|
||||
Set("external_client_id", toNullInt32(action.ExternalDownloadClientID)).
|
||||
Set("client_id", toNullInt32(action.ClientID)).
|
||||
Set("filter_id", toNullInt32(int32(action.FilterID))).
|
||||
Where(sq.Eq{"id": action.ID})
|
||||
|
@ -590,6 +599,7 @@ func (r *ActionRepo) StoreFilterActions(ctx context.Context, filterID int64, act
|
|||
Set("webhook_type", toNullString(action.WebhookType)).
|
||||
Set("webhook_method", toNullString(action.WebhookMethod)).
|
||||
Set("webhook_data", toNullString(action.WebhookData)).
|
||||
Set("external_client_id", toNullInt32(action.ExternalDownloadClientID)).
|
||||
Set("client_id", toNullInt32(action.ClientID)).
|
||||
Set("filter_id", toNullInt64(filterID)).
|
||||
Where(sq.Eq{"id": action.ID})
|
||||
|
@ -635,6 +645,7 @@ func (r *ActionRepo) StoreFilterActions(ctx context.Context, filterID int64, act
|
|||
"webhook_type",
|
||||
"webhook_method",
|
||||
"webhook_data",
|
||||
"external_client_id",
|
||||
"client_id",
|
||||
"filter_id",
|
||||
).
|
||||
|
@ -665,6 +676,7 @@ func (r *ActionRepo) StoreFilterActions(ctx context.Context, filterID int64, act
|
|||
toNullString(action.WebhookType),
|
||||
toNullString(action.WebhookMethod),
|
||||
toNullString(action.WebhookData),
|
||||
toNullInt32(action.ExternalDownloadClientID),
|
||||
toNullInt32(action.ClientID),
|
||||
toNullInt64(filterID),
|
||||
).
|
||||
|
|
|
@ -176,9 +176,10 @@ func (r *DownloadClientRepo) Store(ctx context.Context, client domain.DownloadCl
|
|||
var err error
|
||||
|
||||
settings := domain.DownloadClientSettings{
|
||||
APIKey: client.Settings.APIKey,
|
||||
Basic: client.Settings.Basic,
|
||||
Rules: client.Settings.Rules,
|
||||
APIKey: client.Settings.APIKey,
|
||||
Basic: client.Settings.Basic,
|
||||
Rules: client.Settings.Rules,
|
||||
ExternalDownloadClientId: client.Settings.ExternalDownloadClientId,
|
||||
}
|
||||
|
||||
settingsJson, err := json.Marshal(&settings)
|
||||
|
@ -214,9 +215,10 @@ func (r *DownloadClientRepo) Update(ctx context.Context, client domain.DownloadC
|
|||
var err error
|
||||
|
||||
settings := domain.DownloadClientSettings{
|
||||
APIKey: client.Settings.APIKey,
|
||||
Basic: client.Settings.Basic,
|
||||
Rules: client.Settings.Rules,
|
||||
APIKey: client.Settings.APIKey,
|
||||
Basic: client.Settings.Basic,
|
||||
Rules: client.Settings.Rules,
|
||||
ExternalDownloadClientId: client.Settings.ExternalDownloadClientId,
|
||||
}
|
||||
|
||||
settingsJson, err := json.Marshal(&settings)
|
||||
|
|
|
@ -204,6 +204,7 @@ CREATE TABLE action
|
|||
webhook_type TEXT,
|
||||
webhook_data TEXT,
|
||||
webhook_headers TEXT[] DEFAULT '{}',
|
||||
external_client_id INTEGER,
|
||||
client_id INTEGER,
|
||||
filter_id INTEGER,
|
||||
FOREIGN KEY (filter_id) REFERENCES filter (id),
|
||||
|
@ -793,5 +794,8 @@ CREATE TABLE feed_cache
|
|||
|
||||
CREATE INDEX feed_cache_feed_id_key_index
|
||||
ON feed_cache (feed_id, key);
|
||||
`,
|
||||
`ALTER TABLE action
|
||||
ADD COLUMN external_client_id INTEGER;
|
||||
`,
|
||||
}
|
||||
|
|
|
@ -204,6 +204,7 @@ CREATE TABLE action
|
|||
webhook_type TEXT,
|
||||
webhook_data TEXT,
|
||||
webhook_headers TEXT[] DEFAULT '{}',
|
||||
external_client_id INTEGER,
|
||||
client_id INTEGER,
|
||||
filter_id INTEGER,
|
||||
FOREIGN KEY (filter_id) REFERENCES filter (id),
|
||||
|
@ -1344,5 +1345,8 @@ CREATE TABLE feed_cache
|
|||
|
||||
CREATE INDEX feed_cache_feed_id_key_index
|
||||
ON feed_cache (feed_id, key);
|
||||
`,
|
||||
`ALTER TABLE action
|
||||
ADD COLUMN external_client_id INTEGER;
|
||||
`,
|
||||
}
|
||||
|
|
|
@ -23,37 +23,38 @@ type ActionRepo interface {
|
|||
}
|
||||
|
||||
type Action struct {
|
||||
ID int `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Type ActionType `json:"type"`
|
||||
Enabled bool `json:"enabled"`
|
||||
ExecCmd string `json:"exec_cmd,omitempty"`
|
||||
ExecArgs string `json:"exec_args,omitempty"`
|
||||
WatchFolder string `json:"watch_folder,omitempty"`
|
||||
Category string `json:"category,omitempty"`
|
||||
Tags string `json:"tags,omitempty"`
|
||||
Label string `json:"label,omitempty"`
|
||||
SavePath string `json:"save_path,omitempty"`
|
||||
Paused bool `json:"paused,omitempty"`
|
||||
IgnoreRules bool `json:"ignore_rules,omitempty"`
|
||||
SkipHashCheck bool `json:"skip_hash_check,omitempty"`
|
||||
ContentLayout ActionContentLayout `json:"content_layout,omitempty"`
|
||||
LimitUploadSpeed int64 `json:"limit_upload_speed,omitempty"`
|
||||
LimitDownloadSpeed int64 `json:"limit_download_speed,omitempty"`
|
||||
LimitRatio float64 `json:"limit_ratio,omitempty"`
|
||||
LimitSeedTime int64 `json:"limit_seed_time,omitempty"`
|
||||
ReAnnounceSkip bool `json:"reannounce_skip,omitempty"`
|
||||
ReAnnounceDelete bool `json:"reannounce_delete,omitempty"`
|
||||
ReAnnounceInterval int64 `json:"reannounce_interval,omitempty"`
|
||||
ReAnnounceMaxAttempts int64 `json:"reannounce_max_attempts,omitempty"`
|
||||
WebhookHost string `json:"webhook_host,omitempty"`
|
||||
WebhookType string `json:"webhook_type,omitempty"`
|
||||
WebhookMethod string `json:"webhook_method,omitempty"`
|
||||
WebhookData string `json:"webhook_data,omitempty"`
|
||||
WebhookHeaders []string `json:"webhook_headers,omitempty"`
|
||||
FilterID int `json:"filter_id,omitempty"`
|
||||
ClientID int32 `json:"client_id,omitempty"`
|
||||
Client *DownloadClient `json:"client,omitempty"`
|
||||
ID int `json:"id"`
|
||||
Name string `json:"name"`
|
||||
Type ActionType `json:"type"`
|
||||
Enabled bool `json:"enabled"`
|
||||
ExecCmd string `json:"exec_cmd,omitempty"`
|
||||
ExecArgs string `json:"exec_args,omitempty"`
|
||||
WatchFolder string `json:"watch_folder,omitempty"`
|
||||
Category string `json:"category,omitempty"`
|
||||
Tags string `json:"tags,omitempty"`
|
||||
Label string `json:"label,omitempty"`
|
||||
SavePath string `json:"save_path,omitempty"`
|
||||
Paused bool `json:"paused,omitempty"`
|
||||
IgnoreRules bool `json:"ignore_rules,omitempty"`
|
||||
SkipHashCheck bool `json:"skip_hash_check,omitempty"`
|
||||
ContentLayout ActionContentLayout `json:"content_layout,omitempty"`
|
||||
LimitUploadSpeed int64 `json:"limit_upload_speed,omitempty"`
|
||||
LimitDownloadSpeed int64 `json:"limit_download_speed,omitempty"`
|
||||
LimitRatio float64 `json:"limit_ratio,omitempty"`
|
||||
LimitSeedTime int64 `json:"limit_seed_time,omitempty"`
|
||||
ReAnnounceSkip bool `json:"reannounce_skip,omitempty"`
|
||||
ReAnnounceDelete bool `json:"reannounce_delete,omitempty"`
|
||||
ReAnnounceInterval int64 `json:"reannounce_interval,omitempty"`
|
||||
ReAnnounceMaxAttempts int64 `json:"reannounce_max_attempts,omitempty"`
|
||||
WebhookHost string `json:"webhook_host,omitempty"`
|
||||
WebhookType string `json:"webhook_type,omitempty"`
|
||||
WebhookMethod string `json:"webhook_method,omitempty"`
|
||||
WebhookData string `json:"webhook_data,omitempty"`
|
||||
WebhookHeaders []string `json:"webhook_headers,omitempty"`
|
||||
ExternalDownloadClientID int32 `json:"external_download_client_id,omitempty"`
|
||||
FilterID int `json:"filter_id,omitempty"`
|
||||
ClientID int32 `json:"client_id,omitempty"`
|
||||
Client *DownloadClient `json:"client,omitempty"`
|
||||
}
|
||||
|
||||
// ParseMacros parse all macros on action
|
||||
|
|
|
@ -41,9 +41,10 @@ type DownloadClientCached struct {
|
|||
}
|
||||
|
||||
type DownloadClientSettings struct {
|
||||
APIKey string `json:"apikey,omitempty"`
|
||||
Basic BasicAuth `json:"basic,omitempty"`
|
||||
Rules DownloadClientRules `json:"rules,omitempty"`
|
||||
APIKey string `json:"apikey,omitempty"`
|
||||
Basic BasicAuth `json:"basic,omitempty"`
|
||||
Rules DownloadClientRules `json:"rules,omitempty"`
|
||||
ExternalDownloadClientId int `json:"external_download_client_id,omitempty"`
|
||||
}
|
||||
|
||||
type DownloadClientRules struct {
|
||||
|
|
|
@ -214,7 +214,7 @@ func (s *service) processFilters(ctx context.Context, filters []domain.Filter, r
|
|||
// run action
|
||||
status, err := s.runAction(ctx, act, release)
|
||||
if err != nil {
|
||||
l.Error().Stack().Err(err).Msgf("release.Process: error running actions for filter: %s", release.FilterName)
|
||||
l.Error().Err(err).Msgf("release.Process: error running actions for filter: %s", release.FilterName)
|
||||
//continue
|
||||
}
|
||||
|
||||
|
@ -270,7 +270,7 @@ func (s *service) runAction(ctx context.Context, action *domain.Action, release
|
|||
|
||||
rejections, err := s.actionSvc.RunAction(ctx, action, release)
|
||||
if err != nil {
|
||||
s.log.Error().Stack().Err(err).Msgf("release.runAction: error running actions for filter: %s", release.FilterName)
|
||||
s.log.Error().Err(err).Msgf("release.runAction: error running actions for filter: %s", release.FilterName)
|
||||
|
||||
status.Status = domain.ReleasePushStatusErr
|
||||
status.Rejections = []string{err.Error()}
|
||||
|
|
|
@ -62,6 +62,7 @@ func New(config Config) Client {
|
|||
|
||||
type Release struct {
|
||||
Title string `json:"title"`
|
||||
InfoUrl string `json:"infoUrl,omitempty"`
|
||||
DownloadUrl string `json:"downloadUrl,omitempty"`
|
||||
MagnetUrl string `json:"magnetUrl,omitempty"`
|
||||
Size int64 `json:"size"`
|
||||
|
@ -69,6 +70,7 @@ type Release struct {
|
|||
DownloadProtocol string `json:"downloadProtocol"`
|
||||
Protocol string `json:"protocol"`
|
||||
PublishDate string `json:"publishDate"`
|
||||
DownloadClientId int `json:"downloadClientId,omitempty"`
|
||||
}
|
||||
|
||||
type PushResponse struct {
|
||||
|
@ -87,7 +89,7 @@ type BadRequestResponse struct {
|
|||
}
|
||||
|
||||
func (r BadRequestResponse) String() string {
|
||||
return fmt.Sprintf("[%v: %v] %v: %v - got value: %v", r.Severity, r.ErrorCode, r.PropertyName, r.ErrorMessage, r.AttemptedValue)
|
||||
return fmt.Sprintf("[%s: %s] %s: %s - got value: %s", r.Severity, r.ErrorCode, r.PropertyName, r.ErrorMessage, r.AttemptedValue)
|
||||
}
|
||||
|
||||
type SystemStatusResponse struct {
|
||||
|
|
|
@ -61,6 +61,7 @@ func New(config Config) Client {
|
|||
|
||||
type Release struct {
|
||||
Title string `json:"title"`
|
||||
InfoUrl string `json:"infoUrl,omitempty"`
|
||||
DownloadUrl string `json:"downloadUrl,omitempty"`
|
||||
MagnetUrl string `json:"magnetUrl,omitempty"`
|
||||
Size int64 `json:"size"`
|
||||
|
@ -68,6 +69,7 @@ type Release struct {
|
|||
DownloadProtocol string `json:"downloadProtocol"`
|
||||
Protocol string `json:"protocol"`
|
||||
PublishDate string `json:"publishDate"`
|
||||
DownloadClientId int `json:"downloadClientId,omitempty"`
|
||||
}
|
||||
|
||||
type PushResponse struct {
|
||||
|
@ -90,7 +92,7 @@ type BadRequestResponse struct {
|
|||
}
|
||||
|
||||
func (r *BadRequestResponse) String() string {
|
||||
return fmt.Sprintf("[%v: %v] %v: %v - got value: %v", r.Severity, r.ErrorCode, r.PropertyName, r.ErrorMessage, r.AttemptedValue)
|
||||
return fmt.Sprintf("[%s: %s] %s: %s - got value: %s", r.Severity, r.ErrorCode, r.PropertyName, r.ErrorMessage, r.AttemptedValue)
|
||||
}
|
||||
|
||||
func (c *client) Test(ctx context.Context) (*SystemStatusResponse, error) {
|
||||
|
|
|
@ -64,6 +64,7 @@ func New(config Config) Client {
|
|||
|
||||
type Release struct {
|
||||
Title string `json:"title"`
|
||||
InfoUrl string `json:"infoUrl,omitempty"`
|
||||
DownloadUrl string `json:"downloadUrl,omitempty"`
|
||||
MagnetUrl string `json:"magnetUrl,omitempty"`
|
||||
Size int64 `json:"size"`
|
||||
|
@ -71,6 +72,7 @@ type Release struct {
|
|||
DownloadProtocol string `json:"downloadProtocol"`
|
||||
Protocol string `json:"protocol"`
|
||||
PublishDate string `json:"publishDate"`
|
||||
DownloadClientId int `json:"downloadClientId,omitempty"`
|
||||
}
|
||||
|
||||
type PushResponse struct {
|
||||
|
@ -89,7 +91,7 @@ type BadRequestResponse struct {
|
|||
}
|
||||
|
||||
func (r *BadRequestResponse) String() string {
|
||||
return fmt.Sprintf("[%v: %v] %v: %v - got value: %v", r.Severity, r.ErrorCode, r.PropertyName, r.ErrorMessage, r.AttemptedValue)
|
||||
return fmt.Sprintf("[%s: %s] %s: %s - got value: %s", r.Severity, r.ErrorCode, r.PropertyName, r.ErrorMessage, r.AttemptedValue)
|
||||
}
|
||||
|
||||
type SystemStatusResponse struct {
|
||||
|
|
|
@ -64,6 +64,7 @@ func New(config Config) Client {
|
|||
|
||||
type Release struct {
|
||||
Title string `json:"title"`
|
||||
InfoUrl string `json:"infoUrl,omitempty"`
|
||||
DownloadUrl string `json:"downloadUrl,omitempty"`
|
||||
MagnetUrl string `json:"magnetUrl,omitempty"`
|
||||
Size int64 `json:"size"`
|
||||
|
@ -71,6 +72,7 @@ type Release struct {
|
|||
DownloadProtocol string `json:"downloadProtocol"`
|
||||
Protocol string `json:"protocol"`
|
||||
PublishDate string `json:"publishDate"`
|
||||
DownloadClientId int `json:"downloadClientId,omitempty"`
|
||||
}
|
||||
|
||||
type PushResponse struct {
|
||||
|
@ -89,7 +91,7 @@ type BadRequestResponse struct {
|
|||
}
|
||||
|
||||
func (r *BadRequestResponse) String() string {
|
||||
return fmt.Sprintf("[%v: %v] %v: %v - got value: %v", r.Severity, r.ErrorCode, r.PropertyName, r.ErrorMessage, r.AttemptedValue)
|
||||
return fmt.Sprintf("[%s: %s] %s: %s - got value: %s", r.Severity, r.ErrorCode, r.PropertyName, r.ErrorMessage, r.AttemptedValue)
|
||||
}
|
||||
|
||||
type SystemStatusResponse struct {
|
||||
|
|
|
@ -60,6 +60,7 @@ func New(config Config) Client {
|
|||
|
||||
type Release struct {
|
||||
Title string `json:"title"`
|
||||
InfoUrl string `json:"infoUrl,omitempty"`
|
||||
DownloadUrl string `json:"downloadUrl,omitempty"`
|
||||
MagnetUrl string `json:"magnetUrl,omitempty"`
|
||||
Size int64 `json:"size"`
|
||||
|
@ -67,6 +68,7 @@ type Release struct {
|
|||
DownloadProtocol string `json:"downloadProtocol"`
|
||||
Protocol string `json:"protocol"`
|
||||
PublishDate string `json:"publishDate"`
|
||||
DownloadClientId int `json:"downloadClientId,omitempty"`
|
||||
}
|
||||
|
||||
type PushResponse struct {
|
||||
|
|
|
@ -116,6 +116,8 @@ function FormFieldsArr() {
|
|||
<PasswordFieldWide name="settings.basic.password" label="Password" />
|
||||
</>
|
||||
)}
|
||||
|
||||
<NumberFieldWide name="settings.external_download_client_id" label="Download Client ID" tooltip={<div><p>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.</p></div>} />
|
||||
</div>
|
||||
);
|
||||
}
|
||||
|
|
|
@ -71,6 +71,7 @@ export function FilterActions({ filter, values }: FilterActionsProps) {
|
|||
webhook_method: "",
|
||||
webhook_data: "",
|
||||
webhook_headers: [],
|
||||
external_download_client_id: 0,
|
||||
client_id: 0
|
||||
};
|
||||
|
||||
|
@ -542,6 +543,11 @@ const TypeForm = ({ action, idx, clients }: TypeFormProps) => {
|
|||
action={action}
|
||||
clients={clients}
|
||||
/>
|
||||
<NumberField
|
||||
name={`actions.${idx}.external_download_client_id`}
|
||||
label="Override download client id for arr"
|
||||
tooltip={<p>Override Download client Id from the one set in Clients. Useful if you have multiple clients inside the arr.</p>}
|
||||
/>
|
||||
</div>
|
||||
);
|
||||
case "SABNZBD":
|
||||
|
|
1
web/src/types/Download.d.ts
vendored
1
web/src/types/Download.d.ts
vendored
|
@ -45,6 +45,7 @@ interface DownloadClientSettings {
|
|||
apikey?: string;
|
||||
basic?: DownloadClientBasicAuth;
|
||||
rules?: DownloadClientRules;
|
||||
external_download_client_id?: number;
|
||||
}
|
||||
|
||||
interface DownloadClient {
|
||||
|
|
3
web/src/types/Filter.d.ts
vendored
3
web/src/types/Filter.d.ts
vendored
|
@ -102,8 +102,9 @@ interface Action {
|
|||
webhook_method: string;
|
||||
webhook_data: string,
|
||||
webhook_headers: string[];
|
||||
filter_id?: number;
|
||||
external_download_client_id?: number;
|
||||
client_id?: number;
|
||||
filter_id?: number;
|
||||
}
|
||||
|
||||
type ActionContentLayout = "ORIGINAL" | "SUBFOLDER_CREATE" | "SUBFOLDER_NONE";
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue