v3.7.6: at debug mode, put warn message when hosters wern't found for the first lanuguage...

This commit is contained in:
Markus 2019-12-16 17:41:07 +01:00
parent c8a7f54766
commit a1098b29e8
4 changed files with 16 additions and 7 deletions

View File

@ -461,7 +461,7 @@ int PageManager::writeToFile(std::string path, std::string text)
return 0;
}

std::string PageManager::chooseHosterLink(std::string HosterList, std::string Hoster_with_Highst_Priority_at_First, std::string languages_with_highst_priority_at_first)
std::string PageManager::chooseHosterLink(std::string HosterList, std::string Hoster_with_Highst_Priority_at_First, std::string languages_with_highst_priority_at_first, bool withWarnMsg)
{
std::istringstream SListLang ( replace( languages_with_highst_priority_at_first, ",", "\n") + "\n" );

@ -493,14 +493,18 @@ std::string PageManager::chooseHosterLink(std::string HosterList, std::string Ho
//std::cout << "Alle Folgen mi der Sprache " << langId << ":\n'" << LanguageSortedHoster << "'" << std::endl;

//Wenn keine Links zu der Sprache gefunden worden sind
if(LanguageSortedHoster == "")
if(LanguageSortedHoster == "") {
if(withWarnMsg)
std::cout << "Warnung: Es wurden keine Links für die Sprache '" <<langId << "' gefunden." << std::endl;
continue;
}

//Für jeden Angegebenen Hoster:
while (getline(SListHoster, hoster).good()) {
//Wenn es den hoster bei dieser prache nicht gibt, wähle nächsten
if(LanguageSortedHoster.find("hoster=\"" + hoster + "\"") == std::string::npos) {
//std::cout << "Hoster " << hoster << " gibt es bei der sprache" << langId << " nicht " << std::endl;
if(withWarnMsg)
std::cout << "Warnung: Hoster " << hoster << " gibt es bei der sprache" << langId << " nicht " << std::endl;
continue;
}
Line = grep(LanguageSortedHoster + "\n", ("hoster=\"" + hoster + "\"" ) );
@ -520,6 +524,11 @@ std::string PageManager::chooseHosterLink(std::string HosterList, std::string Ho
return Line.erase(pos, Line.length()-pos);
}

if(withWarnMsg) {
std::cout << "Warnung: Die Hoster '" << Hoster_with_Highst_Priority_at_First << "' gab es für die Sprache '" << langId << "' nicht." << std::endl;
std::cout << "INFO: Andere Hoster zu dieser Sprache: \n" << LanguageSortedHoster << std::endl;
}

}
return "";
}

View File

@ -37,7 +37,7 @@ public:
std::string getUrlAfterRedirect(std::string Url);
std::string checkName(std::string Name);
std::string getLinks(std::string HTML);
std::string chooseHosterLink(std::string HosterList, std::string Hoster_with_Highst_Priority_at_First, std::string languages_with_highst_priority_at_first);
std::string chooseHosterLink(std::string HosterList, std::string Hoster_with_Highst_Priority_at_First, std::string languages_with_highst_priority_at_first, bool withWarnMsg);

std::string replace(std::string str, std::string substr1, std::string substr2);
int counterContains(std::string text, std::string substring_with_prozent_i_for_number, int starte_mit_dieser_Zahl = 1);

View File

@ -81,7 +81,7 @@ struct Settings {
proxy_ip = "127.0.0.1",
languages = "GerDub,GerSub,Eng,",
genaueHoster = "",
version = "3.7.5",
version = "3.7.6",
defaultFileVersion="1.7",
outputFilePath = "",
default_checkPath = "",

View File

@ -62,7 +62,7 @@ void * threadFunction(void * data) {
return myThreadData->setState(10);
}
std::string allLinks = myThreadData->pageManager->getLinks(tmp_reply.html);
std::string Link = myThreadData->pageManager->chooseHosterLink(allLinks, myThreadData->settings->genaueHoster, myThreadData->settings->languages);
std::string Link = myThreadData->pageManager->chooseHosterLink(allLinks, myThreadData->settings->genaueHoster, myThreadData->settings->languages, myThreadData->settings->debugMode);

if(myThreadData->settings->debugMode)
std::cout << " > Thread " << myThreadData->id << allLinks << std::endl << ( (Link == "") ? "" : " -> Link: 'https://s.to") << Link << ( (Link == "") ? "" : "'\n" );
@ -565,7 +565,7 @@ int ProgramManager::defaultModus(Settings *settings)
return 0;

} else {
std::string Link = pageManager.chooseHosterLink(allLinks, settings->genaueHoster, settings->languages);
std::string Link = pageManager.chooseHosterLink(allLinks, settings->genaueHoster, settings->languages, settings->debugMode);

if(settings->debugMode)
std::cout << allLinks << std::endl << ( (Link == "") ? "" : " -> Link: 'https://s.to") << Link << ( (Link == "") ? "" : "'\n" );