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:
Kyle Sanderson 2022-08-31 06:03:02 -07:00 committed by GitHub
parent c1d2697e18
commit c7b372ee4e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 59 additions and 3 deletions

View file

@ -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 {