1
0
Fork 0
mirror of https://github.com/ytdl-org/youtube-dl.git synced 2024-05-19 11:39:28 +00:00

Save transitional filenames if keepvideo is set

This commit is contained in:
Zil0 2017-07-23 22:52:49 +02:00
parent c5a0627b96
commit 0948f25c26

View file

@ -1984,20 +1984,26 @@ class YoutubeDL(object):
if ie_info.get('__postprocessors') is not None: if ie_info.get('__postprocessors') is not None:
pps_chain.extend(ie_info['__postprocessors']) pps_chain.extend(ie_info['__postprocessors'])
pps_chain.extend(self._pps) pps_chain.extend(self._pps)
filepaths = []
for pp in pps_chain: for pp in pps_chain:
files_to_delete = [] files_to_delete = []
try: try:
files_to_delete, info = pp.run(info) files_to_delete, info = pp.run(info)
ie_info['_filename'] = info['filepath']
except PostProcessingError as e: except PostProcessingError as e:
self.report_error(e.msg) self.report_error(e.msg)
if files_to_delete and not self.params.get('keepvideo', False): if files_to_delete:
for old_filename in files_to_delete: if self.params.get('keepvideo'):
self.to_screen('Deleting original file %s (pass -k to keep)' % old_filename) filepaths.extend(files_to_delete)
try: else:
os.remove(encodeFilename(old_filename)) for old_filename in files_to_delete:
except (IOError, OSError): self.to_screen('Deleting original file %s (pass -k to keep)' % old_filename)
self.report_warning('Unable to remove downloaded original file') try:
os.remove(encodeFilename(old_filename))
except (IOError, OSError):
self.report_warning('Unable to remove downloaded original file')
if info.get('filepath'):
filepaths.append(info['filepath'])
ie_info['_filename'] = filepaths or filename
def _make_archive_id(self, info_dict): def _make_archive_id(self, info_dict):
# Future-proof against any change in case # Future-proof against any change in case