mirror of
https://github.com/ytdl-org/youtube-dl
synced 2024-11-27 13:06:49 +01:00
Save transitional filenames if keepvideo is set
This commit is contained in:
parent
c5a0627b96
commit
0948f25c26
@ -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:
|
||||||
|
if self.params.get('keepvideo'):
|
||||||
|
filepaths.extend(files_to_delete)
|
||||||
|
else:
|
||||||
for old_filename in files_to_delete:
|
for old_filename in files_to_delete:
|
||||||
self.to_screen('Deleting original file %s (pass -k to keep)' % old_filename)
|
self.to_screen('Deleting original file %s (pass -k to keep)' % old_filename)
|
||||||
try:
|
try:
|
||||||
os.remove(encodeFilename(old_filename))
|
os.remove(encodeFilename(old_filename))
|
||||||
except (IOError, OSError):
|
except (IOError, OSError):
|
||||||
self.report_warning('Unable to remove downloaded original file')
|
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
|
||||||
|
Loading…
Reference in New Issue
Block a user