Add live per-job progress bars with polling #4

Merged
DasPoschi merged 2 commits from codex/add-integration-for-chatgpt.com-xrizez into main 2026-01-04 12:10:38 +00:00
DasPoschi commented 2026-01-04 12:09:28 +00:00 (Migrated from github.com)

Motivation

  • Provide live, per-download progress feedback without reloading the entire page.
  • Parse progress output from download engines so users can see percent-complete for jobs.
  • Keep the UI responsive by updating only progress elements via a lightweight endpoint.

Description

  • Added a progress field to the Job dataclass and initialize it in submit and the worker, setting it to 100.0 on completion.
  • Changed run_ytdlp and run_aria2 to stream subprocess output, parse percentage values with regex, and report progress through a progress_cb callback.
  • Added a /jobs JSON endpoint that returns id and progress for each job and client-side JS refreshProgress that polls this endpoint every 2s to update .progress-bar and .progress-text.
  • Added compact progress bar styling in static/style.css (.progress, .progress-bar, .progress-text).

Testing

  • No automated tests were run for this change.

Codex Task

### Motivation - Provide live, per-download progress feedback without reloading the entire page. - Parse progress output from download engines so users can see percent-complete for jobs. - Keep the UI responsive by updating only progress elements via a lightweight endpoint. ### Description - Added a `progress` field to the `Job` dataclass and initialize it in `submit` and the worker, setting it to `100.0` on completion. - Changed `run_ytdlp` and `run_aria2` to stream subprocess output, parse percentage values with regex, and report progress through a `progress_cb` callback. - Added a `/jobs` JSON endpoint that returns `id` and `progress` for each job and client-side JS `refreshProgress` that polls this endpoint every 2s to update `.progress-bar` and `.progress-text`. - Added compact progress bar styling in `static/style.css` (`.progress`, `.progress-bar`, `.progress-text`). ### Testing - No automated tests were run for this change. ------ [Codex Task](https://chatgpt.com/codex/tasks/task_e_695a4cca19808327bf70c2cc3b942c55)
chatgpt-codex-connector[bot] (Migrated from github.com) reviewed 2026-01-04 12:11:41 +00:00
chatgpt-codex-connector[bot] (Migrated from github.com) left a comment

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 55dcd1f4fa

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

### 💡 Codex Review Here are some automated review suggestions for this pull request. **Reviewed commit:** `55dcd1f4fa` <details> <summary>ℹ️ About Codex in GitHub</summary> <br/> [Your team has set up Codex to review pull requests in this repo](http://chatgpt.com/codex/settings/general). Reviews are triggered when you - Open a pull request for review - Mark a draft as ready - Comment "@codex review". If Codex has suggestions, it will comment; otherwise it will react with 👍. Codex can also answer questions or update the PR. Try commenting "@codex address that feedback". </details>
chatgpt-codex-connector[bot] (Migrated from github.com) commented 2026-01-04 12:11:42 +00:00

P2 Badge Fix yt-dlp progress regex so it can match output

The progress regex is double‑escaped (r"\\[download\\]\\s+([\\d.]+)%"), which makes it look for a literal backslash plus a single character from a character class rather than the actual "[download] 12.3%" lines yt‑dlp prints. In that case match never triggers, so progress stays at 0% and the new live progress bar never updates. Using the unescaped form r"\[download\]\s+([\d.]+)%" (single backslashes) is needed to match real output.

Useful? React with 👍 / 👎.

**<sub><sub>![P2 Badge](https://img.shields.io/badge/P2-yellow?style=flat)</sub></sub> Fix yt-dlp progress regex so it can match output** The progress regex is double‑escaped (`r"\\[download\\]\\s+([\\d.]+)%"`), which makes it look for a literal backslash plus a single character from a character class rather than the actual `"[download] 12.3%"` lines yt‑dlp prints. In that case `match` never triggers, so progress stays at 0% and the new live progress bar never updates. Using the unescaped form `r"\[download\]\s+([\d.]+)%"` (single backslashes) is needed to match real output. Useful? React with 👍 / 👎.
chatgpt-codex-connector[bot] (Migrated from github.com) commented 2026-01-04 12:11:42 +00:00

P2 Badge Fix aria2 progress regex so it can match output

The aria2 progress regex is also double‑escaped (r"\\((\\d+)%\\)"), which makes it look for a literal backslash before/after the parentheses instead of matching the normal "(10%)" progress snippet. That means match never fires and progress never advances from 0% for aria2 downloads. The pattern should be r"\((\d+)%\)" to match aria2’s output.

Useful? React with 👍 / 👎.

**<sub><sub>![P2 Badge](https://img.shields.io/badge/P2-yellow?style=flat)</sub></sub> Fix aria2 progress regex so it can match output** The aria2 progress regex is also double‑escaped (`r"\\((\\d+)%\\)"`), which makes it look for a literal backslash before/after the parentheses instead of matching the normal `"(10%)"` progress snippet. That means `match` never fires and progress never advances from 0% for aria2 downloads. The pattern should be `r"\((\d+)%\)"` to match aria2’s output. Useful? React with 👍 / 👎.
Sign in to join this conversation.