fix: resolve back step, audio labels, progress parsing, file size pre-check, and stale job cleanup
All checks were successful
CI / build (push) Successful in 36s

- Fix handleBackStep to redirect to download prompt when step state is nil
  (previously silent no-op after container selection cleared the state)
- Improve formatLabel for audio-only entries without bitrate: use ID + extension
  instead of generic 'audio', fixing duplicate entries in format list
- Add yt-dlp --progress-template for reliable JSON progress parsing across all
  sites (fixes 0.0% progress on sites like xnxx.com where [download] lines
  are absent); keep regex parser as fallback for older yt-dlp versions
- Add file size pre-check in handleContainerSelection before download starts
  (previously checked only after download completed, wasting bandwidth)
- Clear stale active jobs and step state on /start for a clean slate
This commit is contained in:
2026-06-25 22:45:25 +03:30
parent 8bcb0094b2
commit 66a8cd1128
6 changed files with 125 additions and 6 deletions

View File

@@ -246,8 +246,9 @@ func (c *Client) StartDownload(job *domain.DownloadJob, downloadDir string) (<-c
outputPath := filepath.Join(downloadDir, job.ID+"_%(id)s.%(ext)s")
args = append(args, "--output", outputPath)
// Progress reporting (--newline for line-based, no --no-progress so we get actual output)
// Progress reporting using progress-template for machine-readable output
args = append(args, "--newline")
args = append(args, "--progress-template", "stderr:DLPROG|%(progress.percent)s|%(progress._speed_str)s|%(progress._eta_str)s")
// Language selection if specified
if job.Language != "" {
@@ -435,7 +436,10 @@ func formatLabel(f domain.Format) string {
if f.Bitrate != "" {
return f.Bitrate
}
return "audio"
if f.Extension != "" {
return f.ID + " (" + f.Extension + ")"
}
return f.ID
}
if f.Resolution != "" {
return f.Resolution