fix: serialize task info

This commit is contained in:
Noah Hsu
2022-06-29 20:28:02 +08:00
parent 786e44d1d2
commit f54418bdae
3 changed files with 76 additions and 11 deletions

View File

@ -59,8 +59,9 @@ outer:
if err != nil {
return err
}
m.tsk.SetStatus("aria2 download completed, waiting for transfer")
m.tsk.SetStatus("aria2 download completed, transferring")
<-m.finish
m.tsk.SetStatus("completed")
return nil
}
@ -88,7 +89,8 @@ func (m *Monitor) Update() (bool, error) {
if err != nil {
downloaded = 0
}
m.tsk.SetProgress(int(float64(downloaded) / float64(total)))
progress := float64(downloaded) / float64(total) * 100
m.tsk.SetProgress(int(progress))
switch info.Status {
case "complete":
err := m.Complete()