fix: qbit progress

This commit is contained in:
Simon Ding
2024-10-04 11:36:12 +08:00
parent 3af5f96cb0
commit 7461918a6c
2 changed files with 27 additions and 19 deletions

View File

@@ -90,7 +90,7 @@ type TorrentInfo struct {
NumLeechs int64 `json:"num_leechs"` NumLeechs int64 `json:"num_leechs"`
NumSeeds int64 `json:"num_seeds"` NumSeeds int64 `json:"num_seeds"`
Priority int64 `json:"priority"` Priority int64 `json:"priority"`
Progress int64 `json:"progress"` Progress float64 `json:"progress"`
Ratio float64 `json:"ratio"` Ratio float64 `json:"ratio"`
RatioLimit int64 `json:"ratio_limit"` RatioLimit int64 `json:"ratio_limit"`
SavePath string `json:"save_path"` SavePath string `json:"save_path"`

View File

@@ -128,7 +128,15 @@ func (t *Torrent) Progress() (int, error) {
if err != nil { if err != nil {
return 0, err return 0, err
} }
return int(qb.Progress), nil p := qb.Progress * 100
if p >= 100 {
return 100, nil
}
if int(p) == 100 {
return 99, nil
}
return int(p), nil
} }
func (t *Torrent) Stop() error { func (t *Torrent) Stop() error {