v3.0.6: fix error: overrite name in function select 1 serien && new look for debug messages

This commit is contained in:
Markus 2019-10-08 20:10:12 +02:00
parent 6a74f47102
commit ee46da07cb
3 changed files with 51 additions and 50 deletions

View File

@ -51,12 +51,12 @@ int manageParameter(Settings &settings, int argc, char **argv)
//Path settings //Path settings
if(setPaths(settings) != 0) { if(setPaths(settings) != 0) {
if(settings.debugMode) if(settings.debugMode)
std::cerr << " => Debug In " << __FUNCTION__ << ": setPaths f() failed." << std::endl; std::cerr << ">>> Debug In " << __FUNCTION__ << ": setPaths f() failed." << std::endl;
return -1; return -1;
} }
if(loadDefaulOptions(settings) != 0) { if(loadDefaulOptions(settings) != 0) {
if(settings.debugMode) if(settings.debugMode)
std::cerr << " => Debug In " << __FUNCTION__ << ": loadDefaulOptions f() failed." << std::endl; std::cerr << ">>> Debug In " << __FUNCTION__ << ": loadDefaulOptions f() failed." << std::endl;
return 28; return 28;
} }



View File

@ -50,7 +50,7 @@ struct Settings {
proxy_ip = "127.0.0.1", proxy_ip = "127.0.0.1",
languages = "GerDub,GerSub,Eng", languages = "GerDub,GerSub,Eng",
genaueHoster = "", genaueHoster = "",
version = "3.0.5", version = "3.0.6",
defaultFileVersion="1.6", defaultFileVersion="1.6",
outputFilePath = "", outputFilePath = "",
default_checkPath = "", default_checkPath = "",

View File

@ -170,39 +170,40 @@ int ProgramManager::waitForThreads()


int ProgramManager::sucheNach_1_Serien(Settings *settings, PageManager &pageManager, std::string &newName) int ProgramManager::sucheNach_1_Serien(Settings *settings, PageManager &pageManager, std::string &newName)
{ {
std::string finds; std::string finds, line;
if(searchModus(settings, &finds) != 0) { if(searchModus(settings, &finds) != 0) {
if(settings->debugMode) if(settings->debugMode)
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.find("/") == std::string::npos || finds.find("|") == std::string::npos || finds.find("\n") != std::string::npos) { else if(finds.find("/") == std::string::npos || finds.find("|") == std::string::npos || finds.find("\n") != std::string::npos) {
if(settings->debugMode) if(settings->debugMode)
std::cerr << " => Debug In " << __FUNCTION__ << ": searchModus's returnValue contains no / or |, or " << std::endl std::cerr << ">>> Debug In " << __FUNCTION__ << ": searchModus's returnValue contains no / or |, or " << std::endl
<< "\t\t\tcontains an \\n => more than 1 Serie found => error." << std::endl; << "\t\t\tcontains an \\n => more than 1 Serie found => error." << std::endl;
return 45; return 45;
} }
else if ( (finds = finds.substr( finds.find("/") + 1, finds.find("|", finds.find("/")) - finds.find("/") -1) ) == "" ) { else if ( (finds = finds.substr( finds.find("/") + 1, finds.find("|", finds.find("/")) - finds.find("/") -1) ) == "" ) {
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;
return 46; return 46;
} }

std::cout << "Ist das deine gewünschte Serie? Drücke nur Enter um fortzufahren: " << std::flush; std::cout << "Ist das deine gewünschte Serie? Drücke nur Enter um fortzufahren: " << std::flush;
std::getline(std::cin, finds); std::getline(std::cin, line);
if ( finds != "") { if ( line != "") {
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 48; return 48;
} else if ( (newName = pageManager.checkName(finds)) == "-1") { } else if ( (newName = pageManager.checkName(finds)) == "-1") {
std::cout << " => Error: Konnte die von der Suche vorgeschlagene Serie nicht finden." << std::endl; std::cout << " => Error: Konnte die von der Suche vorgeschlagene Serie nicht finden." << std::endl;
if(settings->debugMode) if(settings->debugMode)
std::cerr << " => Debug In " << __FUNCTION__ << ": Extracted Name from searchModus is invalid." << std::endl; std::cerr << ">>> Debug In " << __FUNCTION__ << ": Extracted Name from searchModus is invalid." << std::endl;
return 47; return 47;
} else { } else {
if(settings->debugMode) if(settings->debugMode)
std::cerr << " => Debug In " << __FUNCTION__ << ": Use new SerienName: '" << newName << "'." << std::endl; std::cerr << ">>> Debug In " << __FUNCTION__ << ": Use new SerienName: '" << newName << "'." << std::endl;
return 0; return 0;
} }
} }
@ -211,7 +212,7 @@ int ProgramManager::checkLastUpdate(Settings *settings)
{ {
if(settings->updateWarningDays == 0) { if(settings->updateWarningDays == 0) {
if(settings->debugMode) if(settings->debugMode)
std::cerr << " => Debug In " << __FUNCTION__ << ": In settings: upDateWaring is deaktivated(seted to 0)." << std::endl; std::cerr << ">>> Debug In " << __FUNCTION__ << ": In settings: upDateWaring is deaktivated(seted to 0)." << std::endl;
return 0; return 0;
} }


@ -219,7 +220,7 @@ int ProgramManager::checkLastUpdate(Settings *settings)
if(!ifs.is_open()) { if(!ifs.is_open()) {
perror(("Konnte die Datei '" + settings->lastUpdateDateFilePath + "' nicht öffnen").c_str()); perror(("Konnte die Datei '" + settings->lastUpdateDateFilePath + "' nicht öffnen").c_str());
if(settings->debugMode) if(settings->debugMode)
std::cerr << " => Debug In " << __FUNCTION__ << ": Failed to open Last Update Date File:'" << settings->lastUpdateDateFilePath << "'." << std::endl; std::cerr << ">>> Debug In " << __FUNCTION__ << ": Failed to open Last Update Date File:'" << settings->lastUpdateDateFilePath << "'." << std::endl;
return 1; return 1;
} }
std::string line; std::string line;
@ -227,7 +228,7 @@ int ProgramManager::checkLastUpdate(Settings *settings)
if(!std::getline(ifs, line).good()) { if(!std::getline(ifs, line).good()) {
perror("GetLine from Date failed"); perror("GetLine from Date failed");
if(settings->debugMode) if(settings->debugMode)
std::cerr << " => Debug In " << __FUNCTION__ << ": Get the first Line of the LastUpdateDate File failed." << std::endl; std::cerr << ">>> Debug In " << __FUNCTION__ << ": Get the first Line of the LastUpdateDate File failed." << std::endl;
return 2; return 2;


} else if( ( ( difDays = static_cast<long long>(pageManager.getDate()) - atoll(line.c_str()) )) >= settings->updateWarningDays) { } else if( ( ( difDays = static_cast<long long>(pageManager.getDate()) - atoll(line.c_str()) )) >= settings->updateWarningDays) {
@ -236,7 +237,7 @@ int ProgramManager::checkLastUpdate(Settings *settings)
} }


if(settings->debugMode) if(settings->debugMode)
std::cerr << " => Debug In " << __FUNCTION__ << ": Exit with success." << std::endl; std::cerr << ">>> Debug In " << __FUNCTION__ << ": Exit with success." << std::endl;
return 0; return 0;
} }


@ -275,7 +276,7 @@ int ProgramManager::defaultModus(Settings *settings)
if(settings->default_checkPath != "") if(settings->default_checkPath != "")
if(listDir(dirFiles, settings->default_checkPath, settings->default_maxDirs ) != 0) { if(listDir(dirFiles, settings->default_checkPath, settings->default_maxDirs ) != 0) {
if(settings->debugMode) if(settings->debugMode)
std::cerr << " => Debug In " << __FUNCTION__ << ": listDir failed." << std::endl; std::cerr << ">>> Debug In " << __FUNCTION__ << ": listDir failed." << std::endl;
return 28; return 28;
} }
if(dirFiles.length() > 0) //Entferne von der liste das \n am ende if(dirFiles.length() > 0) //Entferne von der liste das \n am ende
@ -290,7 +291,7 @@ int ProgramManager::defaultModus(Settings *settings)
//Wenn nicht, dann fühe noch eine Suche nach ähnlichen durch && Wenn nur 1ne dacnn frag ob es diese ist. //Wenn nicht, dann fühe noch eine Suche nach ähnlichen durch && Wenn nur 1ne dacnn frag ob es diese ist.
if( sucheNach_1_Serien(settings, pageManager, nameInUrl) != 0) { if( sucheNach_1_Serien(settings, pageManager, nameInUrl) != 0) {
if(settings->debugMode) if(settings->debugMode)
std::cerr << " => Debug In " << __FUNCTION__ << ": sucheNach_1_Serien failed or found more options." << std::endl; std::cerr << ">>> Debug In " << __FUNCTION__ << ": sucheNach_1_Serien failed or found more options." << std::endl;
return 202; return 202;
} }
} }
@ -324,7 +325,7 @@ int ProgramManager::defaultModus(Settings *settings)
if(settings->outputFilePath != "" && !fileExists( settings->default_checkPath )) if(settings->outputFilePath != "" && !fileExists( settings->default_checkPath ))
if(pageManager.writeToFile(settings->outputFilePath, "Name: " + settings->name) != 0) { if(pageManager.writeToFile(settings->outputFilePath, "Name: " + settings->name) != 0) {
if(settings->debugMode) if(settings->debugMode)
std::cerr << " => Debug In " << __FUNCTION__ << ": writeToFile Function fails when write Name." << std::endl; std::cerr << ">>> Debug In " << __FUNCTION__ << ": writeToFile Function fails when write Name." << std::endl;
return 31; return 31;
} }


