mirror of
https://github.com/meeb/tubesync.git
synced 2025-06-23 21:46:44 +00:00
Let deepcopy do more work for us
This commit is contained in:
parent
b40626f9dc
commit
803319fe9f
@ -212,8 +212,8 @@ def download_media(url, media_format, extension, output_file, info_json,
|
||||
hook.download_progress = 0
|
||||
|
||||
default_opts = yt_dlp.parse_options([]).options
|
||||
pp_opts = deepcopy(default_opts.__dict__)
|
||||
pp_opts.update({
|
||||
pp_opts = deepcopy(default_opts)
|
||||
pp_opts.__dict__.update({
|
||||
'embedthumbnail': embed_thumbnail,
|
||||
'addmetadata': embed_metadata,
|
||||
'addchapters': True,
|
||||
@ -222,8 +222,8 @@ def download_media(url, media_format, extension, output_file, info_json,
|
||||
})
|
||||
|
||||
if skip_sponsors:
|
||||
pp_opts['sponsorblock_mark'].update('all,-chapter'.split(','))
|
||||
pp_opts['sponsorblock_remove'].update(sponsor_categories or {})
|
||||
pp_opts.sponsorblock_mark.update('all,-chapter'.split(','))
|
||||
pp_opts.sponsorblock_remove.update(sponsor_categories or {})
|
||||
|
||||
ytopts = {
|
||||
'format': media_format,
|
||||
@ -261,13 +261,6 @@ def download_media(url, media_format, extension, output_file, info_json,
|
||||
'modifychapters+ffmpeg': codec_options,
|
||||
})
|
||||
|
||||
# clean-up incompatible keys
|
||||
pp_opts = {k: v for k, v in pp_opts.items() if not k.startswith('_')}
|
||||
|
||||
# convert dict to namedtuple
|
||||
yt_dlp_opts = namedtuple('yt_dlp_opts', pp_opts)
|
||||
pp_opts = yt_dlp_opts(**pp_opts)
|
||||
|
||||
# create the post processors list
|
||||
ytopts['postprocessors'] = list(yt_dlp.get_postprocessors(pp_opts))
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user