From: Christian Heller <c.heller@plomlompom.de>
Date: Sat, 30 Nov 2024 18:23:21 +0000 (+0100)
Subject: Fix /yt_result showing file path even if file not .present.
X-Git-Url: https://plomlompom.com/repos/%7B%7Bdb.prefix%7D%7D/static/%7B%7Bprefix%7D%7D/test.html?a=commitdiff_plain;h=fc67c4aeef498f2c52adf1502e6325ea3325dd0f;p=ytplom

Fix /yt_result showing file path even if file not .present.
---

diff --git a/src/ytplom/http.py b/src/ytplom/http.py
index 9027c98..b2366d5 100644
--- a/src/ytplom/http.py
+++ b/src/ytplom/http.py
@@ -310,7 +310,8 @@ class _TaskHandler(BaseHTTPRequestHandler):
         except NotFoundException:
             video_data = YoutubeVideo(video_id)
         try:
-            file_path = VideoFile.get_by_yt_id(conn, video_id).full_path
+            file = VideoFile.get_by_yt_id(conn, video_id)
+            file_path = file.full_path if file.present else None
         except NotFoundException:
             file_path = None
         conn.commit_close()