@ -333,7 +334,7 @@ int ProgramManager::defaultModus(Settings *settings)
Reply tmp_reply = pageManager.getServerRequest(pageManager.UrlPraefix + nameInUrl); Reply tmp_reply = pageManager.getServerRequest(pageManager.UrlPraefix + nameInUrl);
if(tmp_reply.html == "-1") { if(tmp_reply.html == "-1") {
if(settings->debugMode) if(settings->debugMode)
std::cerr << " => Debug In " << __FUNCTION__ << ": getServerRequest failed, when download startpage." << std::endl; std::cerr << ">>> Debug In " << __FUNCTION__ << ": getServerRequest failed, when download startpage." << std::endl;
return 32; return 32;
} }


@ -353,7 +354,7 @@ int ProgramManager::defaultModus(Settings *settings)
if(settings->maxThreads != 0) if(settings->maxThreads != 0)
if(waitForThreads() != 0) { if(waitForThreads() != 0) {
if(settings->debugMode) if(settings->debugMode)
std::cerr << " => Debug In " << __FUNCTION__ << ": Wait for the Threads failed." << std::endl; std::cerr << ">>> Debug In " << __FUNCTION__ << ": Wait for the Threads failed." << std::endl;
return 261; return 261;
} }
if(settings->debugMode) if(settings->debugMode)
@ -365,7 +366,7 @@ int ProgramManager::defaultModus(Settings *settings)
//Find out number of all episodes //Find out number of all episodes
if( (tmp_reply = pageManager.getServerRequest(pageManager.UrlPraefix + nameInUrl + "/staffel-" + std::to_string(staffel))).html == "-1") { if( (tmp_reply = pageManager.getServerRequest(pageManager.UrlPraefix + nameInUrl + "/staffel-" + std::to_string(staffel))).html == "-1") {
if(settings->debugMode) if(settings->debugMode)
std::cerr << " => Debug In " << __FUNCTION__ << ": getServerRequest failed when download season page." << std::endl; std::cerr << ">>> Debug In " << __FUNCTION__ << ": getServerRequest failed when download season page." << std::endl;
return 40; return 40;
} }
int maxFolge = pageManager.counterContains(tmp_reply.html, "/episode-%i"); int maxFolge = pageManager.counterContains(tmp_reply.html, "/episode-%i");
@ -382,7 +383,7 @@ int ProgramManager::defaultModus(Settings *settings)
if(settings->maxThreads != 0) if(settings->maxThreads != 0)
if(waitForThreads() != 0) { if(waitForThreads() != 0) {
if(settings->debugMode) if(settings->debugMode)
std::cerr << " => Debug In " << __FUNCTION__ << ": Wait for the Threads failed." << std::endl; std::cerr << ">>> Debug In " << __FUNCTION__ << ": Wait for the Threads failed." << std::endl;
return 261; return 261;
} }
std::cout << " > Fertig, da Folge " << folge << " größer ist als Stopfolge " << settings->stopEpisode << "."<< std::endl; std::cout << " > Fertig, da Folge " << folge << " größer ist als Stopfolge " << settings->stopEpisode << "."<< std::endl;
@ -394,7 +395,7 @@ int ProgramManager::defaultModus(Settings *settings)
if(settings->maxThreads != 0) if(settings->maxThreads != 0)
if(waitForThreads() != 0) { if(waitForThreads() != 0) {
if(settings->debugMode) if(settings->debugMode)
std::cerr << " => Debug In " << __FUNCTION__ << ": Wait for the Threads failed." << std::endl; std::cerr << ">>> Debug In " << __FUNCTION__ << ": Wait for the Threads failed." << std::endl;
return 267; return 267;
} }
std::cout << " > Fertig, da Folge " << folge << " größer ist als Stopfolge " << settings->stopEpisode << std::endl std::cout << " > Fertig, da Folge " << folge << " größer ist als Stopfolge " << settings->stopEpisode << std::endl
@ -421,14 +422,14 @@ int ProgramManager::defaultModus(Settings *settings)
if(pthread_create(&threadList[nextThread]->thread, nullptr, threadFunction, reinterpret_cast<void*>(threadList[nextThread])) != 0 ) { if(pthread_create(&threadList[nextThread]->thread, nullptr, threadFunction, reinterpret_cast<void*>(threadList[nextThread])) != 0 ) {
perror("pthread_creat failed"); perror("pthread_creat failed");
if(settings->debugMode) if(settings->debugMode)
std::cerr << " => Debug In " << __FUNCTION__ << ": Create thread for redirect converting failed." << std::endl; std::cerr << ">>> Debug In " << __FUNCTION__ << ": Create thread for redirect converting failed." << std::endl;
return 48; return 48;
} }
++nextThread; ++nextThread;
} else { // Sonnst warte bis alle Fertig sind und restarte die Folge } else { // Sonnst warte bis alle Fertig sind und restarte die Folge
if(waitForThreads() != 0) { if(waitForThreads() != 0) {
if(settings->debugMode) if(settings->debugMode)
std::cerr << " => Debug In " << __FUNCTION__ << ": Wait for the Threads failed." << std::endl; std::cerr << ">>> Debug In " << __FUNCTION__ << ": Wait for the Threads failed." << std::endl;
return 231; return 231;
} }
nextThread=0; nextThread=0;
@ -442,7 +443,7 @@ int ProgramManager::defaultModus(Settings *settings)
tmp_reply =pageManager.getServerRequest(pageManager.UrlPraefix + nameInUrl + "/staffel-" + std::to_string(staffel) + "/episode-" + std::to_string(folge)); tmp_reply =pageManager.getServerRequest(pageManager.UrlPraefix + nameInUrl + "/staffel-" + std::to_string(staffel) + "/episode-" + std::to_string(folge));
if(tmp_reply.html == "-1") { if(tmp_reply.html == "-1") {
if(settings->debugMode) if(settings->debugMode)
std::cerr << " => Debug In " << __FUNCTION__ << ": getServerRequest failed when download episoden page." << std::endl; std::cerr << ">>> Debug In " << __FUNCTION__ << ": getServerRequest failed when download episoden page." << std::endl;
return 50; return 50;
} }
std::string allLinks = pageManager.getLinks(tmp_reply.html); std::string allLinks = pageManager.getLinks(tmp_reply.html);
@ -461,13 +462,13 @@ int ProgramManager::defaultModus(Settings *settings)
line.erase(line.find("\"")); line.erase(line.find("\""));
if(convertLink(line, &accountManager, settings, staffel, folge, allLinks) != 0) { if(convertLink(line, &accountManager, settings, staffel, folge, allLinks) != 0) {
if(settings->debugMode) if(settings->debugMode)
std::cerr << " => Debug In " << __FUNCTION__ << ": convertLink failed." << std::endl; std::cerr << ">>> Debug In " << __FUNCTION__ << ": convertLink failed." << std::endl;
return 51; return 51;
} }
} }
//Stop beacause same episode every account can only 2 videos not 10-12 //Stop beacause same episode every account can only 2 videos not 10-12
if(settings->debugMode) if(settings->debugMode)
std::cerr << " => Debug In " << __FUNCTION__ << ": Stop Program, because '*'-Hoster is inperformatnt: Every Account can only 2 Vidoes not 10-12." << std::endl; std::cerr << ">>> Debug In " << __FUNCTION__ << ": Stop Program, because '*'-Hoster is inperformatnt: Every Account can only 2 Vidoes not 10-12." << std::endl;
return 0; return 0;


} else { } else {
@ -477,7 +478,7 @@ int ProgramManager::defaultModus(Settings *settings)
std::cout << allLinks << std::endl << ( (Link == "") ? "" : " -> Link: 'https://s.to") << Link << ( (Link == "") ? "" : "'\n" ); std::cout << allLinks << std::endl << ( (Link == "") ? "" : " -> Link: 'https://s.to") << Link << ( (Link == "") ? "" : "'\n" );
if(convertLink(Link, &accountManager, settings, staffel, folge, allLinks) != 0) { if(convertLink(Link, &accountManager, settings, staffel, folge, allLinks) != 0) {
if(settings->debugMode) if(settings->debugMode)
std::cerr << " => Debug In " << __FUNCTION__ << ": convert Link failed." << std::endl; std::cerr << ">>> Debug In " << __FUNCTION__ << ": convert Link failed." << std::endl;
return 51; return 51;
} }
} }
@ -492,7 +493,7 @@ int ProgramManager::defaultModus(Settings *settings)
if(settings->maxThreads != 0) if(settings->maxThreads != 0)
if(waitForThreads() != 0) { if(waitForThreads() != 0) {
if(settings->debugMode) if(settings->debugMode)
std::cerr << " => Debug In " << __FUNCTION__ << ": Wait for the Threads failed." << std::endl; std::cerr << ">>> Debug In " << __FUNCTION__ << ": Wait for the Threads failed." << std::endl;
return 292; return 292;
} }


