summaryrefslogtreecommitdiffhomepage
path: root/whiteboard.cpp
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 /whiteboard.cpp
parent54539cc210afcda25f6da12ad08c2b5fa8bd5be2 (diff)
Fix startup from youtube-dl leftover
Diffstat (limited to 'whiteboard.cpp')
-rw-r--r--whiteboard.cpp9
1 files changed, 5 insertions, 4 deletions
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.