Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
# Rationalise the message. First, split the string into a list of
# lines, preserving \n\n (but not a standalone \n)
line_list = msg.split('\n\n')
# In each line, convert any standalone \n characters to whitespace.
# Then add new newline characters, if required, to give a maximum
# length per line
mod_list = []
for line in line_list:
mod_list.append(utils.tidy_up_long_string(line, 40))
# Finally combine everything into a single string, as before
double = '\n\n'
msg = double.join(mod_list)
# ...and display the message dialogue
dialogue_win = MessageDialogue(
self,
msg,
msg_type,
button_type,
parent_win_obj,
response_dict,
)
dialogue_win.create_dialogue()
return dialogue_win
OptionHolder('include_ads', '--include-ads', False),
# DOWNLOAD OPTIONS
# -r, --limit-rate RATE
OptionHolder('limit_rate', '-r', ''),
# -R, --retries RETRIES
OptionHolder('retries', '-R', 10),
# --playlist-reverse
OptionHolder('playlist_reverse', '--playlist-reverse', False),
# --playlist-random
OptionHolder('playlist_random', '--playlist-random', False),
# --hls-prefer-native
OptionHolder('native_hls', '--hls-prefer-native', False),
# --hls-prefer-ffmpeg
OptionHolder('hls_prefer_ffmpeg', '--hls-prefer-ffmpeg', False),
# --external-downloader COMMAND
OptionHolder('external_downloader', '--external-downloader', ''),
# --external-downloader-args ARGS
OptionHolder(
'external_arg_string',
'--external-downloader-args',
'',
),
# FILESYSTEM OPTIONS
# -o, --output TEMPLATE
OptionHolder('save_path', '-o', ''),
# --restrict-filenames
OptionHolder('restrict_filenames', '--restrict-filenames', False),
# --no-mtime
OptionHolder('nomtime', '--no-mtime', False),
# --write-description
OptionHolder('write_description', '--write-description', False),
# --write-info-json
# --max-downloads NUMBER
OptionHolder('max_downloads', '--max-downloads', 0),
# --min-filesize SIZE
OptionHolder('min_filesize', '--min-filesize', 0),
# --max-filesize SIZE
OptionHolder('max_filesize', '--max-filesize', 0),
# --date DATE
OptionHolder('date', '--date', ''),
# --datebefore DATE
OptionHolder('date_before', '--datebefore', ''),
# --dateafter DATE
OptionHolder('date_after', '--dateafter', ''),
# --min-views COUNT
OptionHolder('min_views', '--min-views', 0),
# --max-views COUNT
OptionHolder('max_views', '--max-views', 0),
# --match-filter FILTER
OptionHolder('match_filter', '--match-filter', ''),
# --age-limit YEARS
OptionHolder('age_limit', '--age-limit', ''),
# --include-ads FILTER
OptionHolder('include_ads', '--include-ads', False),
# DOWNLOAD OPTIONS
# -r, --limit-rate RATE
OptionHolder('limit_rate', '-r', ''),
# -R, --retries RETRIES
OptionHolder('retries', '-R', 10),
# --playlist-reverse
OptionHolder('playlist_reverse', '--playlist-reverse', False),
# --playlist-random
OptionHolder('playlist_random', '--playlist-random', False),
# --hls-prefer-native
# youtube-dl's options list
self.option_holder_list = [
# OPTIONS
# -i, --ignore-errors
OptionHolder('ignore_errors', '-i', False),
# --abort-on-error
OptionHolder('abort_on_error', '--abort-on-error ', False),
# NETWORK OPTIONS
# --proxy URL
OptionHolder('proxy', '--proxy', ''),
OptionHolder('socket_timeout', '--socket-timeout', ''),
OptionHolder('source_address', '--source-address', ''),
OptionHolder('force_ipv4', '--force-ipv4', False),
OptionHolder('force_ipv6', '--force-ipv6', False),
# GEO-RESTRICTION
OptionHolder(
'geo_verification_proxy',
'--geo-verification-proxy',
'',
),
OptionHolder('geo_bypass', '--geo-bypass', False),
OptionHolder('no_geo_bypass', '--no-geo-bypass', False),
OptionHolder('geo_bypass_country', '--geo-bypass-country', ''),
OptionHolder('geo_bypass_ip_block', '--geo-bypass-ip-block', ''),
# VIDEO SELECTION
# --playlist-start NUMBER
OptionHolder('playlist_start', '--playlist-start', 1),
# --playlist-end NUMBER
OptionHolder('playlist_end', '--playlist-end', 0),
# --max-downloads NUMBER
OptionHolder('max_downloads', '--max-downloads', 0),
# --min-filesize SIZE
OptionHolder('geo_bypass_ip_block', '--geo-bypass-ip-block', ''),
# VIDEO SELECTION
# --playlist-start NUMBER
OptionHolder('playlist_start', '--playlist-start', 1),
# --playlist-end NUMBER
OptionHolder('playlist_end', '--playlist-end', 0),
# --max-downloads NUMBER
OptionHolder('max_downloads', '--max-downloads', 0),
# --min-filesize SIZE
OptionHolder('min_filesize', '--min-filesize', 0),
# --max-filesize SIZE
OptionHolder('max_filesize', '--max-filesize', 0),
# --date DATE
OptionHolder('date', '--date', ''),
# --datebefore DATE
OptionHolder('date_before', '--datebefore', ''),
# --dateafter DATE
OptionHolder('date_after', '--dateafter', ''),
# --min-views COUNT
OptionHolder('min_views', '--min-views', 0),
# --max-views COUNT
OptionHolder('max_views', '--max-views', 0),
# --match-filter FILTER
OptionHolder('match_filter', '--match-filter', ''),
# --age-limit YEARS
OptionHolder('age_limit', '--age-limit', ''),
# --include-ads FILTER
OptionHolder('include_ads', '--include-ads', False),
# DOWNLOAD OPTIONS
# -r, --limit-rate RATE
OptionHolder('limit_rate', '-r', ''),
# -R, --retries RETRIES
OptionHolder(
'geo_verification_proxy',
'--geo-verification-proxy',
'',
),
OptionHolder('geo_bypass', '--geo-bypass', False),
OptionHolder('no_geo_bypass', '--no-geo-bypass', False),
OptionHolder('geo_bypass_country', '--geo-bypass-country', ''),
OptionHolder('geo_bypass_ip_block', '--geo-bypass-ip-block', ''),
# VIDEO SELECTION
# --playlist-start NUMBER
OptionHolder('playlist_start', '--playlist-start', 1),
# --playlist-end NUMBER
OptionHolder('playlist_end', '--playlist-end', 0),
# --max-downloads NUMBER
OptionHolder('max_downloads', '--max-downloads', 0),
# --min-filesize SIZE
OptionHolder('min_filesize', '--min-filesize', 0),
# --max-filesize SIZE
OptionHolder('max_filesize', '--max-filesize', 0),
# --date DATE
OptionHolder('date', '--date', ''),
# --datebefore DATE
OptionHolder('date_before', '--datebefore', ''),
# --dateafter DATE
OptionHolder('date_after', '--dateafter', ''),
# --min-views COUNT
OptionHolder('min_views', '--min-views', 0),
# --max-views COUNT
OptionHolder('max_views', '--max-views', 0),
# --match-filter FILTER
OptionHolder('match_filter', '--match-filter', ''),
# IV list - other
# ---------------
# List of options.OptionHolder objects, with their initial settings
# The options here are in the same order in which they appear in
# youtube-dl's options list
self.option_holder_list = [
# OPTIONS
# -i, --ignore-errors
OptionHolder('ignore_errors', '-i', False),
# --abort-on-error
OptionHolder('abort_on_error', '--abort-on-error ', False),
# NETWORK OPTIONS
# --proxy URL
OptionHolder('proxy', '--proxy', ''),
OptionHolder('socket_timeout', '--socket-timeout', ''),
OptionHolder('source_address', '--source-address', ''),
OptionHolder('force_ipv4', '--force-ipv4', False),
OptionHolder('force_ipv6', '--force-ipv6', False),
# GEO-RESTRICTION
OptionHolder(
'geo_verification_proxy',
'--geo-verification-proxy',
'',
),
OptionHolder('geo_bypass', '--geo-bypass', False),
OptionHolder('no_geo_bypass', '--no-geo-bypass', False),
OptionHolder('geo_bypass_country', '--geo-bypass-country', ''),
OptionHolder('geo_bypass_ip_block', '--geo-bypass-ip-block', ''),
# VIDEO SELECTION
# --playlist-start NUMBER
OptionHolder('date_after', '--dateafter', ''),
# --min-views COUNT
OptionHolder('min_views', '--min-views', 0),
# --max-views COUNT
OptionHolder('max_views', '--max-views', 0),
# --match-filter FILTER
OptionHolder('match_filter', '--match-filter', ''),
# --age-limit YEARS
OptionHolder('age_limit', '--age-limit', ''),
# --include-ads FILTER
OptionHolder('include_ads', '--include-ads', False),
# DOWNLOAD OPTIONS
# -r, --limit-rate RATE
OptionHolder('limit_rate', '-r', ''),
# -R, --retries RETRIES
OptionHolder('retries', '-R', 10),
# --playlist-reverse
OptionHolder('playlist_reverse', '--playlist-reverse', False),
# --playlist-random
OptionHolder('playlist_random', '--playlist-random', False),
# --hls-prefer-native
OptionHolder('native_hls', '--hls-prefer-native', False),
# --hls-prefer-ffmpeg
OptionHolder('hls_prefer_ffmpeg', '--hls-prefer-ffmpeg', False),
# --external-downloader COMMAND
OptionHolder('external_downloader', '--external-downloader', ''),
# --external-downloader-args ARGS
OptionHolder(
'external_arg_string',
'--external-downloader-args',
'',
),
OptionHolder('pp_args', '--postprocessor-args', ''),
# -k, --keep-video
OptionHolder('keep_video', '-k', False),
# --embed-subs
OptionHolder(
'embed_subs',
'--embed-subs',
False,
['write_auto_subs', 'write_subs'],
),
# --embed-thumbnail
OptionHolder('embed_thumbnail', '--embed-thumbnail', False),
# --add-metadata
OptionHolder('add_metadata', '--add-metadata', False),
# --fixup POLICY
OptionHolder('fixup_policy', '--fixup', ''),
# --prefer-avconv
OptionHolder('prefer_avconv', '--prefer-avconv', False),
# --prefer-ffmpeg
OptionHolder('prefer_ffmpeg', '--prefer-ffmpeg', False),
# YOUTUBE-DL-GUI OPTIONS (not given an options.OptionHolder object)
OptionHolder('match_filter', '--match-filter', ''),
# --age-limit YEARS
OptionHolder('age_limit', '--age-limit', ''),
# --include-ads FILTER
OptionHolder('include_ads', '--include-ads', False),
# DOWNLOAD OPTIONS
# -r, --limit-rate RATE
OptionHolder('limit_rate', '-r', ''),
# -R, --retries RETRIES
OptionHolder('retries', '-R', 10),
# --playlist-reverse
OptionHolder('playlist_reverse', '--playlist-reverse', False),
# --playlist-random
OptionHolder('playlist_random', '--playlist-random', False),
# --hls-prefer-native
OptionHolder('native_hls', '--hls-prefer-native', False),
# --hls-prefer-ffmpeg
OptionHolder('hls_prefer_ffmpeg', '--hls-prefer-ffmpeg', False),
# --external-downloader COMMAND
OptionHolder('external_downloader', '--external-downloader', ''),
# --external-downloader-args ARGS
OptionHolder(
'external_arg_string',
'--external-downloader-args',
'',
),
# FILESYSTEM OPTIONS
# -o, --output TEMPLATE
OptionHolder('save_path', '-o', ''),
# --restrict-filenames
OptionHolder('restrict_filenames', '--restrict-filenames', False),
# --no-mtime