]> git.ekhem.eu.org Git - ydlpd.git/commitdiff
Print debug logs and redirect only if download succeeds. main
authorJakub Czajka <jakub@ekhem.eu.org>
Sun, 8 Dec 2024 22:41:27 +0000 (23:41 +0100)
committerJakub Czajka <jakub@ekhem.eu.org>
Sat, 14 Dec 2024 12:47:30 +0000 (13:47 +0100)
download.sh

index 0bccfe6afebbca138272787f9d27ef10e45ec3a2..5745cd074301617a15ecdb44b6c3c866439d2a76 100755 (executable)
@@ -34,7 +34,6 @@ echo "
 <!DOCTYPE html>
 <html>
 <meta name='viewport' content='width=device-width'>
 <!DOCTYPE html>
 <html>
 <meta name='viewport' content='width=device-width'>
-<meta http-equiv='Refresh' content='0;URL=/${LINK_ID}${EXT}' />
 <head>
   <style>
     body {
 <head>
   <style>
     body {
@@ -44,8 +43,16 @@ echo "
 </head>
 <body>"
 echo "Downloading ${FULL_URL} as ${FORMAT}"
 </head>
 <body>"
 echo "Downloading ${FULL_URL} as ${FORMAT}"
-yt-dlp --force-ipv4 --cookies ${COOKIES} ${ARGS} \
-    --output /tmp/"${LINK_ID}${EXT}" "${FULL_URL}"
+yt-dlp -v --force-ipv4 --cookies ${COOKIES} ${ARGS} \
+    --output /tmp/"${LINK_ID}${EXT}" "${FULL_URL}" 2>&1
+
+RET_VAL=$?
+
+echo "\
+</body>"
+
+[ $RET_VAL -eq 0 ] && echo "\
+<meta http-equiv='Refresh' content='0;URL=/${LINK_ID}${EXT}' />"
+
 echo "\
 echo "\
-</body>
 </html>"
 </html>"