@ -524,12 +525,12 @@ int ProgramManager::directLinkModus(Settings *settings)


} else if(convertLink(line.erase(0, ((line.find("s.to") == std::string::npos) ? 0 : line.find("s.to") + 4 )), &accountManager, settings) != 0) { } else if(convertLink(line.erase(0, ((line.find("s.to") == std::string::npos) ? 0 : line.find("s.to") + 4 )), &accountManager, settings) != 0) {
if(settings->debugMode) if(settings->debugMode)
std::cerr << " => Debug In " << __FUNCTION__ << ": convert Link failed." << std::endl; std::cerr << ">>> Debug In " << __FUNCTION__ << ": convert Link failed." << std::endl;
return 78; return 78;
} }
} }
if(settings->debugMode) if(settings->debugMode)
std::cerr << " => Debug In " << __FUNCTION__ << ": Success." << std::endl; std::cerr << ">>> Debug In " << __FUNCTION__ << ": Success." << std::endl;
return 0; return 0;
} }


@ -541,7 +542,7 @@ int ProgramManager::searchModus(Settings *settings, std::string *saveTo)
std::cout << "Erfolgreich geupdatet: Die Serienliste ist nun auf dem neusten Stand." << std::endl; std::cout << "Erfolgreich geupdatet: Die Serienliste ist nun auf dem neusten Stand." << std::endl;
if (settings->name == "") { if (settings->name == "") {
if(settings->debugMode) if(settings->debugMode)
std::cerr << " => Debug In " << __FUNCTION__ << ": Stop after Update: No Name => Only Updating." << std::endl; std::cerr << ">>> Debug In " << __FUNCTION__ << ": Stop after Update: No Name => Only Updating." << std::endl;
return 0; return 0;
} }


