[BACKEND] Replicate yt-dlp postprocessor flags better for sponsorblock

This commit is contained in:
Jesse Bannon 2025-09-28 13:45:06 -07:00
parent 2deafc9f2d
commit fa4ab6075b

View file

@ -235,7 +235,7 @@ class ChaptersPlugin(Plugin[ChaptersOptions]):
"postprocessors": [ "postprocessors": [
{ {
"key": "SponsorBlock", "key": "SponsorBlock",
"when": "pre_process", "when": "after_filter",
"categories": self.plugin_options.sponsorblock_categories, "categories": self.plugin_options.sponsorblock_categories,
}, },
{"key": "ModifyChapters"}, {"key": "ModifyChapters"},
@ -280,6 +280,20 @@ class ChaptersPlugin(Plugin[ChaptersOptions]):
} }
) )
# Add this to the end to fully replicate sponsorblock chapter removal in yt-dlp
# reference: yt-dlp/devscripts/cli_to_api.py --sponsorblock-remove all --embed-chapters
if self._is_removing_chapters:
builder.add(
{
"postprocessors": [
{'key': 'FFmpegConcat',
'only_multi_video': True,
'when': 'playlist'}
]
}
)
return builder.to_dict() return builder.to_dict()
def _get_removed_chapters(self, entry: Entry) -> List[str]: def _get_removed_chapters(self, entry: Entry) -> List[str]: