feat(115): add offline download tool (close #6888 in #6954)

This commit is contained in:
Shelton Zhu
2024-08-10 20:59:07 +08:00
committed by GitHub
parent 2d77db6bc2
commit 29165d8e60
7 changed files with 166 additions and 13 deletions

View File

@ -54,9 +54,7 @@ func (t *DownloadTask) Run() error {
return err
}
t.GID = gid
var (
ok bool
)
var ok bool
outer:
for {
select {
@ -81,6 +79,15 @@ outer:
if t.tool.Name() == "pikpak" {
return nil
}
if t.tool.Name() == "115 Cloud" {
// hack for 115
<-time.After(time.Second * 1)
err := t.tool.Remove(t)
if err != nil {
log.Errorln(err.Error())
}
return nil
}
t.Status = "offline download completed, maybe transferring"
// hack for qBittorrent
if t.tool.Name() == "qBittorrent" {
@ -136,6 +143,9 @@ func (t *DownloadTask) Complete() error {
if t.tool.Name() == "pikpak" {
return nil
}
if t.tool.Name() == "115 Cloud" {
return nil
}
if getFileser, ok := t.tool.(GetFileser); ok {
files = getFileser.GetFiles(t)
} else {
@ -166,6 +176,4 @@ func (t *DownloadTask) GetStatus() string {
return t.Status
}
var (
DownloadTaskManager *tache.Manager[*DownloadTask]
)
var DownloadTaskManager *tache.Manager[*DownloadTask]