@ -562,7 +563,7 @@ int ProgramManager::searchModus(Settings *settings, std::string *saveTo)
std::cout << " => Keine SerienListe vorhanden. Erstelle eine neue..." << std::endl; std::cout << " => Keine SerienListe vorhanden. Erstelle eine neue..." << std::endl;
if(searchModus_update(settings) != 0) { if(searchModus_update(settings) != 0) {
if(settings->debugMode) if(settings->debugMode)
std::cerr << " => Debug In " << __FUNCTION__ << ": searchModus_update function failed." << std::endl; std::cerr << ">>> Debug In " << __FUNCTION__ << ": searchModus_update function failed." << std::endl;
return 354; return 354;
} }
else { else {
@ -578,7 +579,7 @@ int ProgramManager::searchModus(Settings *settings, std::string *saveTo)
//Check for last Update.. //Check for last Update..
if(checkLastUpdate(settings) != 0) { if(checkLastUpdate(settings) != 0) {
if(settings->debugMode) if(settings->debugMode)
std::cerr << " => Debug In " << __FUNCTION__ << ": checkLastUpdate function failed." << std::endl; std::cerr << ">>> Debug In " << __FUNCTION__ << ": checkLastUpdate function failed." << std::endl;
return -1; return -1;
} }


@ -626,7 +627,7 @@ int ProgramManager::searchModus(Settings *settings, std::string *saveTo)
<< ( (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)
std::cerr << " => Debug In " << __FUNCTION__ << ": success." << std::endl; std::cerr << ">>> Debug In " << __FUNCTION__ << ": success." << std::endl;
return 0; return 0;
} }


@ -645,7 +646,7 @@ int ProgramManager::infoModus(Settings *settings)
//Wenn nicht, dann fühe noch eine Suche nach ähnlichen durch. //Wenn nicht, dann fühe noch eine Suche nach ähnlichen durch.
if( sucheNach_1_Serien(settings, pageManager, nameInUrl) != 0) { if( sucheNach_1_Serien(settings, pageManager, nameInUrl) != 0) {
if(settings->debugMode) if(settings->debugMode)
std::cerr << " => Debug In " << __FUNCTION__ << ": sucheNach_1_Serien function failed." << std::endl; std::cerr << ">>> Debug In " << __FUNCTION__ << ": sucheNach_1_Serien function failed." << std::endl;
return 28; return 28;
} }
} }
@ -654,7 +655,7 @@ int ProgramManager::infoModus(Settings *settings)
Reply tmp_reply = pageManager.getServerRequest(pageManager.UrlPraefix + nameInUrl); Reply tmp_reply = pageManager.getServerRequest(pageManager.UrlPraefix + nameInUrl);
if(tmp_reply.html == "-1") { if(tmp_reply.html == "-1") {
if(settings->debugMode) if(settings->debugMode)
std::cerr << " => Debug In " << __FUNCTION__ << ": getServerRequest function failed: at homepage." << std::endl; std::cerr << ">>> Debug In " << __FUNCTION__ << ": getServerRequest function failed: at homepage." << std::endl;
return 32; return 32;
} }


