mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 00:39:13 +00:00
feat(actions): implement TorrentDataRawBytes macro (#444)
* feat(action): implement TorrentDataRawBytes * better citizen * feat(filters): external support TorrentDataRawBytes macro * feat(actions): exec add TorrentDataRawBytes macro * feat(actions): exec add TorrentDataRawBytes macro
This commit is contained in:
parent
c1d2697e18
commit
c7b372ee4e
5 changed files with 59 additions and 3 deletions
|
@ -1,6 +1,7 @@
|
|||
package action
|
||||
|
||||
import (
|
||||
"io/ioutil"
|
||||
"os/exec"
|
||||
"strings"
|
||||
"time"
|
||||
|
@ -20,6 +21,16 @@ func (s *service) execCmd(action domain.Action, release domain.Release) error {
|
|||
}
|
||||
}
|
||||
|
||||
// read the file into bytes we can then use in the macro
|
||||
if len(release.TorrentDataRawBytes) == 0 && release.TorrentTmpFile != "" {
|
||||
t, err := ioutil.ReadFile(release.TorrentTmpFile)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "could not read torrent file: %v", release.TorrentTmpFile)
|
||||
}
|
||||
|
||||
release.TorrentDataRawBytes = t
|
||||
}
|
||||
|
||||
// check if program exists
|
||||
cmd, err := exec.LookPath(action.ExecCmd)
|
||||
if err != nil {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue