feat(task): add speed monitor (#7655)

This commit is contained in:
KirCute_ECT
2024-12-25 21:09:54 +08:00
committed by GitHub
parent db99224126
commit d7aa1608ac
18 changed files with 116 additions and 44 deletions

View File

@ -3,6 +3,7 @@ package pikpak
import (
"context"
"fmt"
"strconv"
"github.com/alist-org/alist/v3/drivers/pikpak"
"github.com/alist-org/alist/v3/internal/errs"
@ -105,6 +106,10 @@ func (p *PikPak) Status(task *tool.DownloadTask) (*tool.Status, error) {
s.Progress = float64(t.Progress)
s.Status = t.Message
s.Completed = (t.Phase == "PHASE_TYPE_COMPLETE")
s.TotalBytes, err = strconv.ParseInt(t.FileSize, 10, 64)
if err != nil {
s.TotalBytes = 0
}
if t.Phase == "PHASE_TYPE_ERROR" {
s.Err = fmt.Errorf(t.Message)
}