forked from markus/S_New4
v3.5.0: bei info Subfunction: Parameter um Folgenausgabe zu verhind(Namen ausgabe
This commit is contained in:
parent
6a526269db
commit
f3f125b562
@ -875,12 +875,13 @@ int unterOption_info(Settings *settings, int argc, char **argv)
|
|||||||
{"help", no_argument, nullptr, 'h'},
|
{"help", no_argument, nullptr, 'h'},
|
||||||
{"colorless", no_argument, nullptr, 'c'},
|
{"colorless", no_argument, nullptr, 'c'},
|
||||||
{"debug-mode", no_argument, nullptr, 'd'},
|
{"debug-mode", no_argument, nullptr, 'd'},
|
||||||
|
{"skip-episoden-names", no_argument, nullptr, 's'},
|
||||||
|
|
||||||
{nullptr, no_argument, nullptr, 0}
|
{nullptr, no_argument, nullptr, 0}
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
while( ( c = getopt_long (argc, argv, "p:hcd", long_opts, nullptr) ) != -1 ) {
|
while( ( c = getopt_long (argc, argv, "p:hcds", long_opts, nullptr) ) != -1 ) {
|
||||||
switch(c) {
|
switch(c) {
|
||||||
case 'p':
|
case 'p':
|
||||||
if(optarg && setS5ProxytoSettings(*settings, optarg) != 0)
|
if(optarg && setS5ProxytoSettings(*settings, optarg) != 0)
|
||||||
@ -899,6 +900,11 @@ int unterOption_info(Settings *settings, int argc, char **argv)
|
|||||||
if(settings->debugMode)
|
if(settings->debugMode)
|
||||||
std::cout << "Debug Modus: true" << std::endl;
|
std::cout << "Debug Modus: true" << std::endl;
|
||||||
break;
|
break;
|
||||||
|
case 's':
|
||||||
|
settings->skipEpisodenNameOutput = true;
|
||||||
|
if(settings->debugMode)
|
||||||
|
std::cout << "skipEpisodenNameOutput: true" << std::endl;
|
||||||
|
break;
|
||||||
default:
|
default:
|
||||||
std::cout << "Aufruf: " << settings->programName << " info [OPTION]... [NAME]..." << std::endl;
|
std::cout << "Aufruf: " << settings->programName << " info [OPTION]... [NAME]..." << std::endl;
|
||||||
std::cout << "\"" << settings->programName << " info --help\" liefert weitere Informationen." << std::endl;
|
std::cout << "\"" << settings->programName << " info --help\" liefert weitere Informationen." << std::endl;
|
||||||
@ -939,6 +945,9 @@ void unterOption_info_help(std::string programName)
|
|||||||
<< " -d, --debug-mode" << std::endl
|
<< " -d, --debug-mode" << std::endl
|
||||||
<< " Mit dieser Option kann man den Debug-Modus einschalten." << std::endl
|
<< " Mit dieser Option kann man den Debug-Modus einschalten." << std::endl
|
||||||
<< " Dabei werden vielmehr Infos ausgegeben." << std::endl << std::endl
|
<< " Dabei werden vielmehr Infos ausgegeben." << std::endl << std::endl
|
||||||
|
<< " -s, --skip-episoden-names" << std::endl
|
||||||
|
<< " Mit dieser Option kann man die Ausgabe der Namen der" << std::endl
|
||||||
|
<< " einzelnen Folgen ausschalten." << std::endl << std::endl
|
||||||
<< " -h, --help" << std::endl
|
<< " -h, --help" << std::endl
|
||||||
<< " Mit dieser Option wird dieses Helpmenue ausgegeben." << std::endl;
|
<< " Mit dieser Option wird dieses Helpmenue ausgegeben." << std::endl;
|
||||||
}
|
}
|
||||||
|
@ -63,7 +63,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.4.6",
|
version = "3.5.0",
|
||||||
defaultFileVersion="1.6",
|
defaultFileVersion="1.6",
|
||||||
outputFilePath = "",
|
outputFilePath = "",
|
||||||
default_checkPath = "",
|
default_checkPath = "",
|
||||||
@ -74,7 +74,8 @@ struct Settings {
|
|||||||
debugMode = false,
|
debugMode = false,
|
||||||
search_IgnoreUpperLower = true,
|
search_IgnoreUpperLower = true,
|
||||||
search_wantUpdate = false,
|
search_wantUpdate = false,
|
||||||
askForEveryDir = true;
|
askForEveryDir = true,
|
||||||
|
skipEpisodenNameOutput = false;
|
||||||
int startEpisode = 1,
|
int startEpisode = 1,
|
||||||
stopEpisode = 0,
|
stopEpisode = 0,
|
||||||
startSeason = 1,
|
startSeason = 1,
|
||||||
|
@ -738,90 +738,97 @@ int ProgramManager::infoModus(Settings *settings)
|
|||||||
return 32;
|
return 32;
|
||||||
}
|
}
|
||||||
|
|
||||||
int gesammtFolge = 0;
|
|
||||||
std::string green = ((settings->colorless) ? "" : "\033[92m"),
|
std::string green = ((settings->colorless) ? "" : "\033[92m"),
|
||||||
lila = ((settings->colorless) ? "" : "\033[95m"),
|
lila = ((settings->colorless) ? "" : "\033[95m"),
|
||||||
Lightyellow = ((settings->colorless) ? "" : "\033[93m"),
|
Lightyellow = ((settings->colorless) ? "" : "\033[93m"),
|
||||||
Darkyellow = ((settings->colorless) ? "" : "\033[33m"),
|
Darkyellow = ((settings->colorless) ? "" : "\033[33m"),
|
||||||
blue = ((settings->colorless) ? "" : "\033[96m"),
|
blue = ((settings->colorless) ? "" : "\033[96m"),
|
||||||
white = "\033[0m";
|
white = "\033[0m";
|
||||||
//speicher (zahl -1), ab da wo /staffel-x nicht mehr vorkommt
|
|
||||||
int maxStaffel = pageManager.counterContains(tmp_reply.html, "/staffel-%i");
|
|
||||||
|
|
||||||
//Um namen der Folge für jede Staffel zu bekommen
|
|
||||||
for (int staffel = 1; staffel <= maxStaffel; ++staffel) {
|
|
||||||
Reply tmpReply = pageManager.getServerRequest(pageManager.UrlPraefix + nameInUrl + "/staffel-" + std::to_string(staffel));
|
|
||||||
if(tmpReply.html == "-1") {
|
|
||||||
if(settings->debugMode)
|
|
||||||
std::cerr << ">>> Debug In " << __FUNCTION__ << ": getServerRequest function failed: at season page." << std::endl;
|
|
||||||
return 40;
|
|
||||||
}
|
|
||||||
|
|
||||||
std::cout << std::endl
|
if( ! settings->skipEpisodenNameOutput) {
|
||||||
<< green << "Die Staffel " << staffel << " hat " << pageManager.counterContains(tmpReply.html, "/episode-%i") << " Folge(n)." << white << std::endl
|
|
||||||
<< std::endl;
|
|
||||||
|
|
||||||
std::string html = tmpReply.html;
|
//Für FolgenNummer ingesmammt
|
||||||
size_t pos = 0;
|
int gesammtFolge = 0;
|
||||||
if( (pos = html.find("<tr ")) == std::string::npos) {
|
//speicher (zahl -1), ab da wo /staffel-x nicht mehr vorkommt
|
||||||
std::cout << " => Error: Konnte Position von '<tr ' nicht finden." << std::endl;
|
int maxStaffel = pageManager.counterContains(tmp_reply.html, "/staffel-%i");
|
||||||
return 41;
|
|
||||||
} else
|
|
||||||
html.erase(0, pos);
|
|
||||||
if( (pos = html.find("</tbody>")) == std::string::npos) {
|
|
||||||
std::cout << " => Error: Konnte Position von '</tbody>' nicht finden." << std::endl;
|
|
||||||
return 42;
|
|
||||||
} else
|
|
||||||
html.erase(pos, std::string::npos);
|
|
||||||
|
|
||||||
html = pageManager.replace(html, "\n", "");
|
//Um namen der Folge für jede Staffel zu bekommen
|
||||||
html = pageManager.replace(html, "</tr>", "\n");
|
for (int staffel = 1; staffel <= maxStaffel; ++staffel) {
|
||||||
|
Reply tmpReply = pageManager.getServerRequest(pageManager.UrlPraefix + nameInUrl + "/staffel-" + std::to_string(staffel));
|
||||||
std::stringstream folgenListe(html);
|
if(tmpReply.html == "-1") {
|
||||||
std::string line;
|
if(settings->debugMode)
|
||||||
|
std::cerr << ">>> Debug In " << __FUNCTION__ << ": getServerRequest function failed: at season page." << std::endl;
|
||||||
while (std::getline(folgenListe, line).good()) {
|
return 40;
|
||||||
std::string titel;
|
|
||||||
gesammtFolge = gesammtFolge + 1;
|
|
||||||
|
|
||||||
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 + 9);
|
|
||||||
if( (pos = line.find(" </a>")) == std::string::npos) {
|
|
||||||
std::cout << " => Error: Konnte Position von ' </a>' nicht finden." << std::endl;
|
|
||||||
return 44;
|
|
||||||
}
|
}
|
||||||
std::cout << lila << "Ep. " << blue << ( (gesammtFolge < 100) ? ( (gesammtFolge < 10) ? "00" : "0" ) : "" ) << gesammtFolge << lila
|
|
||||||
<< " ( " << blue << "S" << ( (staffel < 10) ? "0" : "" ) << staffel
|
|
||||||
<< "E" << ( ( atoi( line.substr(0, pos).c_str() ) < 10) ? "0" : "" ) << line.substr(0, pos) << lila << " ):" << white <<std::endl;
|
|
||||||
|
|
||||||
if( (pos = line.find("<strong>")) == std::string::npos) {
|
std::cout << std::endl
|
||||||
std::cout << " => Error: Konnte Position von '<strong>' nicht finden." << std::endl;
|
<< green << "Die Staffel " << staffel << " hat " << pageManager.counterContains(tmpReply.html, "/episode-%i") << " Folge(n)." << white << std::endl
|
||||||
return 43;
|
<< std::endl;
|
||||||
} else
|
|
||||||
line.erase(0, pos + 8);
|
|
||||||
if( (pos = line.find("</strong>")) == std::string::npos) {
|
|
||||||
std::cout << " => Error: Konnte Position von '</strong>' nicht finden." << std::endl;
|
|
||||||
return 44;
|
|
||||||
}
|
|
||||||
titel = line.substr(0, pos);
|
|
||||||
if(titel != "")
|
|
||||||
std::cout << lila << " > Titel 1: " << Lightyellow << titel << white << std::endl;
|
|
||||||
|
|
||||||
if( (pos = line.find("<span>")) == std::string::npos) {
|
std::string html = tmpReply.html;
|
||||||
std::cout << " => Error: Konnte Position von '<span>' nicht finden." << std::endl;
|
size_t pos = 0;
|
||||||
return 43;
|
if( (pos = html.find("<tr ")) == std::string::npos) {
|
||||||
|
std::cout << " => Error: Konnte Position von '<tr ' nicht finden." << std::endl;
|
||||||
|
return 41;
|
||||||
} else
|
} else
|
||||||
line.erase(0, pos + 6);
|
html.erase(0, pos);
|
||||||
if( (pos = line.find("</span>")) == std::string::npos) {
|
if( (pos = html.find("</tbody>")) == std::string::npos) {
|
||||||
std::cout << " => Error: Konnte Position von '</span>' nicht finden." << std::endl;
|
std::cout << " => Error: Konnte Position von '</tbody>' nicht finden." << std::endl;
|
||||||
return 44;
|
return 42;
|
||||||
|
} else
|
||||||
|
html.erase(pos, std::string::npos);
|
||||||
|
|
||||||
|
html = pageManager.replace(html, "\n", "");
|
||||||
|
html = pageManager.replace(html, "</tr>", "\n");
|
||||||
|
|
||||||
|
std::stringstream folgenListe(html);
|
||||||
|
std::string line;
|
||||||
|
|
||||||
|
while (std::getline(folgenListe, line).good()) {
|
||||||
|
std::string titel;
|
||||||
|
gesammtFolge = gesammtFolge + 1;
|
||||||
|
|
||||||
|
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 + 9);
|
||||||
|
if( (pos = line.find(" </a>")) == std::string::npos) {
|
||||||
|
std::cout << " => Error: Konnte Position von ' </a>' nicht finden." << std::endl;
|
||||||
|
return 44;
|
||||||
|
}
|
||||||
|
std::cout << lila << "Ep. " << blue << ( (gesammtFolge < 100) ? ( (gesammtFolge < 10) ? "00" : "0" ) : "" ) << gesammtFolge << lila
|
||||||
|
<< " ( " << blue << "S" << ( (staffel < 10) ? "0" : "" ) << staffel
|
||||||
|
<< "E" << ( ( atoi( line.substr(0, pos).c_str() ) < 10) ? "0" : "" ) << line.substr(0, pos) << lila << " ):" << white <<std::endl;
|
||||||
|
|
||||||
|
if( (pos = line.find("<strong>")) == std::string::npos) {
|
||||||
|
std::cout << " => Error: Konnte Position von '<strong>' nicht finden." << std::endl;
|
||||||
|
return 43;
|
||||||
|
} else
|
||||||
|
line.erase(0, pos + 8);
|
||||||
|
if( (pos = line.find("</strong>")) == std::string::npos) {
|
||||||
|
std::cout << " => Error: Konnte Position von '</strong>' nicht finden." << std::endl;
|
||||||
|
return 44;
|
||||||
|
}
|
||||||
|
titel = line.substr(0, pos);
|
||||||
|
if(titel != "")
|
||||||
|
std::cout << lila << " > Titel 1: " << Lightyellow << titel << white << std::endl;
|
||||||
|
|
||||||
|
if( (pos = line.find("<span>")) == std::string::npos) {
|
||||||
|
std::cout << " => Error: Konnte Position von '<span>' nicht finden." << std::endl;
|
||||||
|
return 43;
|
||||||
|
} else
|
||||||
|
line.erase(0, pos + 6);
|
||||||
|
if( (pos = line.find("</span>")) == std::string::npos) {
|
||||||
|
std::cout << " => Error: Konnte Position von '</span>' nicht finden." << std::endl;
|
||||||
|
return 44;
|
||||||
|
}
|
||||||
|
titel = line.substr(0, pos);
|
||||||
|
if(titel != "")
|
||||||
|
std::cout << lila << " > Titel 2: " << Darkyellow << titel << white << std::endl;
|
||||||
}
|
}
|
||||||
titel = line.substr(0, pos);
|
|
||||||
if(titel != "")
|
|
||||||
std::cout << lila << " > Titel 2: " << Darkyellow << titel << white << std::endl;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user