smal error fixes

This commit is contained in:
Markus 2021-06-14 18:07:09 +02:00
parent 11f042df43
commit e1d15bde6c
4 changed files with 35 additions and 16 deletions

View File

@ -362,16 +362,23 @@ std::string PageManager::getLinks(std::string HTML)
//Entferne alles nach den Links //Entferne alles nach den Links
//pos = HTML.find("<script async="); //pos = HTML.find("<script async=");
//pos = HTML.find("<script data-cfasync=\""); //pos = HTML.find("<script data-cfasync=\"");
if( (pos = HTML.find("<script async=")) == std::string::npos ) std::string points[] = { "<script async=", "<script data-cfasync=\"", "<div class=\"cf\"></div>" /*correkter HTML absatz*/, "<div id=\"footer\">", };
pos = HTML.find("<script data-cfasync=\""); for ( const auto &e : points ) {
if( ( pos = HTML.find("<script data-cfasync=\"") ) == std::string::npos ) if( (pos = HTML.find(e)) == std::string::npos ) {
pos = HTML.find("<div id=\"footer\">"); if(debugMode)

std::cerr << " => WARNUNG KONNTE Punkt' " << e << "' nicht nach den Links finden; nächster Versuch..." << std::endl;

} else {
if(debugMode)
std::cerr << " => INFO: Punkt' " << e << "' gefunden an: " << pos << std::endl;
break;
}
}
if(pos == std::string::npos) { if(pos == std::string::npos) {
std::cout << " => Error: Konnte Position von \"" << "<script async=" << "\" nicht finden.(Punkt nach RedLinks)" <<std::endl; std::cout << " => Error: Konnte Position von \"" << "<script async=" << "\" nicht finden.(Punkt nach RedLinks)" <<std::endl;
return ""; return "";
} }


HTML.erase(pos,HTML.length() - pos); HTML.erase(pos,HTML.length() - pos);


//Erstezte alle NewLine Zeichen durch nichts => 1Ne Zeile //Erstezte alle NewLine Zeichen durch nichts => 1Ne Zeile

View File

@ -3,9 +3,8 @@




#include "accountManager.h" #include "accountManager.h"
//#include "curl/curl.h" #include "curl/curl.h"


#include "lib/curl.h"


#include "parameterManager.h" // for isNumber #include "parameterManager.h" // for isNumber



View File

@ -3,7 +3,7 @@


#ifndef __linux__ #ifndef __linux__
#ifndef _WIN32 #ifndef _WIN32
//#error "Error Invalid System: Only for Linux and Windows systems!" #error "Error Invalid System: Only for Linux and Windows systems!"
#endif #endif
#endif #endif


@ -26,7 +26,7 @@


#define UpdaterCloudUrlWithPath "https://cloud.obermui.de/s/tXz7SWdaPJ7TacZ/download?path=%2F&files=" #define UpdaterCloudUrlWithPath "https://cloud.obermui.de/s/tXz7SWdaPJ7TacZ/download?path=%2F&files="
#define SecondUpdaterCloudUrlWithPath "https://snew4.obermui.de/download?path=%2F&files=" #define SecondUpdaterCloudUrlWithPath "https://snew4.obermui.de/download?path=%2F&files="
#define VERSION "5.0.3" #define VERSION "5.0.4"
#define DEFAULT_FILE_VERSION "2.1" #define DEFAULT_FILE_VERSION "2.1"


//default, anime, normal, //default, anime, normal,
@ -34,6 +34,8 @@
//zu beginn, erst eiunmal serie suchen //zu beginn, erst eiunmal serie suchen






