More consistent warning messages (#173)

Co-authored by: Damiano Amatruda <damiano.amatruda@outlook.com>
This commit is contained in:
pukkandan 2021-03-20 08:50:08 +05:30
parent cd9b384cc3
commit beb4b92a66
No known key found for this signature in database
GPG key ID: 0F00D95A001F4698
8 changed files with 21 additions and 16 deletions

View file

@ -63,6 +63,8 @@ def real_download(self, filename, info_dict):
}) })
if real_downloader: if real_downloader:
self.to_screen(
'[%s] Fragment downloads will be delegated to %s' % (self.FD_NAME, real_downloader.get_basename()))
info_copy = info_dict.copy() info_copy = info_dict.copy()
info_copy['fragments'] = fragments_to_download info_copy['fragments'] = fragments_to_download
fd = real_downloader(self.ydl, self.params) fd = real_downloader(self.ydl, self.params)
@ -110,7 +112,7 @@ def download_fragment(fragment):
if count > fragment_retries: if count > fragment_retries:
if not fatal: if not fatal:
return False, frag_index return False, frag_index
self.report_error('giving up after %s fragment retries' % fragment_retries) self.report_error('Giving up after %s fragment retries' % fragment_retries)
return False, frag_index return False, frag_index
return frag_content, frag_index return frag_content, frag_index

View file

@ -83,14 +83,13 @@ def real_download(self, filename, info_dict):
if not self.can_download(s, info_dict, self.params.get('allow_unplayable_formats')): if not self.can_download(s, info_dict, self.params.get('allow_unplayable_formats')):
if info_dict.get('extra_param_to_segment_url') or info_dict.get('_decryption_key_url'): if info_dict.get('extra_param_to_segment_url') or info_dict.get('_decryption_key_url'):
self.report_error('pycryptodome not found. Please install it.') self.report_error('pycryptodome not found. Please install')
return False return False
if self.can_download(s, info_dict, with_crypto=True): if self.can_download(s, info_dict, with_crypto=True):
self.report_warning('pycryptodome is needed to download this file with hlsnative') self.report_warning('pycryptodome is needed to download this file natively')
self.report_warning(
'hlsnative has detected features it does not support, '
'extraction will be delegated to ffmpeg')
fd = FFmpegFD(self.ydl, self.params) fd = FFmpegFD(self.ydl, self.params)
self.report_warning(
'%s detected unsupported features; extraction will be delegated to %s' % (self.FD_NAME, fd.get_basename()))
# TODO: Make progress updates work without hooking twice # TODO: Make progress updates work without hooking twice
# for ph in self._progress_hooks: # for ph in self._progress_hooks:
# fd.add_progress_hook(ph) # fd.add_progress_hook(ph)
@ -99,6 +98,9 @@ def real_download(self, filename, info_dict):
real_downloader = _get_real_downloader(info_dict, 'frag_urls', self.params, None) real_downloader = _get_real_downloader(info_dict, 'frag_urls', self.params, None)
if real_downloader and not real_downloader.supports_manifest(s): if real_downloader and not real_downloader.supports_manifest(s):
real_downloader = None real_downloader = None
if real_downloader:
self.to_screen(
'[%s] Fragment downloads will be delegated to %s' % (self.FD_NAME, real_downloader.get_basename()))
def is_ad_fragment_start(s): def is_ad_fragment_start(s):
return (s.startswith('#ANVATO-SEGMENT-INFO') and 'type=ad' in s return (s.startswith('#ANVATO-SEGMENT-INFO') and 'type=ad' in s
@ -186,7 +188,7 @@ def is_ad_fragment_end(s):
continue continue
if frag_index > 0: if frag_index > 0:
self.report_error( self.report_error(
'initialization fragment found after media fragments, unable to download') 'Initialization fragment found after media fragments, unable to download')
return False return False
frag_index += 1 frag_index += 1
map_info = parse_m3u8_attributes(line[11:]) map_info = parse_m3u8_attributes(line[11:])
@ -289,6 +291,7 @@ def download_fragment(fragment):
if count <= fragment_retries: if count <= fragment_retries:
self.report_retry_fragment(err, frag_index, count, fragment_retries) self.report_retry_fragment(err, frag_index, count, fragment_retries)
if count > fragment_retries: if count > fragment_retries:
self.report_error('Giving up after %s fragment retries' % fragment_retries)
return False, frag_index return False, frag_index
if decrypt_info['METHOD'] == 'AES-128': if decrypt_info['METHOD'] == 'AES-128':

View file

@ -117,7 +117,7 @@ def run_rtmpdump(args):
# Check for rtmpdump first # Check for rtmpdump first
if not check_executable('rtmpdump', ['-h']): if not check_executable('rtmpdump', ['-h']):
self.report_error('RTMP download detected but "rtmpdump" could not be run. Please install it.') self.report_error('RTMP download detected but "rtmpdump" could not be run. Please install')
return False return False
# Download using rtmpdump. rtmpdump returns exit code 2 when # Download using rtmpdump. rtmpdump returns exit code 2 when

View file

@ -24,7 +24,7 @@ def real_download(self, filename, info_dict):
args = [ args = [
'mpv', '-really-quiet', '--vo=null', '--stream-dump=' + tmpfilename, url] 'mpv', '-really-quiet', '--vo=null', '--stream-dump=' + tmpfilename, url]
else: else:
self.report_error('MMS or RTSP download detected but neither "mplayer" nor "mpv" could be run. Please install any.') self.report_error('MMS or RTSP download detected but neither "mplayer" nor "mpv" could be run. Please install one')
return False return False
self._debug_cmd(args) self._debug_cmd(args)

View file

@ -146,7 +146,7 @@ def _real_extract(self, url):
expected=True) expected=True)
elif not pycryptodomex_found: elif not pycryptodomex_found:
raise ExtractorError( raise ExtractorError(
'pycryptodomex not found. Please install it.', 'pycryptodomex not found. Please install',
expected=True) expected=True)
elif message: elif message:
extractor_msg += ': ' + message extractor_msg += ': ' + message

