2025-05-24 20:59:22 +02:00
|
|
|
#include "process.h"
|
|
|
|
|
#include "products2/product.h"
|
|
|
|
|
#include "products2/product_process.h"
|
|
|
|
|
#include <filesystem>
|
|
|
|
|
|
|
|
|
|
namespace satdump
|
|
|
|
|
{
|
2025-07-15 18:02:13 +02:00
|
|
|
void ProcessCmdHandler::reg(CLI::App *app)
|
|
|
|
|
{
|
|
|
|
|
CLI::App *sub_process = app->add_subcommand("process", "Process products/dataset automatically");
|
|
|
|
|
sub_process->add_option("product", "Product to process")->required();
|
|
|
|
|
sub_process->add_option("directory", "Output folder")->required();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ProcessCmdHandler::run(CLI::App *app, CLI::App *subcom)
|
|
|
|
|
{
|
|
|
|
|
std::string pro = subcom->get_option("product")->as<std::string>();
|
|
|
|
|
std::string dir = subcom->get_option("directory")->as<std::string>();
|
|
|
|
|
processProductsOrDataset(pro, dir);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void ProcessCmdHandler::processProductsOrDataset(std::string product, std::string directory)
|
2025-05-24 20:59:22 +02:00
|
|
|
{
|
|
|
|
|
if (!std::filesystem::exists(directory))
|
|
|
|
|
std::filesystem::create_directories(directory);
|
|
|
|
|
|
|
|
|
|
auto p = products::loadProduct(product);
|
|
|
|
|
satdump::products::process_product_with_handler(p, directory);
|
|
|
|
|
}
|
|
|
|
|
} // namespace satdump
|