enum Modus { enum Modus {
EXIT = -1, EXIT = -1,
DEFAULT_MODUS = 0, DEFAULT_MODUS = 0,
@ -104,7 +106,7 @@ struct Settings {
const std::string VersionFileName = std::string("Version-LIN-ARMv6.txt"); const std::string VersionFileName = std::string("Version-LIN-ARMv6.txt");
const std::string ProgrammFileName = std::string("S_New4-LIN-ARMv6"); const std::string ProgrammFileName = std::string("S_New4-LIN-ARMv6");
#else #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 VersionFileName = "";
const std::string ProgrammFileName = ""; const std::string ProgrammFileName = "";
#endif #endif

View File

@ -193,6 +193,7 @@ int ProgramManager::sucheNach_1_Serien(Settings *settings, PageManager &pageMana
{ {
std::string finds; std::string finds;
std::string gewollteSeitenUrl; std::string gewollteSeitenUrl;
int NO_ERROR_BUT_EXIT_RETURN = -10101;


if(settings->pages.size() < 1) { if(settings->pages.size() < 1) {
std::cout << " => Error Keine Internet Seiten vorhanden." << std::endl; std::cout << " => Error Keine Internet Seiten vorhanden." << std::endl;
@ -205,12 +206,18 @@ int ProgramManager::sucheNach_1_Serien(Settings *settings, PageManager &pageMana
std::cerr << ">>> Debug In " << __FUNCTION__ << ": Function searchModus returned error." << std::endl; std::cerr << ">>> Debug In " << __FUNCTION__ << ": Function searchModus returned error." << std::endl;
return 24; return 24;


} else if( finds == "" ) {
if(settings->debugMode)
std::cerr << ">>> Debug In " << __FUNCTION__ << ": searchModus's returnValue = '' => Nothing found!" << std::endl;

return NO_ERROR_BUT_EXIT_RETURN;
}
// Wenn der Rückgabe wert ungültig ist brich ab... // Wenn der Rückgabe wert ungültig ist brich ab...
} else if( finds.find("|/") == std::string::npos ) { // || else if( finds.find("|/") == std::string::npos ) { // ||
if(settings->debugMode) if(settings->debugMode)
std::cerr << ">>> Debug In " << __FUNCTION__ << ": searchModus's returnValue contains no / or | => error " << std::endl; std::cerr << ">>> Debug In " << __FUNCTION__ << ": searchModus's returnValue contains no / or | => error " << std::endl;


return -10101; return 121; // error -10101 (NO_ERROR_BUT_EXIT_RETURN);


// Wenn der Rückgabewert mehrene newlines enthält gibt es mehrere Möglichkeiten // Wenn der Rückgabewert mehrene newlines enthält gibt es mehrere Möglichkeiten
} else if (finds.find("\n") != std::string::npos) { } else if (finds.find("\n") != std::string::npos) {
@ -250,7 +257,7 @@ int ProgramManager::sucheNach_1_Serien(Settings *settings, PageManager &pageMana
//Wenn kein Input, brich ab //Wenn kein Input, brich ab
if(input == "") { if(input == "") {
std::cout << " => Abbruch..." << std::endl; std::cout << " => Abbruch..." << std::endl;
return -10101; return NO_ERROR_BUT_EXIT_RETURN;
} }


//Wähle Zeile aus //Wähle Zeile aus
@ -310,7 +317,7 @@ int ProgramManager::sucheNach_1_Serien(Settings *settings, PageManager &pageMana
std::cout << " => Abbruch..." << std::endl; std::cout << " => Abbruch..." << std::endl;
if(settings->debugMode) if(settings->debugMode)
std::cerr << ">>> Debug In " << __FUNCTION__ << ": User tipped an Value => wrong serie." << std::endl; std::cerr << ">>> Debug In " << __FUNCTION__ << ": User tipped an Value => wrong serie." << std::endl;
return -10101; return NO_ERROR_BUT_EXIT_RETURN;
} }


//Überschreibe eine Zeile mit nur dem url Namen //Überschreibe eine Zeile mit nur dem url Namen
@ -866,6 +873,9 @@ int ProgramManager::searchModus(Settings *settings, std::string *saveTo, bool no
finds.pop_back(); finds.pop_back();
//------------------------------------------- //-------------------------------------------


if(settings->debugMode)
std::cout << " <DEBUG> FiNDS: '" << finds << "'" << std::endl;

if(saveTo) { if(saveTo) {
//Save List to Variable if set //Save List to Variable if set
*saveTo=finds; *saveTo=finds;
@ -1575,13 +1585,14 @@ int ProgramManager::searchModus_update(Settings *settings)
return 22; return 22;
} }


//auf anime seite noic halt auf s.to jetzt anders, näml: data-alternative-title != data-alternative-titles <--s, => data-alternative-title umfasst beides!
std::string serienListe = replace( pageManager.grep( reply.html, "data-alternative-title" ), "</li>", "\n" ); std::string serienListe = replace( pageManager.grep( reply.html, "data-alternative-title" ), "</li>", "\n" );


std::string tests[] = {"\" href=\"", "<li><a data-alternative-title", page.UrlDir, "</a>", }; std::string tests[] = {"\" href=\"", "<li><a data-alternative-title", page.UrlDir, "</a>", };
for ( auto t : tests ) { for ( auto t : tests ) {
if(reply.html.find( t ) == std::string::npos) { if(reply.html.find( t ) == std::string::npos) {
if(settings->debugMode) if(settings->debugMode)
std::cerr << ">>> Debug In " << __FUNCTION__ << ": hatml doesnt contain:'" << t << "' after preparing." << std::endl; std::cerr << ">>> Debug In " << __FUNCTION__ << ": html doesnt contain:'" << t << "' after preparing." << std::endl;
return 51; return 51;
} }
} }