mirror of
https://github.com/alexta69/metube.git
synced 2026-09-21 21:45:04 +00:00
feat: first-class SponsorBlock toggle
A "Remove sponsor segments" switch next to "Split by chapters" queues the download with the same postprocessor pair the CLI's --sponsorblock-remove sponsor builds (SponsorBlock + ModifyChapters). The flag persists as a cookie like the other form options, survives in the queue records, and is carried into retries. The pair is registered above the chapter-splitting block: yt-dlp runs same-stage postprocessors in list order, so ModifyChapters has to rewrite the chapter list before FFmpegSplitChapters cuts the file up, matching what the CLI builds for --sponsorblock-remove sponsor --split-chapters. With both toggles on the other way around the chapter files keep the sponsor segments and the removal desyncs the remaining chapter timings. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -725,6 +725,7 @@ def parse_download_options(post: dict) -> dict:
|
||||
playlist_item_limit = post.get('playlist_item_limit')
|
||||
auto_start = post.get('auto_start')
|
||||
split_by_chapters = post.get('split_by_chapters')
|
||||
sponsorblock = bool(post.get('sponsorblock'))
|
||||
chapter_template = post.get('chapter_template')
|
||||
subtitle_language = post.get('subtitle_language')
|
||||
subtitle_mode = post.get('subtitle_mode')
|
||||
@@ -845,6 +846,7 @@ def parse_download_options(post: dict) -> dict:
|
||||
'playlist_item_limit': playlist_item_limit,
|
||||
'auto_start': auto_start,
|
||||
'split_by_chapters': split_by_chapters,
|
||||
'sponsorblock': sponsorblock,
|
||||
'chapter_template': chapter_template,
|
||||
'subtitle_language': subtitle_language,
|
||||
'subtitle_mode': subtitle_mode,
|
||||
@@ -890,6 +892,7 @@ async def add(request):
|
||||
o['ytdl_options_overrides'],
|
||||
o['clip_start'],
|
||||
o['clip_end'],
|
||||
sponsorblock=o['sponsorblock'],
|
||||
)
|
||||
return web.Response(text=serializer.encode(status))
|
||||
|
||||
|
||||
Reference in New Issue
Block a user