From 40ecc6cf11a0fbfaa5a7fb65cf93ecf3edf8dc8e Mon Sep 17 00:00:00 2001 From: Roland Reichwein Date: Sat, 5 Nov 2022 15:12:14 +0100 Subject: Fix startup from youtube-dl leftover --- whiteboard.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'whiteboard.cpp') diff --git a/whiteboard.cpp b/whiteboard.cpp index 60cfcc2..1cf8354 100644 --- a/whiteboard.cpp +++ b/whiteboard.cpp @@ -6,6 +6,7 @@ #include #include +#include #include #include #include @@ -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(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. -- cgit v1.2.3