mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 16:59:12 +00:00
feat(actions): add "don't start" option for rtorrent (#782)
This commit is contained in:
parent
07b3569cde
commit
5fed0921c5
2 changed files with 24 additions and 2 deletions
|
@ -54,7 +54,14 @@ func (s *service) rtorrent(ctx context.Context, action *domain.Action, release d
|
|||
}
|
||||
}
|
||||
|
||||
if err := rt.Add(release.MagnetURI, args...); err != nil {
|
||||
var addTorrentMagnet func(string, ...*rtorrent.FieldValue) error
|
||||
if action.Paused {
|
||||
addTorrentMagnet = rt.AddStopped
|
||||
} else {
|
||||
addTorrentMagnet = rt.Add
|
||||
}
|
||||
|
||||
if err := addTorrentMagnet(release.MagnetURI, args...); err != nil {
|
||||
return nil, errors.Wrap(err, "could not add torrent from magnet: %s", release.MagnetURI)
|
||||
}
|
||||
|
||||
|
@ -97,7 +104,14 @@ func (s *service) rtorrent(ctx context.Context, action *domain.Action, release d
|
|||
}
|
||||
}
|
||||
|
||||
if err := rt.AddTorrent(tmpFile, args...); err != nil {
|
||||
var addTorrentFile func([]byte, ...*rtorrent.FieldValue) error
|
||||
if action.Paused {
|
||||
addTorrentFile = rt.AddTorrentStopped
|
||||
} else {
|
||||
addTorrentFile = rt.AddTorrent
|
||||
}
|
||||
|
||||
if err := addTorrentFile(tmpFile, args...); err != nil {
|
||||
return nil, errors.Wrap(err, "could not add torrent file: %s", release.TorrentTmpFile)
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue