From 891f9eaf87aef4ab0d1c4a39dc664bbb8014d7e7 Mon Sep 17 00:00:00 2001 From: Your Name Date: Tue, 2 Mar 2021 21:57:19 +0100 Subject: [PATCH] v5.0.1: fixes + remove als default print all names --- src/parameterManager.cpp | 31 ++++++++++++++++++++++++++++--- src/parameterManager.h | 3 ++- src/programManager.cpp | 5 ++--- 3 files changed, 32 insertions(+), 7 deletions(-) diff --git a/src/parameterManager.cpp b/src/parameterManager.cpp index 95c4d54..a88e50c 100644 --- a/src/parameterManager.cpp +++ b/src/parameterManager.cpp @@ -229,6 +229,12 @@ int loadDefaulOptions(Settings &settings) ofs << "# -> Mit 0 Können Sie die Warnung deaktivieren:" << std::endl; ofs << "#search_UpdateWarnungNachTagen=10" << std::endl << std::endl; + ofs << "# -> Aktiviert werden bei der Suche sämtliche Namen der Serie angezeigt." << std::endl; + ofs << "# Bei Animes kann das zu Mehrzeiligen ausgaben pro Serie führen!" << std::endl; + ofs << "#search-showAllNames=false" << std::endl << std::endl; + + + ofs.close(); } ifs.open(settings.defaultsFilePath); @@ -366,8 +372,18 @@ int loadDefaulOptions(Settings &settings) if(settings.debugMode) std::cout << " > Defaults: UseFirstPage: " << settings.useFirstPage << std::endl; - } else if (what == "test") { - //test + } else if (what == "search-showAllNames") { + + if(data == "true") + settings.search_show_othernames=true; + else if (data == "false") + settings.search_show_othernames=false; + else { + std::cout << " => Error_Defaults: search-showAllNames: Ungültiger Wert für 'true/false': " << data << std::endl; + return 2487; + } + if(settings.debugMode) + std::cout << " > Defaults: search-showAllNames: " << settings.search_show_othernames << std::endl; } else { std::cout << " => Warnung: Unbekannte Default-Option: '" << what << "'." << std::endl; @@ -885,6 +901,7 @@ int unterOption_search(Settings *settings, int argc, char **argv) {"socks5-proxy", required_argument, nullptr, 'p'}, {"internet-pages", required_argument, nullptr, 'i'}, + {"show-all-names", no_argument, nullptr, 's'}, {"help", no_argument, nullptr, 'h'}, {"colorless", no_argument, nullptr, 'c'}, {"debug-mode", no_argument, nullptr, 'd'}, @@ -897,7 +914,7 @@ int unterOption_search(Settings *settings, int argc, char **argv) }; - while( ( c = getopt_long (argc, argv, "p:i:hcdeul", long_opts, nullptr) ) != -1 ) { + while( ( c = getopt_long (argc, argv, "p:i:shcdeul", long_opts, nullptr) ) != -1 ) { switch(c) { case 'p': if(!optarg || setS5ProxytoSettings(*settings, optarg) != 0) @@ -912,6 +929,11 @@ int unterOption_search(Settings *settings, int argc, char **argv) case 'h': unterOption_search_help(settings->programName); return -1; + case 's': + settings->search_show_othernames = true; + if(settings->debugMode) + std::cout << "search_show_othernames: true" << std::endl; + break; case 'c': settings->colorless = true; if(settings->debugMode) @@ -1005,6 +1027,9 @@ void unterOption_search_help(std::string programName) << " Serienliste zuletzt aktualisiert wurde." << std::endl << std::endl << " -c, --colorless" << std::endl << " Mit dieser Option kann man die farbige Ausgabe ausstellen." << std::endl << std::endl + << " -s, --show-all-names" << std::endl + << " Mit dieser Option werden alle Namen einer Serie ausgegeben." << std::endl << std::endl + << " Vorsicht bei Animes: Kann zu mehrzeiligen Ausgaben pro Serie führen!" << std::endl << std::endl << " -d, --debug-mode" << std::endl << " Mit dieser Option kann man den Debug-Modus einschalten." << std::endl << " Dabei werden vielmehr Infos ausgegeben." << std::endl << std::endl diff --git a/src/parameterManager.h b/src/parameterManager.h index 174de58..5da24ca 100644 --- a/src/parameterManager.h +++ b/src/parameterManager.h @@ -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.0" +#define VERSION "5.0.1" //default, anime, normal, @@ -138,6 +138,7 @@ struct Settings { debugMode = false, search_IgnoreUpperLower = true, search_wantUpdate = false, + search_show_othernames = false, askForEveryDir = true, skipEpisodenNameOutput = false, showLastUpdate = false; diff --git a/src/programManager.cpp b/src/programManager.cpp index 4c9352c..1e5308b 100644 --- a/src/programManager.cpp +++ b/src/programManager.cpp @@ -239,7 +239,7 @@ int ProgramManager::sucheNach_1_Serien(Settings *settings, PageManager &pageMana std::cout << " => Error: Invalid Line: " << line << std::endl; return -21; } - std::cout << "[" << i << "]: " << line.substr(line.find_last_of("|") + 1) << ( (line[0] != '|') ? " ( " + line.substr(0, line.find("|")) + " )" : "" ) << std::endl; + std::cout << "[" << i << "]: " << line.substr(line.find_last_of("|") + 1) << ( (settings->search_show_othernames && line[0] != '|') ? " ( " + line.substr(0, line.find("|")) + " )" : "" ) << std::endl; } //Lass Benutzer Zeile auswählen: @@ -852,7 +852,6 @@ int ProgramManager::searchModus(Settings *settings, std::string *saveTo, bool no while (std::getline(ifS, l)) { if( l.find_last_of('|') == std::string::npos ) { - std::cout << "Invalid Line: '" << l << "'" << std::endl; continue; } else if( allUrls.find( l.substr(l.find_last_of('|') + 1) ) != std::string::npos ) finds += l + "\n"; @@ -909,7 +908,7 @@ int ProgramManager::searchModus(Settings *settings, std::string *saveTo, bool no } std::cout << " > " << parts.at(2) << "\t[" << parts.at(1).erase(0, 1) << "]" - << ( (line[0] == '|') ? "" : "\t( " + parts.at(0) + " )" ) << std::endl; + << ( ( !settings->search_show_othernames || line[0] == '|') ? "" : "\t( " + parts.at(0) + " )" ) << std::endl; //zähne hoch!! ///That Time I Got Reincarnated as a Slime|/tensei-shitara-slime-datta-ken|Tensei Shitara Slime Datta Ken|ANIME