Skip to content

Commit

Permalink
fix(qbit): seed time doesn't take effect (close #5663)
Browse files Browse the repository at this point in the history
  • Loading branch information
xhofe committed Dec 11, 2023
1 parent 296be88 commit 83c2269
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
2 changes: 1 addition & 1 deletion internal/offline_download/qbit/qbit.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down
14 changes: 14 additions & 0 deletions internal/offline_download/tool/download.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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
}

Expand Down

0 comments on commit 83c2269

Please sign in to comment.