forked from markus/S_New4
v5.4.0
This commit is contained in:
parent
04d06c2716
commit
43ab7ae760
Binary file not shown.
@ -90,7 +90,7 @@ int manageParameter(Settings &settings, int argc, char **argv)
|
||||
|
||||
//Find out right subProgramm
|
||||
|
||||
std::vector<std::string> res = compare("help\n--help\ndefault\nurl\n--version\nsearch\ninfo\nclean\nnews\n--update\n--remove\nlog\nprintjdscript", argv[1]);
|
||||
std::vector<std::string> res = compare("help\n--help\ndefault\nurl\n--version\nsearch\ninfo\nclean\nnews\n--update\n--remove\nlog\nprintjdscript\npopular", argv[1]);
|
||||
if(res.size() != 1) {
|
||||
if(res.size() == 0)
|
||||
std::cout << " => Error: Keine Unteroption für " << argv[1] << " gefunden." << std::endl;
|
||||
@ -149,6 +149,9 @@ int manageParameter(Settings &settings, int argc, char **argv)
|
||||
unterOption_printJD2_renameSkript(&settings,argc, argv);
|
||||
return -1;
|
||||
|
||||
} else if (isSame(argv, "popular")) {
|
||||
return unterOption_popular(&settings,argc, argv);
|
||||
|
||||
} else {
|
||||
std::cout << " => Error: Invalid option '" << argv[1] << "', but not detected in compare-Function" << std::endl;
|
||||
return 3;
|
||||
@ -199,7 +202,7 @@ int loadDefaulOptions(Settings &settings)
|
||||
|
||||
ofs << "# -> Einstellung gleicht dem Parameter -p, --socks5-proxy:" << std::endl;
|
||||
ofs << "# Verwende den Port 0 um keinen Proxy zu verwenden." << std::endl;
|
||||
ofs << "#Socks5Proxy=127.0.0.1:9050" << std::endl << std::endl;
|
||||
ofs << "Socks5Proxy=127.0.0.1:9150" << std::endl << std::endl;
|
||||
|
||||
ofs << "# -> Einstellung gleicht dem Parameter -c, --colorless:" << std::endl;
|
||||
ofs << "#FarbloseAusgabe=false" << std::endl << std::endl;
|
||||
@ -214,33 +217,33 @@ int loadDefaulOptions(Settings &settings)
|
||||
ofs << "OutputFile=" << settings.logFilePath << std::endl << std::endl;
|
||||
|
||||
ofs << "# -> Standart Wert für Parameter: -i, --internet-pages:" << std::endl;
|
||||
ofs << "# -> Internetseiten, auf denen die die Serie gesucht wird. " << std::endl;
|
||||
ofs << "# (anicloud.ion/serienstream.sx) - Der Priorität nach angeben!" << std::endl;
|
||||
ofs << "# Internetseiten, auf denen die die Serie gesucht wird. " << std::endl;
|
||||
ofs << "# Der Priorität nach angeben! Tipp: Erst Anime, dann Alle-Serien" << std::endl;
|
||||
ofs << "# Kombinierbar mit -f - Verwende erste Seite" << std::endl;
|
||||
ofs << "# Unterstützte Seiten:" << std::endl;
|
||||
ofs << "# s.to, 190.115.18.20, anicloud.io, serienstream.to, serien.cam, all" << std::endl;
|
||||
ofs << "# anicloud.io, s.to, 190.115.18.20, serienstream.to, serien.cam, all" << std::endl;
|
||||
ofs << "Internetseiten=AniWorld.to,serienstream.to" << std::endl << std::endl;
|
||||
|
||||
ofs << "# -> Standart Wert für Parameter: -f, --use-first:" << std::endl;
|
||||
ofs << "# -> Benutze sofort die erste Seite, wenn die Serie dort existiert." << std::endl;
|
||||
ofs << "# Wenn deaktiviert, manuelle auswahl der Seiten nötig!" << std::endl;
|
||||
ofs << "#UseFirstPage=true" << std::endl << std::endl;
|
||||
ofs << "UseFirstPage=true" << std::endl << std::endl;
|
||||
|
||||
ofs << "# -> Mit 0 Können Sie die Warnung für veraltete Suchlisten deaktivieren:" << std::endl;
|
||||
ofs << "#search_UpdateWarnungNachTagen=10" << std::endl << std::endl;
|
||||
ofs << "search_UpdateWarnungNachTagen=10" << std::endl << std::endl;
|
||||
|
||||
ofs << "# -> Mit 0 Können Sie die Warnung für nötige Updateüberprüfungen deaktivieren:" << std::endl;
|
||||
ofs << "#search_ProgrammUpdateWarnungNachTagen=10" << std::endl << std::endl;
|
||||
ofs << "search_ProgrammUpdateWarnungNachTagen=10" << std::endl << std::endl;
|
||||
|
||||
|
||||
|
||||
ofs << "#" << std::endl << "# -> Einstellungen für default Modus:" << std::endl << "#" << std::endl << std::endl;
|
||||
|
||||
ofs << "# -> Standart Wert für Parameter: -g, --genaue-hoster:" << std::endl;
|
||||
ofs << "default_GenaueHoster=UpStream,Vidoza,GoUnlimited" << std::endl << std::endl;
|
||||
ofs << "default_GenaueHoster=VOE,Vidoza" << std::endl << std::endl;
|
||||
|
||||
ofs << "# -> Standart Wert für Parameter: -l, --languages:" << std::endl;
|
||||
ofs << "#default_Sprachen=GerDub,GerSub,Eng" << std::endl << std::endl;
|
||||
ofs << "default_Sprachen=GerDub,GerSub,Eng" << std::endl << std::endl;
|
||||
|
||||
ofs << "# -> Standart Wert für Parameter: -m, --check-muster:" << std::endl;
|
||||
ofs << "#default_CheckSuchMuster=S%Staffel%E%Folge%" << std::endl << std::endl;
|
||||
@ -249,14 +252,13 @@ int loadDefaulOptions(Settings &settings)
|
||||
ofs << "#default_CheckMaxDirs=20" << std::endl << std::endl;
|
||||
|
||||
ofs << "# -> Standart Wert für Parameter: -t, --threads:" << std::endl;
|
||||
ofs << "default_maxThreads=3" << std::endl << std::endl;
|
||||
ofs << "default_maxThreads=4" << std::endl << std::endl;
|
||||
|
||||
ofs << "#" << std::endl << "# -> Einstellungen für search Modus:" << std::endl << "#" << std::endl << std::endl;
|
||||
|
||||
ofs << "# -> Standart Wert für Parameter: -e, --exactly-writing:" << std::endl;
|
||||
ofs << "#search-AchteAufGroßUndKleinschreibung=false" << std::endl << std::endl;
|
||||
|
||||
|
||||
ofs << "# -> Aktiviert werden bei der Suche sämtliche Namen der Serie angezeigt." << std::endl;
|
||||
ofs << "# Bei Animes kann das zu Mehrzeiligen ausgaben pro Serie führen!" << std::endl;
|
||||
ofs << "#search-showAllNames=false" << std::endl << std::endl;
|
||||
@ -454,6 +456,7 @@ int unterOption_help(Settings &settings)
|
||||
<< "\t\"default\"\tModus um Links von Serien zu bekommen." << std::endl
|
||||
<< "\t\"search\"\tModus um Serien zu suchen." << std::endl
|
||||
<< "\t\"info\"\t\tModus um Infos einer Serien zu bekommen." << std::endl
|
||||
<< "\t\"popular\"\t\tModus um beliebte Serien ausgeben zu lassen." << std::endl
|
||||
<< "\t\"news\"\t\tModus um neusten 75 Folgen zu sehen." << std::endl
|
||||
<< "\t\"clean\"\t\tModus um Cookie-Files zu löschen." << std::endl
|
||||
<< "\t\"log\"\t\tModus um Log Datei zu sehen / leeren." << std::endl
|
||||
@ -1089,12 +1092,13 @@ int unterOption_info(Settings *settings, int argc, char **argv)
|
||||
{"colorless", no_argument, nullptr, 'c'},
|
||||
{"debug-mode", no_argument, nullptr, 'd'},
|
||||
{"skip-episoden-names", no_argument, nullptr, 'l'},
|
||||
{"no-log", no_argument, nullptr, 'n'},
|
||||
|
||||
{nullptr, no_argument, nullptr, 0}
|
||||
|
||||
};
|
||||
|
||||
while( ( c = getopt_long (argc, argv, "p:o:i:l:fhcds", long_opts, nullptr) ) != -1 ) {
|
||||
while( ( c = getopt_long (argc, argv, "p:o:i:l:fhcdsn", long_opts, nullptr) ) != -1 ) {
|
||||
switch(c) {
|
||||
case 'p':
|
||||
if(!optarg || setS5ProxytoSettings(*settings, optarg) != 0)
|
||||
@ -1142,6 +1146,11 @@ int unterOption_info(Settings *settings, int argc, char **argv)
|
||||
if(settings->debugMode)
|
||||
std::cout << "skipEpisodenNameOutput: true" << std::endl;
|
||||
break;
|
||||
case 'n':
|
||||
settings->no_log = true;
|
||||
if(settings->debugMode)
|
||||
std::cout << "NO LOG: true" << std::endl;
|
||||
break;
|
||||
default:
|
||||
std::cout << "Aufruf: " << settings->programName << " info [OPTION]... [NAME]..." << std::endl;
|
||||
std::cout << "\"" << settings->programName << " info --help\" liefert weitere Informationen." << std::endl;
|
||||
@ -1196,6 +1205,8 @@ void unterOption_info_help(std::string programName)
|
||||
<< " Standart: 127.0.0.1:9050" << std::endl << std::endl
|
||||
<< " -c, --colorless" << std::endl
|
||||
<< " Mit dieser Option kann man die farbige Ausgabe ausstellen." << std::endl << std::endl
|
||||
<< " -n, --no-log" << std::endl
|
||||
<< " Mit dieser Option kann man das autoschreiben ins LogFile verhindern." << std::endl << std::endl
|
||||
<< " -d, --debug-mode" << std::endl
|
||||
<< " Mit dieser Option kann man den Debug-Modus einschalten." << std::endl
|
||||
<< " Dabei werden vielmehr Infos ausgegeben." << std::endl << std::endl
|
||||
@ -1487,7 +1498,7 @@ void unterOption_news_help(std::string programName)
|
||||
std::cout << "Aufruf: " << programName << " news [OPTION]..." << std::endl << std::endl;
|
||||
|
||||
std::cout << "Beschreibung:" << std::endl
|
||||
<< " Mit dieser Unterfunktion kann man die neuesten 75 Folgen auf serienstream.sx sehen." << std::endl << std::endl;
|
||||
<< " Mit dieser Unterfunktion kann man die neuesten 75 Folgen sehen." << std::endl << std::endl;
|
||||
|
||||
std::cout << "INTERNETSEITEN OPTIONEN:" << std::endl
|
||||
<< " -i [Url1,Url2], --internet-pages [Url1,Url2]" << std::endl
|
||||
@ -1859,6 +1870,9 @@ int setUpInternetPages(Settings &settings, std::string optarg)
|
||||
continue;
|
||||
value = PageManager::upper_string(value);
|
||||
if(value == "ALL") {
|
||||
if(settings.debugMode)
|
||||
std::cout << "use all internetseiten" << std::endl;
|
||||
|
||||
for( const auto & internetSeite : settings.pagesALL )
|
||||
settings.pagesInUse.push_back(internetSeite);
|
||||
break;
|
||||
@ -1886,6 +1900,8 @@ int setUpInternetPages(Settings &settings, std::string optarg)
|
||||
|
||||
int unterOption_printJD2_renameSkript(Settings *settings, int argc, char ** argv)
|
||||
{
|
||||
settings->modus = Modus::PRINT_JD2_SKRIPT;
|
||||
|
||||
if(argc > 2) {
|
||||
if(strncmp("--help", argv[2], strlen(argv[2])) == 0) {
|
||||
unterOption_printJD2_help(settings->programName);
|
||||
@ -1945,3 +1961,102 @@ void unterOption_printJD2_help(std::string programName)
|
||||
<< " später die Ordner-Überprüffuktion verwenden möchten." << std::endl
|
||||
<< std::endl;
|
||||
}
|
||||
|
||||
int unterOption_popular(Settings *settings, int argc, char **argv)
|
||||
{
|
||||
settings->modus = Modus::POPULAR_MODUS;
|
||||
|
||||
int c = 0;
|
||||
const option long_opts[] = {
|
||||
{"socks5-proxy", required_argument, nullptr, 'p'},
|
||||
{"use-first-page", no_argument, nullptr, 'f'},
|
||||
|
||||
{"internet-pages", required_argument, nullptr, 'i'},
|
||||
{"help", no_argument, nullptr, 'h'},
|
||||
{"colorless", no_argument, nullptr, 'c'},
|
||||
{"debug-mode", no_argument, nullptr, 'd'},
|
||||
|
||||
{nullptr, no_argument, nullptr, 0}
|
||||
|
||||
};
|
||||
|
||||
while( ( c = getopt_long (argc, argv, "p:i:fhcd", long_opts, nullptr) ) != -1 ) {
|
||||
switch(c) {
|
||||
case 'p':
|
||||
if(!optarg || setS5ProxytoSettings(*settings, optarg) != 0)
|
||||
return 2;
|
||||
break;
|
||||
case 'i':
|
||||
if(!optarg)
|
||||
break;
|
||||
if(setUpInternetPages(*settings, optarg) != 0)
|
||||
return 4356;
|
||||
break;
|
||||
case 'f':
|
||||
settings->useFirstPage = true;
|
||||
if(settings->debugMode)
|
||||
std::cout << "useFirstPage: " << settings->useFirstPage << std::endl;
|
||||
break;
|
||||
case 'h':
|
||||
unterOption_popular_help(settings->programName);
|
||||
return -1;
|
||||
case 'c':
|
||||
settings->colorless = true;
|
||||
if(settings->debugMode)
|
||||
std::cout << "Farblos: true" << std::endl;
|
||||
break;
|
||||
case 'd':
|
||||
settings->debugMode = true;
|
||||
if(settings->debugMode)
|
||||
std::cout << "Debug Modus: true" << std::endl;
|
||||
break;
|
||||
default:
|
||||
std::cout << "Aufruf: " << settings->programName << " popular [OPTION]..." << std::endl;
|
||||
std::cout << "\"" << settings->programName << " popular --help\" liefert weitere Informationen." << std::endl;
|
||||
return 21;
|
||||
}
|
||||
}
|
||||
|
||||
if(settings->debugMode)
|
||||
std::cout << "Modus: Popular Modus" << std::endl;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
void unterOption_popular_help(std::string programName)
|
||||
{
|
||||
std::cout << "Aufruf: " << programName << " popular [OPTION]..." << std::endl << std::endl;
|
||||
|
||||
std::cout << "Beschreibung:" << std::endl
|
||||
<< " Mit dieser Unterfunktion kann man die beliebten Serien sehen." << std::endl << std::endl;
|
||||
|
||||
std::cout << "INTERNETSEITEN OPTIONEN:" << std::endl
|
||||
<< " -i [Url1,Url2], --internet-pages [Url1,Url2]" << std::endl
|
||||
<< " Mit dieser Option kann man die Seiten angeben, auf denen" << std::endl
|
||||
<< " nach Serien gesucht werden soll. (Nur Seiten aus Default Wert möglich)" << std::endl
|
||||
<< " Die Seiten Kommagetrennt nach Priorität angeben. (Höchste am Anfang)" << std::endl
|
||||
<< " Gut Kombinierbar mit --use-first-page kombenierbar!" << std::endl
|
||||
<< " Standart: AniWorld.to,serienstream.to" << std::endl
|
||||
<< " -f, --use-first-page" << std::endl
|
||||
<< " Mit dieser Option kann man festlegen, dass direkt die erste Seite," << std::endl
|
||||
<< " auf der die Serie vorhanden ist, verwendet wird. ( Reihenfolge der" << std::endl
|
||||
<< " Priorität nach; siehe -i, --internet-pages)" << std::endl
|
||||
<< " Ohne diesem Parameter ist eine manuelle auswahl nötig," << std::endl
|
||||
<< " wenn diese Serie auf mehreren Seiten existiert!" << std::endl
|
||||
<< " Parameter kann auch im Default File als standart festgelegt werden!" << std::endl
|
||||
<< " Standart: Überprüfe alle Seiten" << std::endl << std::endl;
|
||||
std::cout << "OPTIONEN:" << std::endl
|
||||
<< " -p [ip:port/ip/port], --socks5-proxy [ip:port/ip/port]" << std::endl
|
||||
<< " Mit dieser Option kann man den Socks5Proxy ändern." << std::endl
|
||||
<< " Port 0 um Proxy zu deaktivieren." << std::endl
|
||||
<< " Standart: 127.0.0.1:9050" << std::endl << std::endl
|
||||
<< " -c, --colorless" << std::endl
|
||||
<< " Mit dieser Option kann man die farbige Ausgabe ausstellen." << std::endl << std::endl
|
||||
<< " -d, --debug-mode" << std::endl
|
||||
<< " Mit dieser Option kann man den Debug-Modus einschalten." << std::endl
|
||||
<< " Dabei werden vielmehr Infos ausgegeben." << std::endl << std::endl
|
||||
<< " -h, --help" << std::endl
|
||||
<< " Mit dieser Option wird dieses Helpmenue ausgegeben." << std::endl;
|
||||
}
|
||||
|
@ -27,8 +27,8 @@
|
||||
|
||||
#define UpdaterCloudUrlWithPath "https://cloud.obermui.de/s/tXz7SWdaPJ7TacZ/download?path=%2F&files="
|
||||
#define SecondUpdaterCloudUrlWithPath "https://snew4.obermui.de/download?path=%2F&files="
|
||||
#define VERSION "5.3.2"
|
||||
#define DEFAULT_FILE_VERSION "2.3"
|
||||
#define VERSION "5.4.0"
|
||||
#define DEFAULT_FILE_VERSION "2.4"
|
||||
|
||||
//default, anime, normal,
|
||||
//suche: für jede katego. eine
|
||||
@ -46,18 +46,20 @@ enum Modus {
|
||||
NEWS_MODUS = 4,
|
||||
UPDATE_MODUS = 5,
|
||||
REMOVE_SETTINGS_AND_CACHE_MODUS = 6,
|
||||
PRINT_LOG_FILE_MODUS
|
||||
PRINT_LOG_FILE_MODUS = 7,
|
||||
PRINT_JD2_SKRIPT = 8,
|
||||
POPULAR_MODUS = 9
|
||||
|
||||
};
|
||||
|
||||
struct PAGE {
|
||||
PAGE() {}
|
||||
PAGE( std::string protocol, std::string url, std::string nameID, std::string urlAphabetSerienList, std::string urlDir )
|
||||
: protocol(protocol), name_id(nameID), url(url), urlAlphabetSerienList(urlAphabetSerienList), UrlDir(urlDir)
|
||||
PAGE( std::string protocol, std::string url, std::string nameID, std::string urlAphabetSerienList, std::string urlDir, std::string popularSerien )
|
||||
: protocol(protocol), name_id(nameID), url(url), urlAlphabetSerienList(urlAphabetSerienList), UrlDir(urlDir), popularSerien(popularSerien)
|
||||
{
|
||||
|
||||
}
|
||||
std::string protocol, name_id, url, urlAlphabetSerienList, UrlDir;
|
||||
std::string protocol, name_id, url, urlAlphabetSerienList, UrlDir, popularSerien;
|
||||
};
|
||||
|
||||
#include "logger.h"
|
||||
@ -71,14 +73,14 @@ struct Settings {
|
||||
|
||||
//erst animes, dann alle seiten-seiten::
|
||||
const PAGE
|
||||
_anicio = PAGE( "https://" , "aniworld.to", "Animes", "/animes-alphabet", "/anime/stream/"),
|
||||
_anicio = PAGE( "https://" , "aniworld.to", "Animes", "/animes-alphabet", "/anime/stream/", "/beliebte-animes"),
|
||||
|
||||
//alle serien - seiten:
|
||||
|
||||
_sto = PAGE( "https://", "s.to", "Normale_Serien", "/serien-alphabet", "/serie/stream/"),
|
||||
_stoIP = PAGE( "http://", "190.115.18.20", "Normale_Serien", "/serien-alphabet", "/serie/stream/"),
|
||||
serienstreamto = PAGE("https://", "serienstream.to", "Normale_Serien", "/serien-alphabet", "/serie/stream/"),
|
||||
seriencam = PAGE("https://", "serien.cam", "Normale_Serien", "/serien-alphabet", "/serie/stream/");
|
||||
_sto = PAGE( "https://", "s.to", "Normale_Serien", "/serien-alphabet", "/serie/stream/", "/beliebte-serien"),
|
||||
_stoIP = PAGE( "http://", "190.115.18.20", "Normale_Serien", "/serien-alphabet", "/serie/stream/", "/beliebte-serien"),
|
||||
serienstreamto = PAGE("https://", "serienstream.to", "Normale_Serien", "/serien-alphabet", "/serie/stream/", "/beliebte-serien"),
|
||||
seriencam = PAGE("https://", "serien.cam", "Normale_Serien", "/serien-alphabet", "/serie/stream/", "/beliebte-serien");
|
||||
|
||||
//alle compakt
|
||||
const PAGE pagesALL[5] = { _anicio, _sto, _stoIP, /*_serienstreamsx,*/ seriencam, serienstreamto };
|
||||
@ -165,7 +167,8 @@ struct Settings {
|
||||
search_show_othernames = false,
|
||||
askForEveryDir = true,
|
||||
skipEpisodenNameOutput = false,
|
||||
showLastUpdate = false;
|
||||
showLastUpdate = false,
|
||||
no_log = false;
|
||||
|
||||
int startEpisode = 1,
|
||||
stopEpisode = 0,
|
||||
@ -265,6 +268,10 @@ void unterOption_RemoveSettings_or_CacheDire_help(std::string programName);
|
||||
int unterOption_printLogFile(Settings * settings, int argc, char **argv);
|
||||
void unterOption_printLogFile(std::string programName);
|
||||
|
||||
int unterOption_popular(Settings * settings, int argc, char **argv);
|
||||
void unterOption_popular_help(std::string programName);
|
||||
|
||||
|
||||
|
||||
|
||||
int setS5ProxytoSettings(Settings &settings, std::string optarg);
|
||||
|
@ -46,6 +46,8 @@ int ProgramManager::start(Settings *settings)
|
||||
return updateModus(settings);
|
||||
case Modus::REMOVE_SETTINGS_AND_CACHE_MODUS:
|
||||
return cleanUpSettingsAndCache(settings);
|
||||
case Modus::POPULAR_MODUS:
|
||||
return printPopularSeries(settings);
|
||||
default:
|
||||
std::cout << " => Error: Keine Unteroption ausgewählt." << std::endl;
|
||||
return -1;
|
||||
@ -1078,7 +1080,7 @@ int ProgramManager::infoModus(Settings *settings)
|
||||
// std::cout << "Serie: " + settings->name + " (" + nameInUrl + ")" << std::endl;
|
||||
|
||||
//write Name to file
|
||||
if(pageManager.writeToFile(settings->outputFilePaths, "\n\nSerie: " + settings->name + " (" + nameInUrl + ")") != 0)
|
||||
if( !settings->no_log && pageManager.writeToFile(settings->outputFilePaths, "\n\nSerie: " + settings->name + " (" + nameInUrl + ")") != 0)
|
||||
{
|
||||
if(settings->debugMode)
|
||||
std::cerr << ">>> Debug In " << __FUNCTION__ << ": writeToFile f() failed." << std::endl;
|
||||
@ -1122,7 +1124,7 @@ int ProgramManager::infoModus(Settings *settings)
|
||||
std::cout << std::endl
|
||||
<< green << "Die Staffel " << staffel << " hat " << folgen << " Folge" << ((folgen > 1) ? "n" : "") << "." << white << std::endl
|
||||
<< std::endl;
|
||||
if(pageManager.writeToFile(settings->outputFilePaths, "\nDie Staffel " + std::to_string(staffel)
|
||||
if(!settings->no_log && pageManager.writeToFile(settings->outputFilePaths, "\nDie Staffel " + std::to_string(staffel)
|
||||
+ " hat " + std::to_string(folgen) + " Folge" + ((folgen > 1) ? "n" : "") + ".\n") != 0)
|
||||
{
|
||||
if(settings->debugMode)
|
||||
@ -1167,7 +1169,7 @@ int ProgramManager::infoModus(Settings *settings)
|
||||
<< " ( " << 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(pageManager.writeToFile(settings->outputFilePaths, "Ep. " + std::string( (gesammtFolge < 100) ? ( (gesammtFolge < 10) ? "00" : "0" ) : "" )
|
||||
if(!settings->no_log && pageManager.writeToFile(settings->outputFilePaths, "Ep. " + std::string( (gesammtFolge < 100) ? ( (gesammtFolge < 10) ? "00" : "0" ) : "" )
|
||||
+ std::to_string(gesammtFolge) + " ( S" + ( (staffel < 10) ? "0" : "" ) + std::to_string(staffel) + "E"
|
||||
+ ( ( atoi( line.substr(0, pos).c_str() ) < 10) ? "0" : "" ) + line.substr(0, pos) + " ):" ) != 0) {
|
||||
if(settings->debugMode)
|
||||
@ -1187,7 +1189,7 @@ int ProgramManager::infoModus(Settings *settings)
|
||||
titel = line.substr(0, pos);
|
||||
if(titel != "") {
|
||||
std::cout << lila << " > Titel 1: " << Lightyellow << titel << white << std::endl;
|
||||
if(pageManager.writeToFile(settings->outputFilePaths, " > Titel 1: " + titel) != 0) {
|
||||
if(!settings->no_log && pageManager.writeToFile(settings->outputFilePaths, " > Titel 1: " + titel) != 0) {
|
||||
if(settings->debugMode)
|
||||
std::cerr << ">>> Debug In " << __FUNCTION__ << ": writeToFile f() failed." << std::endl;
|
||||
return 110;
|
||||
@ -1206,7 +1208,7 @@ int ProgramManager::infoModus(Settings *settings)
|
||||
titel = line.substr(0, pos);
|
||||
if(titel != "") {
|
||||
std::cout << lila << " > Titel 2: " << Darkyellow << titel << white << std::endl;
|
||||
if(pageManager.writeToFile(settings->outputFilePaths, " > Titel 2: " + titel) != 0) {
|
||||
if(!settings->no_log && pageManager.writeToFile(settings->outputFilePaths, " > Titel 2: " + titel) != 0) {
|
||||
if(settings->debugMode)
|
||||
std::cerr << ">>> Debug In " << __FUNCTION__ << ": writeToFile f() failed." << std::endl;
|
||||
return 120;
|
||||
@ -1323,7 +1325,7 @@ int ProgramManager::infoModus(Settings *settings)
|
||||
for( const auto &e : genres)
|
||||
all_genres += e + " ";
|
||||
|
||||
if(pageManager.writeToFile(settings->outputFilePaths, "\nProduktion von " + startStopDates[0] + " bis " + startStopDates[1] + "\n"
|
||||
if(!settings->no_log && pageManager.writeToFile(settings->outputFilePaths, "\nProduktion von " + startStopDates[0] + " bis " + startStopDates[1] + "\n"
|
||||
"FSK: " + fsk + "\n" + "Cover Bild: " + coverLink + "\n" + "Genre(s): " + all_genres + "\n"
|
||||
"\nBeschreibung: " + description + "\n") != 0)
|
||||
{
|
||||
@ -1716,6 +1718,94 @@ int ProgramManager::cleanUpSettingsAndCache(Settings *settings)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int ProgramManager::printPopularSeries(Settings *settings)
|
||||
{
|
||||
if(settings->pagesInUse.size() < 1) {
|
||||
std::cout << " => Error Keine Internet Seiten vorhanden." << std::endl;
|
||||
return -12;
|
||||
}
|
||||
std::cout << "Pages: " << std::endl;
|
||||
for( const auto &page : settings->pagesInUse ) {
|
||||
std::cout << page.name_id << std::endl;
|
||||
}
|
||||
|
||||
for( const auto &page : settings->pagesInUse ) {
|
||||
std::cout << ((settings->colorless) ? "" : "\033[93m") << "Auf '" << page.url << "'..." << ((settings->colorless) ? "" : "\033[0m") << std::endl;
|
||||
|
||||
size_t pos = 0;
|
||||
std::string html = pageManager.getServerRequest(page.protocol, page.url + page.popularSerien).html;
|
||||
|
||||
if(html == "-1") {
|
||||
if(settings->debugMode)
|
||||
std::cerr << ">>> Debug In " << __FUNCTION__ << ": getServerRequest function failed." << std::endl;
|
||||
return 1;
|
||||
}
|
||||
|
||||
if( (pos = html.find("<div class=\"seriesListContainer row\">")) == std::string::npos ) {
|
||||
std::cout << " => Error: Konnte '<div class=\"seriesListContainer row\">' nicht finden" <<std::endl;
|
||||
return 2;
|
||||
} else {
|
||||
html.erase(0, pos + 37);
|
||||
|
||||
}
|
||||
|
||||
if( (pos = html.rfind("</span></h3>")) == std::string::npos ) {
|
||||
std::cout << " => Error: Konnte Position von '</span></h3>' nicht finden" <<std::endl;
|
||||
return 2;
|
||||
} else {
|
||||
// std::cout << " => Position von '</span></h3>'" << pos << " lingesgamt: " << html.length() << " npoos: " << std::string::npos <<std::endl;
|
||||
html.erase(pos + 12);
|
||||
}
|
||||
|
||||
html = replace(html, "\r", "");
|
||||
html = replace(html, "\n", "");
|
||||
html = replace(html, "col-md-15 col-sm-3 col-xs-6", "\n");
|
||||
|
||||
std::stringstream strstream(html + "\n");
|
||||
html.clear();
|
||||
std::string line;
|
||||
std::cin.clear();
|
||||
while (std::getline(strstream, line).good()) {
|
||||
if(line.find("href=") == std::string::npos)
|
||||
continue;
|
||||
if(settings->debugMode)
|
||||
std::cout << "Line: " << line << std::endl;
|
||||
|
||||
size_t pos = line.find("<a href=\"");
|
||||
size_t pos2 = line.find("\" title=\"");
|
||||
if(pos == std::string::npos) {
|
||||
std::cout << " => Error: Konnte Position von '<a href=' nicht finden" <<std::endl;
|
||||
continue;
|
||||
} else if(pos2 == std::string::npos) {
|
||||
std::cout << " => Error: Konnte Position von ' title=\' nicht finden" <<std::endl;
|
||||
continue;
|
||||
}
|
||||
std::string href = line.substr(pos + 9, pos2 - pos - 9);
|
||||
|
||||
if( (pos = line.find("<h3>")) == std::string::npos) {
|
||||
std::cout << " => Error: Konnte Position von '<h3>' nicht finden" <<std::endl;
|
||||
continue;
|
||||
} else if( (pos2 = line.find("<span", pos)) == std::string::npos) {
|
||||
std::cout << " => Error: Konnte Position von '<span' nicht finden" <<std::endl;
|
||||
continue;
|
||||
}
|
||||
std::string name = line.substr(pos + 4, pos2 - pos - 4);
|
||||
|
||||
std::cout << " > Serie: " << ((settings->colorless) ? "" : "\033[96m") << name << ((settings->colorless) ? "" : "\033[0m") << ": "
|
||||
<< ((settings->colorless) ? "" : "\033[92m") << "(" + replace(href,page.UrlDir, "") + ")" << ((settings->colorless) ? "" : "\033[0m") << std::endl;
|
||||
}
|
||||
|
||||
|
||||
if(settings->useFirstPage)
|
||||
break;
|
||||
else
|
||||
std::cout << std::endl;
|
||||
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int ProgramManager::searchModus_update(Settings *settings)
|
||||
{
|
||||
|
@ -52,6 +52,7 @@ private:
|
||||
int newsModus(Settings *settings);
|
||||
int updateModus(Settings *settings);
|
||||
int cleanUpSettingsAndCache(Settings *settings);
|
||||
int printPopularSeries(Settings *settings);
|
||||
|
||||
|
||||
PageManager pageManager;
|
||||
|
Loading…
Reference in New Issue
Block a user