Skip to content

feat: playlist/Mix links download one video; Cancel button for downloads - #37

Merged
ThorSPB merged 1 commit into
mainfrom
fix/playlist-link-single-video
Oct 24, 2026
Merged

ThorSPB merged 1 commit into
mainfrom
fix/playlist-link-single-video

Conversation

@ThorSPB

@ThorSPB ThorSPB commented Oct 24, 2026

Copy link
Copy Markdown
Owner

What

Playlist and Mix links download one video. A Mix link shared from the YouTube app (playlist?list=RD<id>&playnext=1) left the app on "Starting download..." forever, reported from the church PC on 2026-10-24. yt-dlp took it as a whole playlist, and a Mix never ends. download_video now reduces every YouTube playlist link to one video:

  • v= / youtu.be/<id>: that video, with the list dropped
  • a Mix (list=RD<id>, YouTube Music RDAMVM<id>): the video it is named after, with no network lookup
  • a playlist that names no video: its first entry, from one flat playlist_items=1 lookup; an unreadable playlist is an error, not a hang
  • non-YouTube links and links without a list are unchanged

Cancel button (option A of the UI mockups the operator approved). While a manual download runs, its row's Download button becomes a red ✕ Cancel (Others row) or ✕ Cancel download (channel rows).

  • Pressing it frees the row at once and shows "Download cancelled."
  • download_video(cancel_event=...) stops at the next progress or postprocessor event, skips the player-client retry, and returns DOWNLOAD_CANCELLED.
  • It deletes only the files that run wrote: files new since it started and named after its video, such as .part, a finished video-only stream, .temp.mp4 or the pre-mp3 .webm. Anything already in the folder, and other downloads' files, stay.
  • Hosted override files stop and drop their .part file.
  • A new download on the same row first waits for the cancelled one to finish cleaning up, so the two never write the same files.

Verified

  • pytest: 340 passed. New tests cover link reduction, first-entry lookup, an unreadable playlist, cancel mid-download (only that run's files go, no retry), cancel before start, hosted-file cancel, the button toggle, a silent cancelled worker, a stale worker leaving a newer download alone, and a restart waiting for cleanup.
  • Live, against YouTube, from the Pi:
    • The reported Mix link downloaded only "Jertfa Ta Pe Golgota-Negativ" (4.17 MiB) in about 4 s. The mp3 conversion then failed only because the Pi has no ffmpeg; the release bundles it.
    • A real download cancelled at 2.0 of 9.7 MB stopped within a second. Its .part was deleted, a pre-existing file was kept, and there was no retry.
  • The real GUI code was rendered under Xvfb in the downloading and cancelled states, and it matches the approved mockup.

Not covered: automatic (Fri/Sat) downloads have no row button, so they can't be cancelled.

🤖 Generated with Claude Code

A Mix link shared from the YouTube app (playlist?list=RD<id>) left the app on
"Starting download..." forever: yt-dlp took it as a whole playlist, and a Mix
never ends. download_video now reduces any YouTube playlist link to one video:
the v= / youtu.be video, the video a Mix is named after (RD<id>, RDAMVM<id>),
or, for a playlist that names no video, its first entry (one flat lookup).

While a manual download runs, its row's Download button becomes a red Cancel
button. Cancelling frees the row at once; download_video stops at the next
progress or postprocessor event, skips the player-client retry, and deletes
the files that run wrote (new since it started, named after its video), never
anything that was already in the folder. Hosted override files stop and drop
their .part. A new download on the same row waits for that cleanup first.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@ThorSPB
ThorSPB merged commit c05ac9a into main Oct 24, 2026
5 checks passed
@ThorSPB
ThorSPB deleted the fix/playlist-link-single-video branch October 24, 2026 08:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant