mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 08:49:13 +00:00
parent
89cf68e773
commit
d380c0b178
5 changed files with 43 additions and 30 deletions
|
@ -64,9 +64,12 @@ func (a *Action) CheckMacrosNeedTorrentTmpFile(release *Release) bool {
|
|||
if release.TorrentTmpFile == "" &&
|
||||
(strings.Contains(a.ExecArgs, "TorrentPathName") ||
|
||||
strings.Contains(a.ExecArgs, "TorrentDataRawBytes") ||
|
||||
strings.Contains(a.ExecArgs, "TorrentHash") ||
|
||||
strings.Contains(a.WebhookData, "TorrentPathName") ||
|
||||
strings.Contains(a.WebhookData, "TorrentDataRawBytes") ||
|
||||
strings.Contains(a.WebhookData, "TorrentHash") ||
|
||||
strings.Contains(a.SavePath, "TorrentPathName") ||
|
||||
strings.Contains(a.SavePath, "TorrentHash") ||
|
||||
a.Type == ActionTypeWatchFolder) {
|
||||
return true
|
||||
}
|
||||
|
|
|
@ -186,6 +186,22 @@ type FilterExternal struct {
|
|||
FilterId int `json:"-"`
|
||||
}
|
||||
|
||||
func (f FilterExternal) NeedTorrentDownloaded() bool {
|
||||
if strings.Contains(f.ExecArgs, "TorrentHash") || strings.Contains(f.WebhookData, "TorrentHash") {
|
||||
return true
|
||||
}
|
||||
|
||||
if strings.Contains(f.ExecArgs, "TorrentPathName") || strings.Contains(f.WebhookData, "TorrentPathName") {
|
||||
return true
|
||||
}
|
||||
|
||||
if strings.Contains(f.WebhookData, "TorrentDataRawBytes") {
|
||||
return true
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
type FilterExternalType string
|
||||
|
||||
const (
|
||||
|
|
|
@ -426,6 +426,17 @@ func (r *Release) ParseSizeBytesString(size string) {
|
|||
}
|
||||
}
|
||||
|
||||
func (r *Release) OpenTorrentFile() error {
|
||||
tmpFile, err := os.ReadFile(r.TorrentTmpFile)
|
||||
if err != nil {
|
||||
return errors.Wrap(err, "could not read torrent file: %v", r.TorrentTmpFile)
|
||||
}
|
||||
|
||||
r.TorrentDataRawBytes = tmpFile
|
||||
|
||||
return nil
|
||||
}
|
||||
|
||||
func (r *Release) DownloadTorrentFileCtx(ctx context.Context) error {
|
||||
return r.downloadTorrentFile(ctx)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue