Bin constant
This commit is contained in:
+8
-7
@@ -19,7 +19,7 @@ using json = nlohmann::json;
|
||||
|
||||
// This runs in shell, if put through a website interface it would allow for injection
|
||||
auto ytdlp(const std::string& args) -> bool {
|
||||
system(std::format("bin/linux/yt-dlp {}", args).c_str());
|
||||
system(std::format("{}/yt-dlp {}", BIN_FOLDER, args).c_str());
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -27,7 +27,7 @@ auto metadata(const std::string& file, const std::string& artist, const std::str
|
||||
std::string name = std::filesystem::path(file).filename().string();
|
||||
name = std::regex_replace(name, std::regex(".mp3"), "");
|
||||
|
||||
system(std::format("bin/linux/ffmpeg "
|
||||
system(std::format("{}/ffmpeg "
|
||||
"-hide_banner -loglevel error "
|
||||
"-i \"{}\" "
|
||||
"-i \"{}/cover.jpg\" "
|
||||
@@ -40,7 +40,8 @@ auto metadata(const std::string& file, const std::string& artist, const std::str
|
||||
"-metadata album=\"{}\" "
|
||||
"-metadata track=\"{}\" "
|
||||
"\"{}/{}_{}.mp3\"",
|
||||
file, TMP_DOWNLOAD_FOLDER, name, artist, album, index, TMP_DOWNLOAD_FOLDER, index, name)
|
||||
BIN_FOLDER, file, TMP_DOWNLOAD_FOLDER, name, artist, album, index, TMP_DOWNLOAD_FOLDER, index,
|
||||
name)
|
||||
.c_str());
|
||||
}
|
||||
|
||||
@@ -91,13 +92,13 @@ auto downloadVideo(const std::string& url) -> bool {
|
||||
}
|
||||
|
||||
ytdlp(
|
||||
std::format("--js-runtimes \"deno:bin/linux/deno\" "
|
||||
std::format("--js-runtimes \"deno:{}/deno\" "
|
||||
"--quiet "
|
||||
"-f \"bestaudio/best\" "
|
||||
"-x --audio-format mp3 "
|
||||
"-o \"{}/%(title)s.%(ext)s\" "
|
||||
"{}",
|
||||
TMP_DOWNLOAD_FOLDER, url));
|
||||
BIN_FOLDER, TMP_DOWNLOAD_FOLDER, url));
|
||||
|
||||
printf("Finished downloading video %s.\n", url.c_str());
|
||||
return true;
|
||||
@@ -106,11 +107,11 @@ auto downloadVideo(const std::string& url) -> bool {
|
||||
auto writeAndReturnDataJson(const std::string& url) -> json {
|
||||
std::filesystem::remove("tmp/data.json");
|
||||
ytdlp(
|
||||
std::format("--js-runtimes \"deno:bin/linux/deno\" "
|
||||
std::format("--js-runtimes \"deno:{}/deno\" "
|
||||
"--dump-single-json "
|
||||
"\"{}\" "
|
||||
"> tmp/data.json",
|
||||
url));
|
||||
BIN_FOLDER, url));
|
||||
|
||||
std::ifstream f("tmp/data.json");
|
||||
if (!f) {
|
||||
|
||||
Reference in New Issue
Block a user