forked from markus/S_New4
v3.7.6: at debug mode, put warn message when hosters wern't found for the first lanuguage...
This commit is contained in:
parent
c8a7f54766
commit
a1098b29e8
@ -461,7 +461,7 @@ int PageManager::writeToFile(std::string path, std::string text)
|
|||||||
return 0;
|
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" );
|
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;
|
//std::cout << "Alle Folgen mi der Sprache " << langId << ":\n'" << LanguageSortedHoster << "'" << std::endl;
|
||||||
|
|
||||||
//Wenn keine Links zu der Sprache gefunden worden sind
|
//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;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
//Für jeden Angegebenen Hoster:
|
//Für jeden Angegebenen Hoster:
|
||||||
while (getline(SListHoster, hoster).good()) {
|
while (getline(SListHoster, hoster).good()) {
|
||||||
//Wenn es den hoster bei dieser prache nicht gibt, wähle nächsten
|
//Wenn es den hoster bei dieser prache nicht gibt, wähle nächsten
|
||||||
if(LanguageSortedHoster.find("hoster=\"" + hoster + "\"") == std::string::npos) {
|
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;
|
continue;
|
||||||
}
|
}
|
||||||
Line = grep(LanguageSortedHoster + "\n", ("hoster=\"" + hoster + "\"" ) );
|
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);
|
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 "";
|
return "";
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,7 @@ public:
|
|||||||
std::string getUrlAfterRedirect(std::string Url);
|
std::string getUrlAfterRedirect(std::string Url);
|
||||||
std::string checkName(std::string Name);
|
std::string checkName(std::string Name);
|
||||||
std::string getLinks(std::string HTML);
|
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);
|
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);
|
int counterContains(std::string text, std::string substring_with_prozent_i_for_number, int starte_mit_dieser_Zahl = 1);
|
||||||
|
@ -81,7 +81,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.7.5",
|
version = "3.7.6",
|
||||||
defaultFileVersion="1.7",
|
defaultFileVersion="1.7",
|
||||||
outputFilePath = "",
|
outputFilePath = "",
|
||||||
default_checkPath = "",
|
default_checkPath = "",
|
||||||
|
@ -62,7 +62,7 @@ void * threadFunction(void * data) {
|
|||||||
return myThreadData->setState(10);
|
return myThreadData->setState(10);
|
||||||
}
|
}
|
||||||
std::string allLinks = myThreadData->pageManager->getLinks(tmp_reply.html);
|
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)
|
if(myThreadData->settings->debugMode)
|
||||||
std::cout << " > Thread " << myThreadData->id << allLinks << std::endl << ( (Link == "") ? "" : " -> Link: 'https://s.to") << Link << ( (Link == "") ? "" : "'\n" );
|
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;
|
return 0;
|
||||||
|
|
||||||
} else {
|
} 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)
|
if(settings->debugMode)
|
||||||
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" );
|
||||||
|
Loading…
Reference in New Issue
Block a user