feat(qbittorrent): delete tags when deleting qbittorrent tasks (#3546)

* feat & refactor(qbittorrent/client): support `deleteFiles` arg for `Client.Delete()` method

* feat(qbittorrent/client): also delete tags in `Client.Delete()`
This commit is contained in:
kdxcxs
2023-02-21 16:45:41 +08:00
committed by GitHub
parent 658cf368bb
commit d1ab2443f1
3 changed files with 30 additions and 13 deletions

View File

@ -56,7 +56,8 @@ outer:
for {
select {
case <-m.tsk.Ctx.Done():
return qbclient.Delete(m.tsk.ID)
// delete qbittorrent task and downloaded files when the task exits with error
return qbclient.Delete(m.tsk.ID, true)
case <-time.After(time.Second * 2):
completed, err = m.update()
if completed {
@ -113,7 +114,7 @@ func (m *Monitor) complete() error {
log.Debugf("files len: %d", len(files))
// delete qbittorrent task but do not delete the files before transferring to avoid qbittorrent
// accessing downloaded files and throw `cannot access the file because it is being used by another process` error
err = qbclient.Delete(m.tsk.ID)
err = qbclient.Delete(m.tsk.ID, false)
if err != nil {
return err
}