mirror of
https://github.com/yt-dlp/yt-dlp.git
synced 2024-11-25 08:10:36 +01:00
Strip out internal fields such as _filename
from infojson (Closes #42)
:ci skip dl
This commit is contained in:
parent
9f888147de
commit
18590cecdb
@ -1136,9 +1136,10 @@ def ensure_dir_exists(path):
|
|||||||
if not self.params.get('overwrites', True) and os.path.exists(encodeFilename(infofn)):
|
if not self.params.get('overwrites', True) and os.path.exists(encodeFilename(infofn)):
|
||||||
self.to_screen('[info] Playlist metadata is already present')
|
self.to_screen('[info] Playlist metadata is already present')
|
||||||
else:
|
else:
|
||||||
self.to_screen('[info] Writing playlist metadata as JSON to: ' + infofn)
|
|
||||||
playlist_info = dict(ie_result)
|
playlist_info = dict(ie_result)
|
||||||
playlist_info.pop('entries')
|
# playlist_info['entries'] = list(playlist_info['entries']) # Entries is a generator which shouldnot be resolved here
|
||||||
|
del playlist_info['entries']
|
||||||
|
self.to_screen('[info] Writing playlist metadata as JSON to: ' + infofn)
|
||||||
try:
|
try:
|
||||||
write_json_file(self.filter_requested_info(playlist_info), infofn)
|
write_json_file(self.filter_requested_info(playlist_info), infofn)
|
||||||
except (OSError, IOError):
|
except (OSError, IOError):
|
||||||
@ -2464,9 +2465,10 @@ def download_with_info_file(self, info_filename):
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def filter_requested_info(info_dict):
|
def filter_requested_info(info_dict):
|
||||||
|
fields_to_remove = ('requested_formats', 'requested_subtitles')
|
||||||
return dict(
|
return dict(
|
||||||
(k, v) for k, v in info_dict.items()
|
(k, v) for k, v in info_dict.items()
|
||||||
if k not in ['requested_formats', 'requested_subtitles'])
|
if (k[0] != '_' or k == '_type') and k not in fields_to_remove)
|
||||||
|
|
||||||
def run_pp(self, pp, infodict, files_to_move={}):
|
def run_pp(self, pp, infodict, files_to_move={}):
|
||||||
files_to_delete = []
|
files_to_delete = []
|
||||||
|
@ -924,7 +924,7 @@ def _dict_from_multiple_values_options_callback(
|
|||||||
filesystem.add_option(
|
filesystem.add_option(
|
||||||
'--write-info-json',
|
'--write-info-json',
|
||||||
action='store_true', dest='writeinfojson', default=False,
|
action='store_true', dest='writeinfojson', default=False,
|
||||||
help='Write video metadata to a .info.json file')
|
help='Write video metadata to a .info.json file. Note that this may contain personal information')
|
||||||
filesystem.add_option(
|
filesystem.add_option(
|
||||||
'--no-write-info-json',
|
'--no-write-info-json',
|
||||||
action='store_false', dest='writeinfojson',
|
action='store_false', dest='writeinfojson',
|
||||||
|
Loading…
Reference in New Issue
Block a user