| 461 | )}) |
| 462 | |
| 463 | def put_status_postprocessor(d): |
| 464 | if d['postprocessor'] == 'MoveFiles' and d['status'] == 'finished': |
| 465 | filepath = d['info_dict']['filepath'] |
| 466 | if '__finaldir' in d['info_dict']: |
| 467 | finaldir = d['info_dict']['__finaldir'] |
| 468 | filename = os.path.join(finaldir, os.path.basename(filepath)) |
| 469 | else: |
| 470 | filename = filepath |
| 471 | self.status_queue.put({'status': 'finished', 'filename': filename}) |
| 472 | # For captions-only downloads, yt-dlp may still report a media-like |
| 473 | # filepath in MoveFiles. Capture subtitle outputs explicitly so the |
| 474 | # UI can link to real caption files. |
| 475 | if getattr(self.info, 'download_type', '') == 'captions': |
| 476 | requested_subtitles = d.get('info_dict', {}).get('requested_subtitles', {}) or {} |
| 477 | for subtitle in requested_subtitles.values(): |
| 478 | if isinstance(subtitle, dict) and subtitle.get('filepath'): |
| 479 | self.status_queue.put({'subtitle_file': subtitle['filepath']}) |
| 480 | |
| 481 | # Capture all chapter files when SplitChapters finishes |
| 482 | elif d.get('postprocessor') == 'SplitChapters' and d.get('status') == 'finished': |
| 483 | chapters = d.get('info_dict', {}).get('chapters', []) |
| 484 | if chapters: |
| 485 | for chapter in chapters: |
| 486 | if isinstance(chapter, dict) and 'filepath' in chapter: |
| 487 | log.info(f"Captured chapter file: {chapter['filepath']}") |
| 488 | self.status_queue.put({'chapter_file': chapter['filepath']}) |
| 489 | else: |
| 490 | log.warning("SplitChapters finished but no chapter files found in info_dict") |
| 491 | |
| 492 | ytdl_params = { |
| 493 | 'quiet': not debug_logging, |