From 192433cbb75b6c87fca57e09ecfd51a046cf69fb Mon Sep 17 00:00:00 2001 From: Markus Date: Fri, 4 Oct 2019 20:24:51 +0200 Subject: [PATCH] v3.0.1: can use search Name and -u && fix errors --- parameterManager.cpp | 1 + parameterManager.h | 4 ++-- programManager.cpp | 15 ++++++++++----- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/parameterManager.cpp b/parameterManager.cpp index 6b5ba85..18b97af 100644 --- a/parameterManager.cpp +++ b/parameterManager.cpp @@ -151,6 +151,7 @@ int loadDefaulOptions(Settings &settings) ofs << "#default-maxThreads=0" << std::endl; ofs << std::endl; ofs << "#search-AchteAufGroßUndKleinschreibung=false" << std::endl; + ofs << "#Mit 0 Können Sie die Warnung deaktivieren:" << std::endl; ofs << "#search-UpdateWarnungNachTagen=10" << std::endl; diff --git a/parameterManager.h b/parameterManager.h index 25d248c..1ef9977 100644 --- a/parameterManager.h +++ b/parameterManager.h @@ -50,8 +50,8 @@ struct Settings { proxy_ip = "127.0.0.1", languages = "GerDub,GerSub,Eng", genaueHoster = "", - version = "3.0.0", - defaultFileVersion="1.4", + version = "3.0.1", + defaultFileVersion="1.5", outputFilePath = "", default_checkPath = "", default_Searchmuster = "S%Staffel%E%Folge%"; diff --git a/programManager.cpp b/programManager.cpp index b285c6c..9bbd206 100644 --- a/programManager.cpp +++ b/programManager.cpp @@ -167,12 +167,13 @@ int ProgramManager::checkLastUpdate(Settings *settings) return 1; } std::string line; + ssize_t difDays = 0; if(!std::getline(ifs, line).good()) { perror("GetLine from Date failed"); return 2; - } else if( ( static_cast(pageManager.getDate()) - atoll(line.c_str()) ) >= settings->updateWarningDays) { - std::cout << ((settings->colorless) ? "" : "\033[93m") << " => Warnung: SerienListe zuletzt vor " << settings->updateWarningDays << " Tagen aktualisiert." + } else if( ( ( difDays = static_cast(pageManager.getDate()) - atoll(line.c_str()) )) >= settings->updateWarningDays) { + std::cout << ((settings->colorless) ? "" : "\033[93m") << " => Warnung: SerienListe wurde zuletzt vor " << difDays << " Tagen aktualisiert." << std::endl << " Mit '" << settings->programName << " search -u' kannst du die Liste aktualisieren." << "\033[0m" << std::endl;; } @@ -397,11 +398,15 @@ int ProgramManager::searchModus(Settings *settings, std::string *saveTo) { if(settings->search_wantUpdate) { int res = searchModus_update(settings) ; - if( res == 0) + if(res == 0) { std::cout << "Erfolgreich geupdatet: Die Serienliste ist nun auf dem neusten Stand." << std::endl; - else + if (settings->name == "") + return 0; + + } else { std::cout << " => Error: Das updaten der Serienliste ist fehlgeschlagen." << std::endl; - return res; + return res; + } } else if(settings->name == "") { std::cout << " => Error: Kein Name angegeben." << std::endl;