From 1ea241292770c6027b951aa045e00eadd140b9f5 Mon Sep 17 00:00:00 2001 From: pukkandan Date: Fri, 12 Feb 2021 10:10:31 +0530 Subject: [PATCH] Minor bugfixes * `__real_download` should be false when ffmpeg unavailable and no download * Mistakes in #70 * `allow_playlist_files` was not correctly pass through --- youtube_dlc/YoutubeDL.py | 8 +++++--- youtube_dlc/__init__.py | 1 + youtube_dlc/extractor/brightcove.py | 2 +- youtube_dlc/extractor/rtbf.py | 2 +- 4 files changed, 8 insertions(+), 5 deletions(-) diff --git a/youtube_dlc/YoutubeDL.py b/youtube_dlc/YoutubeDL.py index 922cf269bc..7c370efba2 100644 --- a/youtube_dlc/YoutubeDL.py +++ b/youtube_dlc/YoutubeDL.py @@ -2340,6 +2340,7 @@ class YoutubeDL(object): full_filename = correct_ext(full_filename) temp_filename = correct_ext(temp_filename) dl_filename = existing_file(full_filename, temp_filename) + info_dict['__real_download'] = False if dl_filename is None: for f in requested_formats: new_info = dict(info_dict) @@ -2351,12 +2352,13 @@ class YoutubeDL(object): return downloaded.append(fname) partial_success, real_download = dl(fname, new_info) + info_dict['__real_download'] = info_dict['__real_download'] or real_download success = success and partial_success if merger.available and not self.params.get('allow_unplayable_formats'): info_dict['__postprocessors'].append(merger) - info_dict['__files_to_merge'] = downloaded - # Even if there were no downloads, it is being merged only now - info_dict['__real_download'] = True + info_dict['__files_to_merge'] = downloaded + # Even if there were no downloads, it is being merged only now + info_dict['__real_download'] = True else: # Just a single file dl_filename = existing_file(full_filename, temp_filename) diff --git a/youtube_dlc/__init__.py b/youtube_dlc/__init__.py index 7b2e63fd3c..c681c8edbc 100644 --- a/youtube_dlc/__init__.py +++ b/youtube_dlc/__init__.py @@ -463,6 +463,7 @@ def _real_main(argv=None): 'writedescription': opts.writedescription, 'writeannotations': opts.writeannotations, 'writeinfojson': opts.writeinfojson or opts.getcomments, + 'allow_playlist_files': opts.allow_playlist_files, 'getcomments': opts.getcomments, 'writethumbnail': opts.writethumbnail, 'write_all_thumbnails': opts.write_all_thumbnails, diff --git a/youtube_dlc/extractor/brightcove.py b/youtube_dlc/extractor/brightcove.py index 901bfa5851..091992ebd3 100644 --- a/youtube_dlc/extractor/brightcove.py +++ b/youtube_dlc/extractor/brightcove.py @@ -482,7 +482,7 @@ class BrightcoveNewIE(AdobePassIE): if not self._downloader.params.get('allow_unplayable_formats') and (container == 'WVM' or source.get('key_systems')): num_drm_sources += 1 continue - elif ext == 'ism' and self._downloader.params.get('allow_unplayable_formats'): + elif ext == 'ism' and not self._downloader.params.get('allow_unplayable_formats'): continue elif ext == 'm3u8' or container == 'M2TS': if not src: diff --git a/youtube_dlc/extractor/rtbf.py b/youtube_dlc/extractor/rtbf.py index 3c6c656eab..2bb0acd5a5 100644 --- a/youtube_dlc/extractor/rtbf.py +++ b/youtube_dlc/extractor/rtbf.py @@ -125,7 +125,7 @@ class RTBFIE(InfoExtractor): }) mpd_url = data.get('urlDash') - if (not self._downloader.params.get('allow_unplayable_formats') and not data.get('drm')) and mpd_url: + if mpd_url and (self._downloader.params.get('allow_unplayable_formats') or not data.get('drm')): formats.extend(self._extract_mpd_formats( mpd_url, media_id, mpd_id='dash', fatal=False))