View file

@ -135,7 +135,7 @@ def is_webp(path):
x for x in ['AtomicParsley', 'atomicparsley'] x for x in ['AtomicParsley', 'atomicparsley']
if check_executable(x, ['-v'])), None) if check_executable(x, ['-v'])), None)
if atomicparsley is None: if atomicparsley is None:
raise EmbedThumbnailPPError('AtomicParsley was not found. Please install.') raise EmbedThumbnailPPError('AtomicParsley was not found. Please install')
cmd = [encodeFilename(atomicparsley, True), cmd = [encodeFilename(atomicparsley, True),
encodeFilename(filename, True), encodeFilename(filename, True),

View file

@ -61,7 +61,7 @@ def __init__(self, downloader=None):
def check_version(self): def check_version(self):
if not self.available: if not self.available:
raise FFmpegPostProcessorError('ffmpeg not found. Please install') raise FFmpegPostProcessorError('ffmpeg not found. Please install or provide the path using --ffmpeg-location')
required_version = '10-0' if self.basename == 'avconv' else '1.0' required_version = '10-0' if self.basename == 'avconv' else '1.0'
if is_outdated_version( if is_outdated_version(
@ -165,7 +165,7 @@ def probe_executable(self):
def get_audio_codec(self, path): def get_audio_codec(self, path):
if not self.probe_available and not self.available: if not self.probe_available and not self.available:
raise PostProcessingError('ffprobe and ffmpeg not found. Please install') raise PostProcessingError('ffprobe and ffmpeg not found. Please install or provide the path using --ffmpeg-location')
try: try:
if self.probe_available: if self.probe_available:
cmd = [ cmd = [
@ -207,7 +207,7 @@ def get_metadata_object(self, path, opts=[]):
if self.probe_basename != 'ffprobe': if self.probe_basename != 'ffprobe':
if self.probe_available: if self.probe_available:
self.report_warning('Only ffprobe is supported for metadata extraction') self.report_warning('Only ffprobe is supported for metadata extraction')
raise PostProcessingError('ffprobe not found. Please install.') raise PostProcessingError('ffprobe not found. Please install or provide the path using --ffmpeg-location')
self.check_version() self.check_version()
cmd = [ cmd = [
@ -802,7 +802,7 @@ def _ffmpeg_args_for_chapter(self, number, chapter, info):
def run(self, info): def run(self, info):
chapters = info.get('chapters') or [] chapters = info.get('chapters') or []
if not chapters: if not chapters:
self.report_warning('There are no tracks to extract') self.report_warning('Chapter information is unavailable')
return [], info return [], info
self.to_screen('Splitting video by chapters; %d chapters found' % len(chapters)) self.to_screen('Splitting video by chapters; %d chapters found' % len(chapters))

View file

@ -32,7 +32,7 @@ def __init__(self, downloader, path='', args=None, ignoreerror=False, cut=False,
if path: if path:
raise PostProcessingError('sponskrub not found in "%s"' % path) raise PostProcessingError('sponskrub not found in "%s"' % path)
else: else:
raise PostProcessingError('sponskrub not found. Please install or provide the path using --sponskrub-path.') raise PostProcessingError('sponskrub not found. Please install or provide the path using --sponskrub-path')
def get_exe(self, path=''): def get_exe(self, path=''):
if not path or not check_executable(path, ['-h']): if not path or not check_executable(path, ['-h']):