From 548cd382a6405b16a888702f4dfa1919ea41a603 Mon Sep 17 00:00:00 2001 From: Ludvig Lundgren Date: Sun, 10 Jul 2022 15:55:13 +0200 Subject: [PATCH] feat(actions): reduce metadata downloads (#341) --- internal/action/exec.go | 3 ++- internal/action/run.go | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/internal/action/exec.go b/internal/action/exec.go index 4a13c6e..58c1894 100644 --- a/internal/action/exec.go +++ b/internal/action/exec.go @@ -2,6 +2,7 @@ package action import ( "os/exec" + "strings" "time" "github.com/autobrr/autobrr/internal/domain" @@ -13,7 +14,7 @@ import ( func (s *service) execCmd(action domain.Action, release domain.Release) error { s.log.Debug().Msgf("action exec: %v release: %v", action.Name, release.TorrentName) - if release.TorrentTmpFile == "" { + if release.TorrentTmpFile == "" && strings.Contains(action.ExecArgs, "TorrentPathName") { if err := release.DownloadTorrentFile(); err != nil { return errors.Wrap(err, "error downloading torrent file for release: %v", release.TorrentName) } diff --git a/internal/action/run.go b/internal/action/run.go index 1261f46..eb92a88 100644 --- a/internal/action/run.go +++ b/internal/action/run.go @@ -7,6 +7,7 @@ import ( "net/http" "os" "path" + "strings" "time" "github.com/autobrr/autobrr/internal/domain" @@ -171,7 +172,7 @@ func (s *service) watchFolder(action domain.Action, release domain.Release) erro } func (s *service) webhook(action domain.Action, release domain.Release) error { - if release.TorrentTmpFile == "" { + if release.TorrentTmpFile == "" && strings.Contains(action.WebhookData, "TorrentPathName") { if err := release.DownloadTorrentFile(); err != nil { return errors.Wrap(err, "webhook: could not download torrent file for release: %v", release.TorrentName) }