@ -666,7 +667,7 @@ int ProgramManager::infoModus(Settings *settings)
Reply tmpReply = pageManager.getServerRequest(pageManager.UrlPraefix + nameInUrl + "/staffel-" + std::to_string(staffel)); Reply tmpReply = pageManager.getServerRequest(pageManager.UrlPraefix + nameInUrl + "/staffel-" + std::to_string(staffel));
if(tmpReply.html == "-1") { if(tmpReply.html == "-1") {
if(settings->debugMode) if(settings->debugMode)
std::cerr << " => Debug In " << __FUNCTION__ << ": getServerRequest function failed: at season page." << std::endl; std::cerr << ">>> Debug In " << __FUNCTION__ << ": getServerRequest function failed: at season page." << std::endl;
return 40; return 40;
} }
std::cout << "Die Staffel " << staffel << " hat " << pageManager.counterContains(tmpReply.html, "/episode-%i") << " Folge(n)." << std::endl; std::cout << "Die Staffel " << staffel << " hat " << pageManager.counterContains(tmpReply.html, "/episode-%i") << " Folge(n)." << std::endl;
@ -820,7 +821,7 @@ int ProgramManager::infoModus(Settings *settings)




if(settings->debugMode) if(settings->debugMode)
std::cerr << " => Debug In " << __FUNCTION__ << ": success exit." << std::endl; std::cerr << ">>> Debug In " << __FUNCTION__ << ": success exit." << std::endl;
return 0; return 0;
} }


