|
|
@ -1815,7 +1815,7 @@ class YoutubeDL(object):
|
|
|
|
ie_result['entries'] = playlist_results
|
|
|
|
ie_result['entries'] = playlist_results
|
|
|
|
|
|
|
|
|
|
|
|
# Write the updated info to json
|
|
|
|
# Write the updated info to json
|
|
|
|
if _infojson_written and self._write_info_json(
|
|
|
|
if _infojson_written is True and self._write_info_json(
|
|
|
|
'updated playlist', ie_result,
|
|
|
|
'updated playlist', ie_result,
|
|
|
|
self.prepare_filename(ie_copy, 'pl_infojson'), overwrite=True) is None:
|
|
|
|
self.prepare_filename(ie_copy, 'pl_infojson'), overwrite=True) is None:
|
|
|
|
return
|
|
|
|
return
|
|
|
@ -3786,7 +3786,7 @@ class YoutubeDL(object):
|
|
|
|
return encoding
|
|
|
|
return encoding
|
|
|
|
|
|
|
|
|
|
|
|
def _write_info_json(self, label, ie_result, infofn, overwrite=None):
|
|
|
|
def _write_info_json(self, label, ie_result, infofn, overwrite=None):
|
|
|
|
''' Write infojson and returns True = written, False = skip, None = error '''
|
|
|
|
''' Write infojson and returns True = written, 'exists' = Already exists, False = skip, None = error '''
|
|
|
|
if overwrite is None:
|
|
|
|
if overwrite is None:
|
|
|
|
overwrite = self.params.get('overwrites', True)
|
|
|
|
overwrite = self.params.get('overwrites', True)
|
|
|
|
if not self.params.get('writeinfojson'):
|
|
|
|
if not self.params.get('writeinfojson'):
|
|
|
@ -3798,14 +3798,15 @@ class YoutubeDL(object):
|
|
|
|
return None
|
|
|
|
return None
|
|
|
|
elif not overwrite and os.path.exists(infofn):
|
|
|
|
elif not overwrite and os.path.exists(infofn):
|
|
|
|
self.to_screen(f'[info] {label.title()} metadata is already present')
|
|
|
|
self.to_screen(f'[info] {label.title()} metadata is already present')
|
|
|
|
else:
|
|
|
|
return 'exists'
|
|
|
|
self.to_screen(f'[info] Writing {label} metadata as JSON to: {infofn}')
|
|
|
|
|
|
|
|
try:
|
|
|
|
self.to_screen(f'[info] Writing {label} metadata as JSON to: {infofn}')
|
|
|
|
write_json_file(self.sanitize_info(ie_result, self.params.get('clean_infojson', True)), infofn)
|
|
|
|
try:
|
|
|
|
except (OSError, IOError):
|
|
|
|
write_json_file(self.sanitize_info(ie_result, self.params.get('clean_infojson', True)), infofn)
|
|
|
|
self.report_error(f'Cannot write {label} metadata to JSON file {infofn}')
|
|
|
|
return True
|
|
|
|
return None
|
|
|
|
except (OSError, IOError):
|
|
|
|
return True
|
|
|
|
self.report_error(f'Cannot write {label} metadata to JSON file {infofn}')
|
|
|
|
|
|
|
|
return None
|
|
|
|
|
|
|
|
|
|
|
|
def _write_description(self, label, ie_result, descfn):
|
|
|
|
def _write_description(self, label, ie_result, descfn):
|
|
|
|
''' Write description and returns True = written, False = skip, None = error '''
|
|
|
|
''' Write description and returns True = written, False = skip, None = error '''
|
|
|
|