mlc/main.cpp

44 lines
1.1 KiB
C++
Raw Normal View History

2023-07-15 19:44:29 +00:00
#include <iostream>
2023-07-16 00:15:31 +00:00
#include <string>
2023-07-21 21:32:24 +00:00
#include <chrono>
#include <unistd.h>
2023-07-16 00:15:31 +00:00
#include "FLAC/stream_decoder.h"
#include <lame/lame.h>
#include "help.h"
2023-07-21 21:32:24 +00:00
#include "collection.h"
#include "taskmanager.h"
2023-07-15 19:44:29 +00:00
int main(int argc, char **argv) {
2023-07-21 21:32:24 +00:00
if (argc < 3) {
2023-07-16 00:15:31 +00:00
std::cout << "Insufficient amount of arguments, launch with \"--help\" argument to see usage" << std::endl;
return 1;
}
const std::string firstArgument(argv[1]);
if (firstArgument == "--help") {
printHelp();
return 0;
}
2023-07-23 12:04:26 +00:00
const std::string secondArgument(argv[2]);
2023-07-21 21:32:24 +00:00
TaskManager taskManager;
taskManager.start();
std::chrono::time_point start = std::chrono::system_clock::now();
Collection collection(firstArgument, &taskManager);
collection.convert(secondArgument);
taskManager.printProgress();
taskManager.wait();
std::chrono::time_point end = std::chrono::system_clock::now();
std::chrono::duration<double> seconds = end - start;
2023-07-23 12:04:26 +00:00
std::cout << std::endl << "Encoding is done, it took " << seconds.count() << " seconds in total, enjoy!" << std::endl;
2023-07-21 21:32:24 +00:00
taskManager.stop();
2023-07-16 00:15:31 +00:00
2023-07-15 19:44:29 +00:00
return 0;
}