From a6492bff2bd2145c3ad5cf53e5a06b39d25806c0 Mon Sep 17 00:00:00 2001 From: "DESKTOP-4798CH4\\palonE" Date: Thu, 29 Mar 2018 00:06:25 +0100 Subject: [PATCH] Expert options! - added expert options - cleaned up some code - various small fixes --- config.php | 4 ++-- css/style.css | 14 +++++++++++++- index.php | 30 ++++++++++++++++++++++++------ js/script.js | 13 ++++++++++++- login.html | 2 +- php/loopAndPrint.php | 2 +- ydl.php | 9 +++++++-- 7 files changed, 60 insertions(+), 14 deletions(-) diff --git a/config.php b/config.php index d6cda1a..b6905be 100644 --- a/config.php +++ b/config.php @@ -11,5 +11,5 @@ //timezone date_default_timezone_set('Europe/Berlin'); -//adding these to the end of the youtube-dl command -$additionalParams = " --no-progress --no-warnings --embed-thumbnail --add-metadata"; +//ALWAYS adding these to the end of the youtube-dl command, for user input arguments use the expert options +$additionalParams = "--no-progress --no-warnings --embed-thumbnail --add-metadata"; diff --git a/css/style.css b/css/style.css index d58149e..ae6882b 100644 --- a/css/style.css +++ b/css/style.css @@ -76,7 +76,7 @@ body { width: 80%; display: flex; - /*flex-direction: column-reverse;*/ + flex-direction: column-reverse; } .popen p { @@ -234,4 +234,16 @@ body { -webkit-transform: scale(1); transform: scale(1); } +} + +.expertOptions { + max-width: 70%; +} + +.arrowNotClicked { + transform: rotate(-90deg); +} + +.arrowClicked { + transform: rotate(0deg); } \ No newline at end of file diff --git a/index.php b/index.php index 00e3522..6b41449 100644 --- a/index.php +++ b/index.php @@ -33,21 +33,38 @@ -
+ + -
- +
+
Supported Sites to Download from This project on Github + +
@@ -60,6 +77,7 @@ + diff --git a/js/script.js b/js/script.js index 4faf873..f4330f6 100644 --- a/js/script.js +++ b/js/script.js @@ -1,8 +1,19 @@ var btn = document.getElementById("dlBtn"); -var arrow = document.getElementById(""); +var arrow = document.getElementById("arrow"); +var expertDiv = document.getElementById("expertDiv"); btn.addEventListener("click", function () { document.getElementById("loading").classList.remove("hidden"); document.getElementById("loading").classList.add("visible"); }); +expertDiv.addEventListener("click", function () { + if (arrow.classList.contains("arrowNotClicked")) { + arrow.classList.remove("arrowNotClicked"); + arrow.classList.add("arrowClicked"); + } else { + arrow.classList.remove("arrowClicked"); + arrow.classList.add("arrowNotClicked"); + } +}); + diff --git a/login.html b/login.html index c767830..a5f54c4 100644 --- a/login.html +++ b/login.html @@ -17,7 +17,7 @@

Authentication needed

- +
diff --git a/php/loopAndPrint.php b/php/loopAndPrint.php index 26cf982..68707e3 100644 --- a/php/loopAndPrint.php +++ b/php/loopAndPrint.php @@ -9,7 +9,7 @@ function loopAndPrint() { echo '
'; echo '
'; echo '

' . $file . '

'; - echo 'Download'; + echo 'Download'; echo '
'; echo '
'; } diff --git a/ydl.php b/ydl.php index 4b5ad10..eeb51e9 100644 --- a/ydl.php +++ b/ydl.php @@ -41,7 +41,7 @@ //Check what fileFormat the user chose if (isset($_POST['fileFormat'])) { if ($_POST['fileFormat'] == "mp3") { - $fileFormat = ' --extract-audio --audio-format mp3 -f "bestaudio"'; + $fileFormat = '--extract-audio --audio-format mp3 -f "bestaudio"'; } if ($_POST['fileFormat'] == "video") { @@ -49,8 +49,13 @@ } } + $expertOptions = ""; + if (isset($_POST['expertParams'])) { + $expertOptions = $_POST['expertParams']; + } + //Prepare the command - $cmd = "youtube-dl " . escapeshellarg($_POST['url']) . $fileFormat . $additionalParams; //fileFormat does not need to be escaped, its no user input + $cmd = "youtube-dl " . escapeshellarg($_POST['url']) . " " . $fileFormat . " " . $additionalParams . " " .$expertOptions; //fileFormat does not need to be escaped, its no user input //Inconsistent across PHP versions // webserver, switching to exec until I find a fix //liveExec($cmd);