#include #include "processing.h" #include "logger.h" #include "core/pipeline.h" #include "error.h" #include "viewer/viewer.h" #include "core/config.h" namespace satdump { // TMP, MOVE TO HEADER extern std::shared_ptr current_app; extern bool in_app; namespace processing { void process(std::string downlink_pipeline, std::string input_level, std::string input_file, std::string output_file, nlohmann::json parameters) { is_processing = true; logger->info("Starting processing pipeline " + downlink_pipeline + "..."); logger->debug("Input file (" + input_level + ") : " + input_file); logger->debug("Output file : " + output_file); if (!std::filesystem::exists(output_file)) std::filesystem::create_directories(output_file); // Get pipeline std::optional pipeline = getPipelineFromName(downlink_pipeline); if (pipeline.has_value()) { try { pipeline.value().run(input_file, output_file, parameters, input_level, true, ui_call_list, ui_call_list_mutex); } catch (std::exception &e) { logger->error("Fatal error running pipeline : " + std::string(e.what())); error::set_error("Pipeline Error", e.what()); is_processing = false; return; } } else logger->critical("Pipeline " + downlink_pipeline + " does not exist!"); logger->info("Done! Goodbye"); if (config::main_cfg["user_interface"]["open_viewer_post_processing"]["value"].get()) { if (std::filesystem::exists(output_file + "/dataset.json")) { logger->info("Opening viewer!"); std::shared_ptr viewer = std::make_shared(); viewer->loadDatasetInViewer(output_file + "/dataset.json"); in_app = true; current_app = viewer; } } is_processing = false; } std::shared_ptr>> ui_call_list = std::make_shared>>(); std::shared_ptr ui_call_list_mutex = std::make_shared(); bool is_processing = false; } }