fix(qbit): seed time doesn't take effect (close #5663)

pull/5690/head
Andy Hsu 2023-12-11 15:20:29 +08:00
parent 296be88b5f
commit 83c2269330
2 changed files with 15 additions and 1 deletions

View File

@ -54,7 +54,7 @@ func (a *QBittorrent) AddURL(args *tool.AddUrlArgs) (string, error) {
}
func (a *QBittorrent) Remove(task *tool.DownloadTask) error {
err := a.client.Delete(task.GID, true)
err := a.client.Delete(task.GID, false)
return err
}

View File

@ -2,7 +2,9 @@ package tool
import (
"fmt"
"github.com/alist-org/alist/v3/internal/conf"
"github.com/alist-org/alist/v3/internal/errs"
"github.com/alist-org/alist/v3/internal/setting"
"github.com/pkg/errors"
log "github.com/sirupsen/logrus"
"github.com/xhofe/tache"
@ -69,6 +71,18 @@ outer:
return err
}
t.Status = "offline download completed, maybe transferring"
// hack for qBittorrent
if t.tool.Name() == "qBittorrent" {
seedTime := setting.GetInt(conf.QbittorrentSeedtime, 0)
if seedTime >= 0 {
t.Status = "offline download completed, waiting for seeding"
<-time.After(time.Minute * time.Duration(seedTime))
err := t.tool.Remove(t)
if err != nil {
log.Errorln(err.Error())
}
}
}
return nil
}