mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 00:39:13 +00:00
feat(actions): simplify macro parsing (#560)
* refactor(action): parse macros * feat(action): add ctx to arr clients and test
This commit is contained in:
parent
f6e68fae2b
commit
839eb9f3f3
31 changed files with 323 additions and 334 deletions
|
@ -9,13 +9,13 @@ import (
|
|||
"github.com/autobrr/autobrr/pkg/sonarr"
|
||||
)
|
||||
|
||||
func (s *service) sonarr(action domain.Action, release domain.Release) ([]string, error) {
|
||||
func (s *service) sonarr(ctx context.Context, action *domain.Action, release domain.Release) ([]string, error) {
|
||||
s.log.Trace().Msg("action SONARR")
|
||||
|
||||
// TODO validate data
|
||||
|
||||
// get client for action
|
||||
client, err := s.clientSvc.FindByID(context.TODO(), action.ClientID)
|
||||
client, err := s.clientSvc.FindByID(ctx, action.ClientID)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "sonarr could not find client: %v", action.ClientID)
|
||||
}
|
||||
|
@ -51,7 +51,7 @@ func (s *service) sonarr(action domain.Action, release domain.Release) ([]string
|
|||
PublishDate: time.Now().Format(time.RFC3339),
|
||||
}
|
||||
|
||||
rejections, err := arr.Push(r)
|
||||
rejections, err := arr.Push(ctx, r)
|
||||
if err != nil {
|
||||
return nil, errors.Wrap(err, "sonarr: failed to push release: %v", r)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue