mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 08:49:13 +00:00
fix(actions): handle non download client actions (#903)
fix(actions): handle non download clients
This commit is contained in:
parent
c1746dc7d6
commit
1ca2677f9f
2 changed files with 17 additions and 10 deletions
|
@ -97,23 +97,25 @@ func (s *service) RunAction(ctx context.Context, action *domain.Action, release
|
||||||
}
|
}
|
||||||
|
|
||||||
payload := &domain.NotificationPayload{
|
payload := &domain.NotificationPayload{
|
||||||
Event: domain.NotificationEventPushApproved,
|
Event: domain.NotificationEventPushApproved,
|
||||||
ReleaseName: release.TorrentName,
|
ReleaseName: release.TorrentName,
|
||||||
Filter: release.Filter.Name,
|
Filter: release.Filter.Name,
|
||||||
Indexer: release.Indexer,
|
Indexer: release.Indexer,
|
||||||
InfoHash: release.TorrentHash,
|
InfoHash: release.TorrentHash,
|
||||||
|
|
||||||
Size: release.Size,
|
Size: release.Size,
|
||||||
Status: domain.ReleasePushStatusApproved,
|
Status: domain.ReleasePushStatusApproved,
|
||||||
Action: action.Name,
|
Action: action.Name,
|
||||||
ActionType: action.Type,
|
ActionType: action.Type,
|
||||||
ActionClient: action.Client.Name,
|
|
||||||
Rejections: []string{},
|
Rejections: []string{},
|
||||||
Protocol: domain.ReleaseProtocolTorrent,
|
Protocol: release.Protocol,
|
||||||
Implementation: release.Implementation,
|
Implementation: release.Implementation,
|
||||||
Timestamp: time.Now(),
|
Timestamp: time.Now(),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if action.Client != nil {
|
||||||
|
payload.ActionClient = action.Client.Name
|
||||||
|
}
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
s.log.Error().Err(err).Msgf("process action failed: %v for '%v'", action.Name, release.TorrentName)
|
s.log.Error().Err(err).Msgf("process action failed: %v for '%v'", action.Name, release.TorrentName)
|
||||||
|
|
||||||
|
|
|
@ -109,18 +109,23 @@ type ReleaseActionStatus struct {
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewReleaseActionStatus(action *Action, release *Release) *ReleaseActionStatus {
|
func NewReleaseActionStatus(action *Action, release *Release) *ReleaseActionStatus {
|
||||||
return &ReleaseActionStatus{
|
s := &ReleaseActionStatus{
|
||||||
ID: 0,
|
ID: 0,
|
||||||
Status: ReleasePushStatusPending,
|
Status: ReleasePushStatusPending,
|
||||||
Action: action.Name,
|
Action: action.Name,
|
||||||
Type: action.Type,
|
Type: action.Type,
|
||||||
Client: action.Client.Name,
|
|
||||||
Filter: release.Filter.Name,
|
Filter: release.Filter.Name,
|
||||||
FilterID: int64(release.Filter.ID),
|
FilterID: int64(release.Filter.ID),
|
||||||
Rejections: []string{},
|
Rejections: []string{},
|
||||||
Timestamp: time.Now(),
|
Timestamp: time.Now(),
|
||||||
ReleaseID: release.ID,
|
ReleaseID: release.ID,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if action.Client != nil {
|
||||||
|
s.Client = action.Client.Name
|
||||||
|
}
|
||||||
|
|
||||||
|
return s
|
||||||
}
|
}
|
||||||
|
|
||||||
type DownloadTorrentFileResponse struct {
|
type DownloadTorrentFileResponse struct {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue