mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 08:49:13 +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)
|
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)
|
return nil, errors.Wrap(err, "could not add torrent file: %s", release.TorrentTmpFile)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -402,6 +402,14 @@ const TypeForm = ({ action, idx, clients }: TypeFormProps) => {
|
||||||
/>
|
/>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
<div className="col-span-12 sm:col-span-6">
|
||||||
|
<div className="col-span-6">
|
||||||
|
<SwitchGroup
|
||||||
|
name={`actions.${idx}.paused`}
|
||||||
|
label="Don't start download automatically"
|
||||||
|
/>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue