fix: correct progress display (remove duplicate /s, handle HLS reset)
All checks were successful
CI / build (push) Successful in 47s
All checks were successful
CI / build (push) Successful in 47s
This commit is contained in:
@@ -439,11 +439,18 @@ func (h *Handler) trackDownloadProgress(ctx context.Context, job *domain.Downloa
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
if upd.Progress > 0 && lastProgress == 0 {
|
if lastProgress == 0 {
|
||||||
lastProgress = upd.Progress
|
lastProgress = upd.Progress
|
||||||
} else if upd.Progress-lastProgress < domain.ProgressThreshold {
|
|
||||||
continue
|
|
||||||
} else {
|
} else {
|
||||||
|
diff := upd.Progress - lastProgress
|
||||||
|
// Skip small changes (< threshold) in either direction to avoid spamming edits.
|
||||||
|
// HLS streams often emit a fake 100% initial estimate then real values.
|
||||||
|
if diff >= 0 && diff < domain.ProgressThreshold {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
if diff < 0 && -diff < domain.ProgressThreshold {
|
||||||
|
continue
|
||||||
|
}
|
||||||
lastProgress = upd.Progress
|
lastProgress = upd.Progress
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -69,7 +69,7 @@ func languageKeyboard(languages []string) models.InlineKeyboardMarkup {
|
|||||||
func progressKeyboard(pct float64, speed, eta string) models.InlineKeyboardMarkup {
|
func progressKeyboard(pct float64, speed, eta string) models.InlineKeyboardMarkup {
|
||||||
progressText := fmt.Sprintf("%.1f%%", pct)
|
progressText := fmt.Sprintf("%.1f%%", pct)
|
||||||
if speed != "" {
|
if speed != "" {
|
||||||
progressText += fmt.Sprintf(" | %s/s", speed)
|
progressText += fmt.Sprintf(" | %s", speed)
|
||||||
}
|
}
|
||||||
if eta != "" {
|
if eta != "" {
|
||||||
progressText += fmt.Sprintf(" | ETA %s", eta)
|
progressText += fmt.Sprintf(" | ETA %s", eta)
|
||||||
|
|||||||
Reference in New Issue
Block a user