Skip to content

Ask before Cancel or Back stops an NZBGet download - #596

Open
xbmc4lyfe wants to merge 3 commits into
mainfrom
cancel-menu
Open

xbmc4lyfe wants to merge 3 commits into
mainfrom
cancel-menu

Conversation

@xbmc4lyfe

Copy link
Copy Markdown
Collaborator

Summary

Cancel, Back, Escape or Stop on the NZBGet download dialog used to stop the download at once and remove it, its files, its backups and its records from NZBGet. Now the press opens a menu first:

  1. Yes, stop it and remove it and its files from NZBGet (the old behavior)
  2. Yes, go back but keep it downloading in NZBGet
  3. No, keep watching the download (Back on the menu does the same)

Back, keep watching, then Back again and leave it downloading

flowchart TD
    P[Cancel / Back / Escape / Stop pressed] --> M{Cancel menu}
    M -->|Stop and remove| S[Old path: delete this play's jobs, setResolvedUrl False]
    M -->|Go back, keep downloading| D[detached: leave every job in NZBGet, toast, setResolvedUrl False]
    M -->|No / Back on the menu| R[Forget the press, dialog carries on]
    classDef stop fill:#F87171,color:#151520
    classDef go fill:#FBBF24,color:#151520
    classDef keep fill:#34D399,color:#151520
    class S stop
    class D go
    class R keep
Loading

Changes

  • nzbget_dialog: iscanceled() asks ask_cancel_choice() (a Kodi select) once per press. "Go back" sets detached and keeps iscanceled() False. Kodi's own progress dialog (the fallback when the add-on window can't open) is wrapped in KodiProgressDialog with the same menu; "keep watching" reopens it because Kodi's dialog can't forget a press.
  • Only the thread that opened the dialog shows the menu; other threads polling it see no cancel until the answer is in.
  • Kodi delivers the window's script callback for a press late, when the polling thread next waits. A late callback for the press the menu already answered is ignored (found in the VM: without it the menu opened a second time).
  • nzbget_resolver: the poll returns a new detached outcome; it deletes nothing, does not set the cancel event (a backup append still in flight is not deleted as a late cancel), toasts "Left downloading in NZBGet", and resolves False. A download that finishes or settles while the user goes back is not played and does not show "No video file found".
  • Going back while copies are still being sent lets the send finish, then leaves without removing anything.
  • If Kodi refuses to show the menu, the press stops the download as before, so a cancel is always possible.
  • Docs: new "Cancel and Back" section in the NZBGet backend page with a screenshot and the GIF; CHANGELOG entry.

Testing

  • just test passes (5236 passed)
  • just lint passes
  • Tested in Kodi: native Kodi 20.5 in a test VM with a fake NZBGet/Hydra, each choice during the poll and during the send:
    • stop: three editqueue deletes, back to Home
    • go back: no editqueue, back to Home, toast shown
    • keep watching: dialog carries on, "Cancelling..." hidden, no second menu, no deletes
  • Updated CHANGELOG.md and docs-site/ (just docs builds)

Cancel, Back, Escape and Stop on the download dialog now open a menu:
stop it and remove it from NZBGet (the old behavior), go back but keep it
downloading, or keep watching. Going back leaves every job in NZBGet and
shows a short toast. Only the thread that opened the dialog asks; a late
script callback for the press the menu answered is not taken as a new one.
@github-actions

Copy link
Copy Markdown
Contributor

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

@xbmc4lyfe

Copy link
Copy Markdown
Collaborator Author

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 28, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-29T00:50:23.826014Z 804e392 Manual request
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-code-quality

github-code-quality Bot commented Nov 28, 2026 •

Copy link
Copy Markdown

Code coverage overview

Languages: Python

Python / code-coverage/pytest

main b70e1a7 cancel-menu 804e392 +/-
92% 92% 0%
View coverage of the 3 most impacted files.
File main b70e1a7 cancel-menu 804e392 +/-
repo/plugin.vid...zbget_dialog.py 100% 96% -4%
repo/plugin.vid..._diagnostics.py 91% 91% 0%
repo/plugin.vid...get_resolver.py 96% 97% +1%

ℹ️ Calculations represent line coverage. Results may change as calculations are updated.


Updated November 29, 2026 00:52 UTC

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 4679c91d0c

ℹ️ 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".

… nothing

Back and a click on Cancel are read only through the Home property the
button sets; their late script callbacks are no longer a second press, so
a slow NZBGet status request can't reopen the menu. Escape and Stop, which
set no property, still come through onAction. Choosing to go back while the
finished files are being looked for no longer falls through to a new
submit.
@xbmc4lyfe

Copy link
Copy Markdown
Collaborator Author

@codex rereview

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 588c518083

ℹ️ 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".

The bulk fleet's completed-copy check (nzbget_bulk._use_completed) returned
its 'no readable video' error after the user chose to go back, which opened
the failure diagnosis. The resolver now ends with no message whenever the
user went back and no job was queued, on the fleet and plain paths alike.
@xbmc4lyfe

Copy link
Copy Markdown
Collaborator Author

@codex rereview

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Nice work!

Reviewed commit: 804e3925b1

ℹ️ 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".

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant