Fixed leading underscore issue
This commit is contained in:
+3
-3
@@ -26,6 +26,7 @@ auto ytdlp(const std::string& args) -> bool {
|
||||
auto metadata(const std::string& file, const std::string& artist, const std::string& album, size_t index) -> void {
|
||||
std::string name = std::filesystem::path(file).filename().string();
|
||||
name = std::regex_replace(name, std::regex(".mp3"), "");
|
||||
name.erase(0, 1); // Remove leading underscore
|
||||
|
||||
system(std::format("{} "
|
||||
"-hide_banner -loglevel error "
|
||||
@@ -39,7 +40,7 @@ auto metadata(const std::string& file, const std::string& artist, const std::str
|
||||
"-metadata artist=\"{}\" "
|
||||
"-metadata album=\"{}\" "
|
||||
"-metadata track=\"{}\" "
|
||||
"\"{}/_{}.mp3\"",
|
||||
"\"{}/{}.mp3\"",
|
||||
BIN_FFMPEG, file, TMP_DOWNLOAD_FOLDER, name, artist, album, index, TMP_DOWNLOAD_FOLDER, name)
|
||||
.c_str());
|
||||
}
|
||||
@@ -100,7 +101,7 @@ auto downloadVideo(const std::string& url) -> bool {
|
||||
"--quiet "
|
||||
"-f \"bestaudio/best\" "
|
||||
"-x --audio-format mp3 "
|
||||
"-o \"{}/%(title)s.%(ext)s\" "
|
||||
"-o \"{}/_%(title)s.%(ext)s\" "
|
||||
"{}",
|
||||
BIN_DENO, TMP_DOWNLOAD_FOLDER, url));
|
||||
|
||||
@@ -178,7 +179,6 @@ auto writeMetadataToTmpFolder(const std::string& artist, const std::string& albu
|
||||
metadata(entry.path().string(), artist, album, index);
|
||||
printf("Finished writting metadata for %s.\n", entry.path().string().c_str());
|
||||
std::filesystem::remove(entry.path().string());
|
||||
// TODO rename without underscore
|
||||
index++;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user