mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 08:49: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
|
@ -10,13 +10,13 @@ import (
|
|||
"github.com/autobrr/autobrr/pkg/lidarr"
|
||||
)
|
||||
|
||||
func (s *service) lidarr(action domain.Action, release domain.Release) ([]string, error) {
|
||||
func (s *service) lidarr(ctx context.Context, action *domain.Action, release domain.Release) ([]string, error) {
|
||||
s.log.Trace().Msg("action LIDARR")
|
||||
|
||||
// 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 {
|
||||
s.log.Error().Err(err).Msgf("lidarr: error finding client: %v", action.ClientID)
|
||||
return nil, err
|
||||
|
@ -59,9 +59,9 @@ func (s *service) lidarr(action domain.Action, release domain.Release) ([]string
|
|||
r.Title = fmt.Sprintf("%v (%d)", release.TorrentName, release.Year)
|
||||
}
|
||||
|
||||
rejections, err := arr.Push(r)
|
||||
rejections, err := arr.Push(ctx, r)
|
||||
if err != nil {
|
||||
s.log.Error().Stack().Err(err).Msgf("lidarr: failed to push release: %v", r)
|
||||
s.log.Error().Err(err).Msgf("lidarr: failed to push release: %v", r)
|
||||
return nil, err
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue