1
0
mirror of https://github.com/yt-dlp/yt-dlp.git synced 2025-10-31 14:45:14 +00:00

[SponsorBlock] Add Filler and Highlight categories (#1664)

Authored by: nihil-admirari, pukkandan
This commit is contained in:
Nil Admirari
2021-12-09 12:40:31 +00:00
committed by GitHub
parent b1aaf1c07f
commit 8157a09d22
5 changed files with 42 additions and 23 deletions

View File

@@ -1465,20 +1465,29 @@ def parseOpts(overrideArguments=None):
sponsorblock.add_option(
'--sponsorblock-mark', metavar='CATS',
dest='sponsorblock_mark', default=set(), action='callback', type='str',
callback=_set_from_options_callback, callback_kwargs={'allowed_values': SponsorBlockPP.CATEGORIES.keys()},
help=(
callback=_set_from_options_callback, callback_kwargs={
'allowed_values': SponsorBlockPP.CATEGORIES.keys(),
'aliases': {'default': ['all']}
}, help=(
'SponsorBlock categories to create chapters for, separated by commas. '
'Available categories are all, %s. You can prefix the category with a "-" to exempt it. '
'See https://wiki.sponsor.ajay.app/index.php/Segment_Categories for description of the categories. '
'Eg: --sponsorblock-mark all,-preview' % ', '.join(SponsorBlockPP.CATEGORIES.keys())))
f'Available categories are all, default(=all), {", ".join(SponsorBlockPP.CATEGORIES.keys())}. '
'You can prefix the category with a "-" to exempt it. See [1] for description of the categories. '
'Eg: --sponsorblock-mark all,-preview [1] https://wiki.sponsor.ajay.app/w/Segment_Categories'))
sponsorblock.add_option(
'--sponsorblock-remove', metavar='CATS',
dest='sponsorblock_remove', default=set(), action='callback', type='str',
callback=_set_from_options_callback, callback_kwargs={'allowed_values': SponsorBlockPP.CATEGORIES.keys()},
help=(
callback=_set_from_options_callback, callback_kwargs={
'allowed_values': set(SponsorBlockPP.CATEGORIES.keys()) - set(SponsorBlockPP.POI_CATEGORIES.keys()),
# Note: From https://wiki.sponsor.ajay.app/w/Types:
# The filler category is very aggressive.
# It is strongly recommended to not use this in a client by default.
'aliases': {'default': ['all', '-filler']}
}, help=(
'SponsorBlock categories to be removed from the video file, separated by commas. '
'If a category is present in both mark and remove, remove takes precedence. '
'The syntax and available categories are the same as for --sponsorblock-mark'))
'The syntax and available categories are the same as for --sponsorblock-mark '
'except that "default" refers to "all,-filler" '
f'and {", ".join(SponsorBlockPP.POI_CATEGORIES.keys())} is not available'))
sponsorblock.add_option(
'--sponsorblock-chapter-title', metavar='TEMPLATE',
default=DEFAULT_SPONSORBLOCK_CHAPTER_TITLE, dest='sponsorblock_chapter_title',