From d3ed67f3beac1c1a4a69fa7bef2160ea2fd2bd98 Mon Sep 17 00:00:00 2001 From: Markus Date: Sun, 1 Sep 2019 20:21:06 +0200 Subject: [PATCH] add to info modus: Names from the episodes --- programManager.cpp | 59 +++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 58 insertions(+), 1 deletion(-) diff --git a/programManager.cpp b/programManager.cpp index 0188515..402262b 100644 --- a/programManager.cpp +++ b/programManager.cpp @@ -476,9 +476,66 @@ int ProgramManager::infoModus(Settings *settings) Reply tmpReply = pageManager.getServerRequest(pageManager.UrlPraefix + nameInUrl + "/staffel-" + std::to_string(staffel)); if(tmpReply.html == "-1") 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; + std::string html = tmpReply.html; + size_t pos = 0; + if( (pos = html.find(" Error: Konnte Position von '")) == std::string::npos) { + std::cout << " => Error: Konnte Position von '' nicht finden." << std::endl; + return 42; + } else + html.erase(pos, std::string::npos); + html = pageManager.replace(html, "\n", ""); + html = pageManager.replace(html, "", "\n"); + + std::stringstream folgenListe(html); + std::string line; + while (std::getline(folgenListe, line).good()) { + std::string titel; + + if( (pos = line.find("\"> Folge")) == std::string::npos) { + std::cout << " => Error: Konnte Position von '\"> Folge' nicht finden." << std::endl; + return 43; + } else + line.erase(0, pos + 3); + if( (pos = line.find(" ")) == std::string::npos) { + std::cout << " => Error: Konnte Position von ' ' nicht finden." << std::endl; + return 44; + } + std::cout << " Staffel " << staffel << " " << line.substr(0, pos) << ":" <")) == std::string::npos) { + std::cout << " => Error: Konnte Position von '' nicht finden." << std::endl; + return 43; + } else + line.erase(0, pos + 8); + if( (pos = line.find("")) == std::string::npos) { + std::cout << " => Error: Konnte Position von '' nicht finden." << std::endl; + return 44; + } + titel = line.substr(0, pos); + if(titel != "") + std::cout << " > Titel1: " << titel << std::endl; + + if( (pos = line.find("")) == std::string::npos) { + std::cout << " => Error: Konnte Position von '' nicht finden." << std::endl; + return 43; + } else + line.erase(0, pos + 6); + if( (pos = line.find("")) == std::string::npos) { + std::cout << " => Error: Konnte Position von '' nicht finden." << std::endl; + return 44; + } + titel = line.substr(0, pos); + if(titel != "") + std::cout << " > Titel2: " << titel << std::endl; + } }