commit 4e4646f2eed1118894f8ee0e4fddfeca1ec3adb2 parent cbc8102aab1bedc786b78e901d6c05c127e926a1 Author: JayVii <jayvii[AT]posteo[DOT]de> Date: Sat, 7 Dec 2024 12:06:05 +0100 fix: do not delete audio file if ytdl is still running Diffstat:
M | index.php | | | 10 | ++++++++-- |
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/index.php b/index.php @@ -249,13 +249,19 @@ if (!empty($channel) && $auth) { ); } + // Check whether ytdl is still running on current video ID + $ytdl_running = ytdl_status($video); + // If file has been downloaded properly, check whether the file is valid - if (!(analyze_video($video . ".opus")["playtime_seconds"] > 0)) { + if ( + !(analyze_video($video . ".opus")["playtime_seconds"] > 0) && + $ytdl_running !== true + ) { unlink(basename($_GET["video"]) . ".opus"); } // If file still exists, return to user - if (file_exists($video . ".opus") && !ytdl_status($video)) { + if (file_exists($video . ".opus") && $ytdl_running !== true) { header("content-type: audio/ogg; codec=opus"); header("content-length: " . filesize($video . ".opus")); header("content-disposition: inline; filename=" . $video . ".opus");