@ -830,7 +831,7 @@ int ProgramManager::newsModus(Settings *settings)
std::string html = pageManager.getServerRequest("https://s.to/neue-episoden").html; std::string html = pageManager.getServerRequest("https://s.to/neue-episoden").html;
if(html == "-1") { if(html == "-1") {
if(settings->debugMode) if(settings->debugMode)
std::cerr << " => Debug In " << __FUNCTION__ << ": getServerRequest function failed." << std::endl; std::cerr << ">>> Debug In " << __FUNCTION__ << ": getServerRequest function failed." << std::endl;
return 1; return 1;
} }


@ -896,7 +897,7 @@ int ProgramManager::searchModus_update(Settings *settings)
Reply reply = pageManager.getServerRequest("https://s.to/serien"); Reply reply = pageManager.getServerRequest("https://s.to/serien");
if(reply.html == "-1") { if(reply.html == "-1") {
if(settings->debugMode) if(settings->debugMode)
std::cerr << " => Debug In " << __FUNCTION__ << ": getServerRequest function failed." << std::endl; std::cerr << ">>> Debug In " << __FUNCTION__ << ": getServerRequest function failed." << std::endl;
return 21; return 21;
} }
else if(reply.html.find("</html>") == std::string::npos ) { else if(reply.html.find("</html>") == std::string::npos ) {
@ -911,7 +912,7 @@ int ProgramManager::searchModus_update(Settings *settings)
reply.html.find("/serie/stream/") == std::string::npos || reply.html.find("/serie/stream/") == std::string::npos ||
reply.html.find("</a>") == std::string::npos) { reply.html.find("</a>") == std::string::npos) {
if(settings->debugMode) if(settings->debugMode)
std::cerr << " => Debug In " << __FUNCTION__ std::cerr << ">>> Debug In " << __FUNCTION__
<< ": hatml doesnt contain:' \" href=\" or <li><a data-alternative-title=\" or /serie/stream/ or </a> ' after preparing." << std::endl; << ": hatml doesnt contain:' \" href=\" or <li><a data-alternative-title=\" or /serie/stream/ or </a> ' after preparing." << std::endl;
return 51; return 51;
} }
@ -1064,7 +1065,7 @@ int ProgramManager::convertLink(std::string redirectLink, AccountManager * accou
std::cout << " => " << red << "KEINEN Hoster für die Folge " << folgenID << " gefunden." << "\033[0m" << std::endl; std::cout << " => " << red << "KEINEN Hoster für die Folge " << folgenID << " gefunden." << "\033[0m" << std::endl;
if(pageManager.writeToFile(settings->outputFilePath, std::string("KEINEN Hoster für die Folge ") + folgenID + std::string(" gefunden.")) != 0) { if(pageManager.writeToFile(settings->outputFilePath, std::string("KEINEN Hoster für die Folge ") + folgenID + std::string(" gefunden.")) != 0) {
if(settings->debugMode) if(settings->debugMode)
std::cerr << " => Debug In " << __FUNCTION__ << ": writeToFile f() failed." << std::endl; std::cerr << ">>> Debug In " << __FUNCTION__ << ": writeToFile f() failed." << std::endl;
return 130; return 130;
} }
} else { } else {
@ -1074,7 +1075,7 @@ int ProgramManager::convertLink(std::string redirectLink, AccountManager * accou
"data-lang-key=\"2\"", "language=\"Eng\"" ), "data-lang-key=\"3\"", "language=\"GerSub\"") << std::endl; "data-lang-key=\"2\"", "language=\"Eng\"" ), "data-lang-key=\"3\"", "language=\"GerSub\"") << std::endl;
if(pageManager.writeToFile(settings->outputFilePath, std::string("Keinen PASSENDEN Hoster für die Folge ") + folgenID + std::string(" gefunden.")) != 0) { if(pageManager.writeToFile(settings->outputFilePath, std::string("Keinen PASSENDEN Hoster für die Folge ") + folgenID + std::string(" gefunden.")) != 0) {
if(settings->debugMode) if(settings->debugMode)
std::cerr << " => Debug In " << __FUNCTION__ << ": writeToFile f() failed." << std::endl; std::cerr << ">>> Debug In " << __FUNCTION__ << ": writeToFile f() failed." << std::endl;
return 138; return 138;
} }
} }
@ -1086,14 +1087,14 @@ int ProgramManager::convertLink(std::string redirectLink, AccountManager * accou
std::string newUrl = pageManager.getUrlAfterRedirect("https://s.to" + redirectLink); std::string newUrl = pageManager.getUrlAfterRedirect("https://s.to" + redirectLink);
if (newUrl == "-1") { if (newUrl == "-1") {
if(settings->debugMode) if(settings->debugMode)
std::cerr << " => Debug In " << __FUNCTION__ << ": getUrlAfterRedirect f() failed." << std::endl; std::cerr << ">>> Debug In " << __FUNCTION__ << ": getUrlAfterRedirect f() failed." << std::endl;
return 102; return 102;
} else if(newUrl.find("/s.to/redirect/") != std::string::npos ) { } else if(newUrl.find("/s.to/redirect/") != std::string::npos ) {
if(settings->debugMode) if(settings->debugMode)
std::cout << "Warnung: Redirect Link nach umwandlung (Capcha?) --> Neuer Account" << std::endl; std::cout << "Warnung: Redirect Link nach umwandlung (Capcha?) --> Neuer Account" << std::endl;
if(pageManager.login(accountManager->getNextAccount()) != 0) { if(pageManager.login(accountManager->getNextAccount()) != 0) {
if(settings->debugMode) if(settings->debugMode)
std::cerr << " => Debug In " << __FUNCTION__ << ": login f() failed." << std::endl; std::cerr << ">>> Debug In " << __FUNCTION__ << ": login f() failed." << std::endl;
return -1; return -1;
} }
continue; continue;
@ -1103,7 +1104,7 @@ int ProgramManager::convertLink(std::string redirectLink, AccountManager * accou
if(settings->outputFilePath != "") if(settings->outputFilePath != "")
if(pageManager.writeToFile(settings->outputFilePath,folgenID + ( (folgenID == "") ? "" : ": " ) + newUrl) != 0) { if(pageManager.writeToFile(settings->outputFilePath,folgenID + ( (folgenID == "") ? "" : ": " ) + newUrl) != 0) {
if(settings->debugMode) if(settings->debugMode)
std::cerr << " => Debug In " << __FUNCTION__ << ": writeToFile f() failed." << std::endl; std::cerr << ">>> Debug In " << __FUNCTION__ << ": writeToFile f() failed." << std::endl;
return 108; return 108;
} }
return 0; return 0;
@ -1113,7 +1114,7 @@ int ProgramManager::convertLink(std::string redirectLink, AccountManager * accou
if(settings->outputFilePath != "") { if(settings->outputFilePath != "") {
if(pageManager.writeToFile(settings->outputFilePath, folgenID + ( (folgenID == "") ? "" : ": " ) + redirectLink) != 0) { if(pageManager.writeToFile(settings->outputFilePath, folgenID + ( (folgenID == "") ? "" : ": " ) + redirectLink) != 0) {
if(settings->debugMode) if(settings->debugMode)
std::cerr << " => Debug In " << __FUNCTION__ << ": writeToFile f() failed." << std::endl; std::cerr << ">>> Debug In " << __FUNCTION__ << ": writeToFile f() failed." << std::endl;
return 114; return 114;
} }
} }