Add --download-sections flag to dub command for partial video dubbing#140
Merged
Conversation
Dub a slice of a YouTube/media-page source without fetching or dubbing the whole thing, e.g.: assembly --sandbox dub "https://youtube.com/watch?v=ID" -l de --video \ --download-sections "*0:00-15:00" The specs reach yt-dlp verbatim (same flag and syntax as transcribe's --download-sections); like --video, the flag is rejected for a local file rather than silently dropped (youtube.validate_sections_flag). https://claude.ai/code/session_01Uzv66SZ2xBW79wyMmgSDy7
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Adds support for the
--download-sectionsflag to thedubcommand, enabling users to download and dub only specific time slices of YouTube/media-page URLs using yt-dlp's section syntax.Changes
--download-sectionsflag to thedubcommand that accepts repeatable time-slice specifications (e.g.,"*0:00-15:00"for the first 15 minutes)validate_sections_flag()inyoutube.pyto ensure--download-sectionsis only used with downloadable URLs (YouTube, media pages, etc.), not local files or direct media URLsdownload_media()call indub_exec.pyto passdownload_sectionsto yt-dlp, which selectively fetches only the requested portionsassembly clipas an alternativeImplementation Details
The feature integrates with the existing
_ytdlp_options()helper which already supporteddownload_sectionsparameter. The validation mirrors the existingvalidate_video_flag()pattern, ensuring consistent error handling and user guidance. When sections are specified for a downloadable URL, they are passed directly to yt-dlp's--download-sectionsoption, allowing fine-grained control over what portions of media are fetched and dubbed.https://claude.ai/code/session_01Uzv66SZ2xBW79wyMmgSDy7