summaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorRoland Reichwein <mail@reichwein.it>2022-11-05 15:12:14 +0100
committerRoland Reichwein <mail@reichwein.it>2022-11-05 15:12:14 +0100
commit40ecc6cf11a0fbfaa5a7fb65cf93ecf3edf8dc8e (patch)
tree895551a143960373776624a6a94dbeddf111682f
parent54539cc210afcda25f6da12ad08c2b5fa8bd5be2 (diff)
Fix startup from youtube-dl leftover
-rwxr-xr-xMakefile8
-rw-r--r--html/index.html4
-rw-r--r--html/whiteboard.js4
-rw-r--r--whiteboard.cpp9
4 files changed, 15 insertions, 10 deletions
diff --git a/Makefile b/Makefile
index d85bad7..8891bc7 100755
--- a/Makefile
+++ b/Makefile
@@ -4,10 +4,14 @@
# Environment: Debian
#
-DISTROS=base debian10 debian11 ubuntu2004 ubuntu2204
+DISTROS=base debian11 ubuntu2204
VERSION=$(shell dpkg-parsechangelog --show-field Version)
+CXX=clang++-13
+
+ifeq ($(shell which $(CXX)),)
CXX=clang++-10
+endif
ifeq ($(shell which $(CXX)),)
CXX=clang++
@@ -32,7 +36,7 @@ ifeq ($(CXXFLAGS),)
CXXFLAGS=-g -O2
endif
-CXXFLAGS+=-Wall -fPIE -std=c++17 -Wpedantic -gdwarf-4
+CXXFLAGS+=-Wall -fPIE -std=c++20 -Wpedantic -gdwarf-4
LDFLAGS+=-pie
ifeq ($(CXX),clang++-10)
diff --git a/html/index.html b/html/index.html
index f97b295..3b23e90 100644
--- a/html/index.html
+++ b/html/index.html
@@ -6,8 +6,8 @@
<meta name="keywords" content="Reichwein, DownTube, YouTube, Download MP3">
<title>DownTube</title>
<link rel="shortcut icon" href="/favicon.ico" type="image/x-icon"/>
- <link rel="stylesheet" type="text/css" href="downtube.css"/>
- <script src="downtube.js"></script>
+ <link rel="stylesheet" type="text/css" href="whiteboard.css"/>
+ <script src="whiteboard.js"></script>
</head>
<body onload="init();">
<div class="page">
diff --git a/html/whiteboard.js b/html/whiteboard.js
index f79443e..dd81ff0 100644
--- a/html/whiteboard.js
+++ b/html/whiteboard.js
@@ -54,7 +54,7 @@ function on_start() {
formatElement.appendChild(document.createTextNode(document.getElementById("mp3").checked ? "mp3" : "mp4"));
requestElement.appendChild(formatElement);
- xhr.open("POST", "downtube.fcgi", true);
+ xhr.open("POST", "whiteboard.fcgi", true);
xhr.setRequestHeader("Content-type", "text/xml");
xhr.responseType = 'text';
xhr.send(xmlDocument);
@@ -106,7 +106,7 @@ function get_file(filename) {
formatElement.appendChild(document.createTextNode(document.getElementById("mp3").checked ? "mp3" : "mp4"));
requestElement.appendChild(formatElement);
- xhr.open("POST", "downtube.fcgi", true);
+ xhr.open("POST", "whiteboard.fcgi", true);
xhr.setRequestHeader("Content-type", "text/xml");
xhr.responseType = 'blob';
xhr.send(xmlDocument);
diff --git a/whiteboard.cpp b/whiteboard.cpp
index 60cfcc2..1cf8354 100644
--- a/whiteboard.cpp
+++ b/whiteboard.cpp
@@ -6,6 +6,7 @@
#include <sys/types.h>
#include <fcgiapp.h>
+#include <iostream>
#include <functional>
#include <filesystem>
#include <regex>
@@ -85,7 +86,7 @@ int main(void)
if (!strcmp(method, "POST")) {
size_t contentLength { std::stoul(FCGX_GetParam("CONTENT_LENGTH", request.envp)) };
std::string postData(contentLength, '\0'); // contentLength number of bytes, initialize with 0
- if (FCGX_GetStr(postData.data(), contentLength, request.in) != contentLength) {
+ if (FCGX_GetStr(postData.data(), contentLength, request.in) != static_cast<int>(contentLength)) {
throw std::runtime_error("Bad data read: Content length mismatch.\r\n");
}
// postData contains POST data
@@ -127,7 +128,7 @@ int main(void)
if (command == "getfilename") {
//std::string cmd{"youtube-dl -o '%(title)s."s + format + "' --get-filename --no-call-home --restrict-filenames "s + url + " > filename.txt"};
// Recoding to MP4 is too slow currently. So keep original format for now
- std::string cmd{"youtube-dl -o '%(title)s.%(ext)s' --get-filename --no-call-home --restrict-filenames "s + url + " > filename.txt"};
+ std::string cmd{"xyoutube-dl -o '%(title)s.%(ext)s' --get-filename --no-call-home --restrict-filenames "s + url + " > filename.txt"};
if (system(cmd.c_str()))
throw std::runtime_error("Can't guess filename");
@@ -141,7 +142,7 @@ int main(void)
FCGX_FPrintF(request.out, "%s", filename.c_str());
} else if (command == "getfile") {
if (format == "mp3") {
- std::string cmd{"youtube-dl --no-warnings --no-call-home --no-progress -x --audio-format mp3 -o 'audio.%(ext)s' --restrict-filenames "s + url};
+ std::string cmd{"xyoutube-dl --no-warnings --no-call-home --no-progress -x --audio-format mp3 -o 'audio.%(ext)s' --restrict-filenames "s + url};
system(cmd.c_str()); // Ignore error - "ERROR: Stream #1:0 -> #0:1 (copy)" - seems to be ok
std::string filedata {File::getFile("audio.mp3")}; // may throw
@@ -155,7 +156,7 @@ int main(void)
} else if (format == "mp4") {
//std::string cmd{"youtube-dl --no-warnings --no-call-home --no-progress --recode-video mp4 -o video.mp4 --restrict-filenames "s + url};
// Recoding to MP4 is too slow currently. So keep original format for now
- std::string cmd{"youtube-dl --no-warnings --no-call-home --no-progress -o video.mp4 --restrict-filenames "s + url};
+ std::string cmd{"xyoutube-dl --no-warnings --no-call-home --no-progress -o video.mp4 --restrict-filenames "s + url};
system(cmd.c_str()); // Ignore error
// youtube-dl gets it wrong and creates, e.g. video.mkv.