checks-parser/main.cpp

56 lines
1.9 KiB
C++
Raw Normal View History

2024-08-18 13:57:57 +03:00
#include "mainwindow.h"
2024-10-05 13:52:44 +03:00
#include "net/net.h"
#include "ofd/ofd.h"
#include "settings/settings.h"
#include "utils/utils.h"
2024-08-18 13:57:57 +03:00
#include <QApplication>
2024-10-05 13:52:44 +03:00
#include <curl/curl.h>
#include <iostream>
2024-10-05 15:03:17 +03:00
#include <filesystem>
2024-08-18 13:57:57 +03:00
int main(int argc, char *argv[]) {
2024-10-05 13:52:44 +03:00
curl_global_init(CURL_GLOBAL_ALL);
2024-10-05 15:03:17 +03:00
std::string program_data_path = get_path_relative_to_home(".local/share/checks_parser");
std::filesystem::create_directories(program_data_path);
2024-10-05 13:52:44 +03:00
std::string settings_file_path =
get_path_relative_to_home(".local/share/checks_parser/settings.json");
Settings s(settings_file_path);
OFD ofd;
Net n;
std::vector<std::string> ofd_updates = ofd.check_updates();
for (const std::string &update : ofd_updates) {
std::cout << "Downloading "
<< s.get_setting("ofds_modules_url") + update << " to "
<< get_path_relative_to_home(s.get_setting("ofds_modules_dir") +
"/" + update)
<< std::endl;
n.get_file(s.get_setting("ofds_modules_url") + "/" + update,
get_path_relative_to_home(s.get_setting("ofds_modules_dir") +
"/" + update));
}
Parser p;
std::vector<std::string> stores_updates = p.check_updates();\
for (const std::string &update : stores_updates) {
std::cout << "Downloading "
<< s.get_setting("stores_modules_url") + update << " to "
<< get_path_relative_to_home(s.get_setting("stores_modules_dir") +
"/" + update)
<< std::endl;
n.get_file(s.get_setting("stores_modules_url") + "/" + update,
get_path_relative_to_home(s.get_setting("stores_modules_dir") +
"/" + update));
}
2024-08-31 22:18:54 +03:00
2024-08-18 13:57:57 +03:00
QApplication a(argc, argv);
MainWindow w;
w.show();
2024-08-18 13:57:57 +03:00
return a.exec();
}