From 68b2c322bcb6027647f0171d2db2a87417cc4786 Mon Sep 17 00:00:00 2001 From: ArabCoders Date: Mon, 15 Jan 2024 19:13:45 +0300 Subject: [PATCH] Sometimes yt-dlp does not provide final filename. --- app/Download.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/app/Download.py b/app/Download.py index dafccd35..19e5bff1 100644 --- a/app/Download.py +++ b/app/Download.py @@ -298,6 +298,13 @@ class Download: self.info.eta = status.get('eta') if self.info.status == 'finished' and 'filename' in status and self.info.format != 'thumbnail': - self.info.file_size = os.path.getsize(status.get('filename')) + try: + self.info.file_size = os.path.getsize( + status.get('filename')) + except FileNotFoundError: + log.warning( + f'File not found: {status.get("filename")}') + self.info.file_size = None + pass await self.notifier.updated(self.info)