diff --git a/.gitignore b/.gitignore index 638794f..d0f7f55 100644 --- a/.gitignore +++ b/.gitignore @@ -74,7 +74,7 @@ Thumbs.db #Own adds: g++/ build* - +src/lib/ Makefile S_New4 diff --git a/src/S_New4.pro b/src/S_New4.pro index 5164207..757f4f9 100644 --- a/src/S_New4.pro +++ b/src/S_New4.pro @@ -1,10 +1,22 @@ QT -= gui + + + + +#INCLUDEPATH += -L$${_PRO_FILE_PWD_}\openssl-android-arm64-v8a\include + +LIBS += -L$${_PRO_FILE_PWD_}\lib -lssl +LIBS += -L$${_PRO_FILE_PWD_}\lib -lcrypto +LIBS += -L$${_PRO_FILE_PWD_}\lib -lcurl + + + #Linux: -unix: LIBS += -lcurl +#unix: LIBS += -lcurl #Windows -win32: LIBS += -L$${_PRO_FILE_PWD_}\curl -lcurl +#win32: LIBS += -L$${_PRO_FILE_PWD_}\curl -lcurl CONFIG += c++14 console diff --git a/src/pageManager.cpp b/src/pageManager.cpp index ffa19b6..87c440a 100644 --- a/src/pageManager.cpp +++ b/src/pageManager.cpp @@ -89,7 +89,7 @@ Reply PageManager::getServerRequest(std::string Url, bool useCookies, std::strin int width; get_terminal_size(width); - if(width <= 0) + if(width < 1) width = 999999; //info ausgabe @@ -314,7 +314,7 @@ checkNameRply PageManager::checkName(std::vector pages, std::string Name, continue; } else if (html.find("404 - Seite nicht gefunden") != std::string::npos) { - std::cout << "\33[2K\r => Ungültiger Name: '" << Name << "'" << std::endl; + std::cout << "\33[2K\r" <<" => Ungültiger Name: '" << Name << "'" << std::endl; return checkNameRply("", PAGE(), checkNameRply::NOTHING_FOUND); } else if (html == "-1" || html == "") { diff --git a/src/pageManager.h b/src/pageManager.h index 75209c7..375b453 100644 --- a/src/pageManager.h +++ b/src/pageManager.h @@ -3,7 +3,10 @@ #include "accountManager.h" -#include "curl/curl.h" +//#include "curl/curl.h" + +#include "lib/curl.h" + #include "parameterManager.h" // for isNumber #ifdef _WIN32 diff --git a/src/parameterManager.cpp b/src/parameterManager.cpp index a88e50c..725d465 100644 --- a/src/parameterManager.cpp +++ b/src/parameterManager.cpp @@ -202,7 +202,7 @@ int loadDefaulOptions(Settings &settings) ofs << "# -> Standart Wert für Parameter: -f, --use-first:" << std::endl; ofs << "# -> Benutze sofort die erste Seite, wenn die Serie dort existiert." << std::endl; ofs << "# Wenn deaktiviert, manuelle auswahl der Seiten nötig!" << std::endl; - ofs << "#UseFirstPage=false" << std::endl << std::endl; + ofs << "#UseFirstPage=true" << std::endl << std::endl; ofs << "#" << std::endl << "# -> Einstellungen für default Modus:" << std::endl << "#" << std::endl << std::endl; diff --git a/src/parameterManager.h b/src/parameterManager.h index ca34137..0db3727 100644 --- a/src/parameterManager.h +++ b/src/parameterManager.h @@ -3,7 +3,7 @@ #ifndef __linux__ #ifndef _WIN32 -#error "Error Invalid System: Only for Linux and Windows systems!" +//#error "Error Invalid System: Only for Linux and Windows systems!" #endif #endif @@ -26,7 +26,7 @@ #define UpdaterCloudUrlWithPath "https://cloud.obermui.de/s/tXz7SWdaPJ7TacZ/download?path=%2F&files=" #define SecondUpdaterCloudUrlWithPath "https://snew4.obermui.de/download?path=%2F&files=" -#define VERSION "5.0.1" +#define VERSION "5.0.3" #define DEFAULT_FILE_VERSION "2.1" //default, anime, normal, @@ -57,6 +57,8 @@ struct PAGE { std::string name_id, url, urlAlphabetSerienList, UrlDir; }; + + struct Settings { const std::string programName = "S_New4"; @@ -102,7 +104,7 @@ struct Settings { const std::string VersionFileName = std::string("Version-LIN-ARMv6.txt"); const std::string ProgrammFileName = std::string("S_New4-LIN-ARMv6"); #else - #error Falsche Architektur: Der Updater Fuktion wird nicht Funktionieren! Remove this Line in the Code to use S_New4 without the Updater. ( But your System must be Windows or Linux ) + //#error Falsche Architektur: Der Updater Fuktion wird nicht Funktionieren! Remove this Line in the Code to use S_New4 without the Updater. ( But your System must be Windows or Linux ) const std::string VersionFileName = ""; const std::string ProgrammFileName = ""; #endif @@ -110,6 +112,7 @@ struct Settings { + std::string name, accountFilePath = "", accountNumberPath= "", @@ -151,10 +154,40 @@ struct Settings { updateWarningDays = 10; char pathSymbol = '/'; char wrongPathSymbol = '\\'; - unsigned maxThreads = 0; + enum COLOR { + NO_COLOR = 0, + Black = 30, + Dark_Gray = 90, + Red = 31, + Light_Red = 91, + Green = 32, + Light_Green = 92, + Brown_Orange = 33, + Yellow = 93, + Blue = 34, + Light_Blue = 94, + Purple = 35, + Light_Purple = 95, + Cyan = 36, + Light_Cyan = 96, + Light_Gray = 37, + White = 97 + + }; + std::string setPColor(const COLOR &color) { + return ( (colorless) ? "" : "\033[" + std::to_string(color) +"m" ); + } + std::string resetPColor() { + return ( (colorless) ? "" : "\033[0m" ); + } + + }; + + + std::string replace(std::string str, std::string substr1, std::string substr2); int manageParameter(Settings &settings, int argc, char ** argv); diff --git a/src/programManager.cpp b/src/programManager.cpp index 19dfc78..43d49de 100644 --- a/src/programManager.cpp +++ b/src/programManager.cpp @@ -846,15 +846,22 @@ int ProgramManager::searchModus(Settings *settings, std::string *saveTo, bool no //------------------------------------------------> Extrahiere alle Zeilen raus, die aus den Aktivierten Seiten sind std::istringstream ifS(fullList + "\n"); - std::string l, allUrls; + std::string l, allUrlsInUSe, allPages; for( const auto &p : settings->pages ) - allUrls += ((allUrls == "") ? "" : ",") + p.url; + allUrlsInUSe += ((allUrlsInUSe == "") ? "" : ",") + p.url; + for( const auto &p : settings->pagesALL ) + allPages += ((allPages == "") ? "" : ",") + p.url; while (std::getline(ifS, l)) { if( l.find_last_of('|') == std::string::npos ) { continue; - } else if( allUrls.find( l.substr(l.find_last_of('|') + 1) ) != std::string::npos ) + } else if( allUrlsInUSe.find( l.substr(l.find_last_of('|') + 1) ) != std::string::npos ) { finds += l + "\n"; + } else if ( allPages.find( l.substr(l.find_last_of('|') + 1) ) == std::string::npos ) { + std::cout << settings->setPColor(Settings::Brown_Orange) << " => WARNUNG: In der Serienliste befindet sich ein ungültiger Eintrag: Unbekannte Seite: " << l.substr(l.find_last_of('|') + 1) << + "\n Verwenden sie '" << settings->programName << "' s -u, search --update um die Liste zu aktualisieren!" << settings->resetPColor() << std::endl; + continue; + } } if(finds.size() >= 1) finds.pop_back(); //------------------------------------------- @@ -1634,8 +1641,7 @@ int ProgramManager::searchModus_update(Settings *settings) //Vergeliche neue und alte list => entfernte Serien if(line != "" && list.find(line) == std::string::npos) { std::string tmp = std::string(line).erase(line.find_last_of('|')); - std::cout << ((settings->colorless) ? "" : "\033[91m") << "Entfernt: '" << tmp.substr(tmp.find_last_of("|") + 1) << "'" << ((settings->colorless) ? "" : "\033[0m") - << std::endl; + std::cout << settings->setPColor(settings->Red) << "Entfernt: '" << tmp.substr(tmp.find_last_of("|") + 1) << "'" << settings->resetPColor() << std::endl; } } myFileBef.close(); @@ -1660,8 +1666,7 @@ int ProgramManager::searchModus_update(Settings *settings) //Vergeliche neu mit Alt => gib neue Serien aus if(line != "" && alteListe.find(line) == std::string::npos) { std::string tmp = std::string(line).erase(line.find_last_of('|')); - std::cout << ((settings->colorless) ? "" : "\033[92m") << "Neu: '" << tmp.substr(tmp.find_last_of("|") + 1) << "'" << ((settings->colorless) ? "" : "\033[0m") - << std::endl; + std::cout << settings->setPColor(Settings::Green) << "Neu: '" << tmp.substr(tmp.find_last_of("|") + 1) << "'" << settings->resetPColor() << std::endl; } } myFileAf.close(); @@ -1670,11 +1675,7 @@ int ProgramManager::searchModus_update(Settings *settings) return 112; } - std::cout << ((settings->colorless) ? "" : "\033[93m") << "Serienunterschied: " << ( ((countAf - countBef) > 0) ? "+" : "") << countAf - countBef << " Serien." << "\033[0m" << std::endl; - - - - + std::cout << settings->setPColor(Settings::Yellow) << "Serienunterschied: " << ( ((countAf - countBef) > 0) ? "+" : "") << countAf - countBef << " Serien." << settings->resetPColor() << std::endl; //Speicher Datum des Updates... ofs.open(settings->lastUpdateDateFilePath, std::ios::trunc);