forked from markus/S_New4
fix big errors: 1. in listDir add to subdir in Windows an / ,too not an ; 2.: names with an / in the name: error with search modos etc: function looks for / at url name => now: looks for |/
This commit is contained in:
parent
e79caf03af
commit
c4bbb35e11
@ -59,7 +59,7 @@ Reply PageManager::getServerRequest(std::string Url, bool useCookies, std::strin
|
|||||||
|
|
||||||
//Settings
|
//Settings
|
||||||
//curl_easy_setopt(curl, CURLOPT_FAILONERROR, true); // html errors to errorcode res
|
//curl_easy_setopt(curl, CURLOPT_FAILONERROR, true); // html errors to errorcode res
|
||||||
|
//curl_easy_setopt(curl, CURLOPT_NOPROGRESS, false); // Progressausgabe aktivieren
|
||||||
curl_easy_setopt(curl, CURLOPT_URL, Url.c_str()); //Url für Curl
|
curl_easy_setopt(curl, CURLOPT_URL, Url.c_str()); //Url für Curl
|
||||||
curl_easy_setopt(curl, CURLOPT_PROXY, sock5Proxy.c_str() ); //Sock5Proxy für Curl
|
curl_easy_setopt(curl, CURLOPT_PROXY, sock5Proxy.c_str() ); //Sock5Proxy für Curl
|
||||||
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L); //follows redirection
|
curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L); //follows redirection
|
||||||
|
@ -183,7 +183,7 @@ int ProgramManager::sucheNach_1_Serien(Settings *settings, PageManager &pageMana
|
|||||||
return 24;
|
return 24;
|
||||||
|
|
||||||
// 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 || 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 45;
|
return 45;
|
||||||
@ -227,7 +227,9 @@ int ProgramManager::sucheNach_1_Serien(Settings *settings, PageManager &pageMana
|
|||||||
// Wenn die Zeile gleich der ausgewählten ist:
|
// Wenn die Zeile gleich der ausgewählten ist:
|
||||||
} else if(static_cast<int>(i) == atoi(input.c_str()) ) {
|
} else if(static_cast<int>(i) == atoi(input.c_str()) ) {
|
||||||
//Speichere den Namen der Serie und setzte hasName auf true und brich schleife ab
|
//Speichere den Namen der Serie und setzte hasName auf true und brich schleife ab
|
||||||
if ( (finds = line.substr( line.find("/") + 1, line.find("|", line.find("/")) - line.find("/") -1) ) == "" ) {
|
if ( (finds = line.substr( line.find("|/") + 2, // beginn: nach dem |/
|
||||||
|
line.find("|", line.find("|/") + 2) // Bis zu dem | ab dem ende von |/
|
||||||
|
- line.find("|/") -2) ) == "" ) { // wegen nicht bi sondern länge, suptrahiere Pos 1
|
||||||
std::cout << " => Error: Konnte den Namen aus der zurückgegebenen Zeile nicht extrahieren. In ausWahlVariante" << std::endl;
|
std::cout << " => Error: Konnte den Namen aus der zurückgegebenen Zeile nicht extrahieren. In ausWahlVariante" << std::endl;
|
||||||
if(settings->debugMode)
|
if(settings->debugMode)
|
||||||
std::cerr << ">>> Debug In " << __FUNCTION__ << ": Return value from searchModus.subStr(pos(/)-> next |, after /) is ''." << std::endl;
|
std::cerr << ">>> Debug In " << __FUNCTION__ << ": Return value from searchModus.subStr(pos(/)-> next |, after /) is ''." << std::endl;
|
||||||
@ -249,7 +251,7 @@ int ProgramManager::sucheNach_1_Serien(Settings *settings, PageManager &pageMana
|
|||||||
line = finds;
|
line = finds;
|
||||||
|
|
||||||
//Überschreibe eine Zeile mit nur dem url Namen
|
//Überschreibe eine Zeile mit nur dem url Namen
|
||||||
if ( (finds = finds.substr( finds.find("/") + 1, finds.find("|", finds.find("/")) - finds.find("/") -1) ) == "" ) {
|
if ( (finds = finds.substr( finds.find("|/") + 2, finds.find("|", finds.find("|/") + 2) - finds.find("|/") -2) ) == "" ) {
|
||||||
std::cout << " => Error: Konnte den Namen aus der zurückgegebenen Zeile nicht extrahieren." << std::endl;
|
std::cout << " => Error: Konnte den Namen aus der zurückgegebenen Zeile nicht extrahieren." << std::endl;
|
||||||
if(settings->debugMode)
|
if(settings->debugMode)
|
||||||
std::cerr << ">>> Debug In " << __FUNCTION__ << ": Return value from searchModus.subStr(pos(/)-> next |, after /) is ''." << std::endl;
|
std::cerr << ">>> Debug In " << __FUNCTION__ << ": Return value from searchModus.subStr(pos(/)-> next |, after /) is ''." << std::endl;
|
||||||
@ -699,8 +701,8 @@ int ProgramManager::searchModus(Settings *settings, std::string *saveTo, bool no
|
|||||||
std::string line;
|
std::string line;
|
||||||
std::cout << " => Für '" << settings->name << "' wurde(n) folgende Serie(n) gefunden: " << std::endl;
|
std::cout << " => Für '" << settings->name << "' wurde(n) folgende Serie(n) gefunden: " << std::endl;
|
||||||
while (getline(strstream, line)) {
|
while (getline(strstream, line)) {
|
||||||
std::cout << " > " << line.substr(line.find("|", line.find("/")) + 1, line.length() - line.find("|", line.find("/")) -1 )
|
std::cout << " > " << line.substr(line.find_last_of('|') + 1, std::string::npos )
|
||||||
<< "\t[" << line.substr(line.find("/") + 1, line.find("|", line.find("/")) - line.find("/") - 1) << "]"
|
<< "\t[" << line.substr(line.find("|/") + 2, line.find("|", line.find("|/") + 2) - line.find("|/") - 2) << "]"
|
||||||
<< ( (line[0] == '|') ? "" : "\t( " + line.substr(0, line.find("|")) + " )" ) << std::endl;
|
<< ( (line[0] == '|') ? "" : "\t( " + line.substr(0, line.find("|")) + " )" ) << std::endl;
|
||||||
}
|
}
|
||||||
if(settings->debugMode)
|
if(settings->debugMode)
|
||||||
@ -1302,8 +1304,8 @@ int ProgramManager::listDir(std::string &list,std::string path, int maxDepth)
|
|||||||
if(strcmp( dp->d_name, "." ) == 0 || strcmp ( dp->d_name, ".." ) == 0)
|
if(strcmp( dp->d_name, "." ) == 0 || strcmp ( dp->d_name, ".." ) == 0)
|
||||||
continue;
|
continue;
|
||||||
|
|
||||||
else if(dirExists((path + dp->d_name + "/"))) { //if(dp->d_type == DT_DIR) {
|
else if(dirExists((path + dp->d_name + ((path.find("/") == std::string::npos) ? "\\" : "/") ))) { //if(dp->d_type == DT_DIR) {
|
||||||
listDir(list, (path + dp->d_name + "/"), maxDepth);
|
listDir(list, (path + dp->d_name + ((path.find("/") == std::string::npos) ? "\\" : "/") ), maxDepth);
|
||||||
} else
|
} else
|
||||||
list.append( std::string(dp->d_name) + "\n" );
|
list.append( std::string(dp->d_name) + "\n" );
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user