mirror of
https://github.com/alexta69/metube.git
synced 2026-03-03 00:27:01 +00:00
fix filepath regression
This commit is contained in:
16
app/ytdl.py
16
app/ytdl.py
@@ -144,7 +144,21 @@ class Download:
|
||||
|
||||
def put_status_postprocessor(d):
|
||||
if d['postprocessor'] == 'MoveFiles' and d['status'] == 'finished':
|
||||
filename = d['info_dict']['filepath']
|
||||
filepath = d['info_dict']['filepath']
|
||||
if '__finaldir' in d['info_dict']:
|
||||
finaldir = d['info_dict']['__finaldir']
|
||||
# Compute relative path from temp dir to preserve
|
||||
# subdirectory structure from the output template.
|
||||
try:
|
||||
rel_path = os.path.relpath(filepath, self.temp_dir)
|
||||
except ValueError:
|
||||
rel_path = os.path.basename(filepath)
|
||||
if rel_path.startswith('..'):
|
||||
# filepath is not under temp_dir, fall back to basename
|
||||
rel_path = os.path.basename(filepath)
|
||||
filename = os.path.join(finaldir, rel_path)
|
||||
else:
|
||||
filename = filepath
|
||||
self.status_queue.put({'status': 'finished', 'filename': filename})
|
||||
|
||||
# Capture all chapter files when SplitChapters finishes
|
||||
|
||||
Reference in New Issue
Block a user