forked from markus/S_New4
Merge branch 'master' of https://code.obermui.de/markus/S_New4
This commit is contained in:
commit
aa1d8d502a
@ -90,7 +90,7 @@ int manageParameter(Settings &settings, int argc, char **argv)
|
|||||||
|
|
||||||
//Find out right subProgramm
|
//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", 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", argv[1]);
|
||||||
if(res.size() != 1) {
|
if(res.size() != 1) {
|
||||||
if(res.size() == 0)
|
if(res.size() == 0)
|
||||||
std::cout << " => Error: Keine Unteroption für " << argv[1] << " gefunden." << std::endl;
|
std::cout << " => Error: Keine Unteroption für " << argv[1] << " gefunden." << std::endl;
|
||||||
@ -145,6 +145,9 @@ int manageParameter(Settings &settings, int argc, char **argv)
|
|||||||
logger.logCommandLine(command);
|
logger.logCommandLine(command);
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
|
} else if (isSame(argv, "printjdscript")) {
|
||||||
|
return unterOption_printJD2_renameSkript(&settings,argc, argv);
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
std::cout << " => Error: Invalid option '" << argv[1] << "', but not detected in compare-Function" << std::endl;
|
std::cout << " => Error: Invalid option '" << argv[1] << "', but not detected in compare-Function" << std::endl;
|
||||||
return 3;
|
return 3;
|
||||||
@ -1220,18 +1223,18 @@ void unterOption_clean(Settings * settings, int argc, char **argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//UM sachen nach multipage update zu löschen
|
//UM sachen nach multipage update zu löschen
|
||||||
for ( const auto &p : settings->pagesInUse ) {
|
for ( const auto &p : settings->pagesALL ) {
|
||||||
if(fileExists(settings->cookieFilePath + "_" + p.name_id)) {
|
if(fileExists(settings->cookieFilePath + "_" + p.url)) {
|
||||||
if(remove((settings->cookieFilePath + "_" + p.name_id).c_str()) != 0) {
|
if(remove((settings->cookieFilePath + "_" + p.url).c_str()) != 0) {
|
||||||
perror(( " => Error: Das löschen von " + settings->cookieFilePath + "_" + p.name_id + " ist fehlgeschlagen: ").c_str());
|
perror(( " => Error: Das löschen von " + settings->cookieFilePath + "_" + p.url + " ist fehlgeschlagen: ").c_str());
|
||||||
return;
|
return;
|
||||||
} else
|
} else
|
||||||
++count;
|
++count;
|
||||||
}
|
}
|
||||||
|
|
||||||
for (unsigned i = 0; i < UINT_MAX && fileExists(settings->cookieFilePath + "_" + p.name_id + std::to_string(i)); ++i) {
|
for (unsigned i = 0; i < UINT_MAX && fileExists(settings->cookieFilePath + "_" + p.url + std::to_string(i)); ++i) {
|
||||||
if(remove( (settings->cookieFilePath + "_" + p.name_id + std::to_string(i)).c_str() ) != 0) {
|
if(remove( (settings->cookieFilePath + "_" + p.url + std::to_string(i)).c_str() ) != 0) {
|
||||||
perror((" => Error: Das löschen von " + settings->cookieFilePath + "_" + p.name_id + std::to_string(i) + " ist fehlgeschlagen: ").c_str());
|
perror((" => Error: Das löschen von " + settings->cookieFilePath + "_" + p.url + std::to_string(i) + " ist fehlgeschlagen: ").c_str());
|
||||||
return;
|
return;
|
||||||
} else {
|
} else {
|
||||||
++count;
|
++count;
|
||||||
@ -1854,3 +1857,44 @@ int setUpInternetPages(Settings &settings, std::string optarg)
|
|||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int unterOption_printJD2_renameSkript(Settings *settings, int , char **)
|
||||||
|
{
|
||||||
|
std::cout << "// Settings" << std::endl
|
||||||
|
<< "var FilePath = \"" << settings->logFilePath << "\";" << std::endl
|
||||||
|
<< "var ReplaceWholeName = false;" << std::endl
|
||||||
|
<< "var Delimeter = \"_\"; // S01E01 + Delimeter + Oldname.mp4" << std::endl
|
||||||
|
<< "" << std::endl
|
||||||
|
<< "//Global Vars" << std::endl
|
||||||
|
<< "var LinkFile = readFile(FilePath); // *Read a text file" << std::endl
|
||||||
|
<< "var LinkFileLineArray = LinkFile.split('\n');" << std::endl
|
||||||
|
<< "var myDownloadLink = getAllDownloadLinks(); // *Get a list of all downloadlinks" << std::endl
|
||||||
|
<< "" << std::endl
|
||||||
|
<< "" << std::endl
|
||||||
|
<< "for (var i = 0; i < myDownloadLink.length; i++) {" << std::endl
|
||||||
|
<< "" << std::endl
|
||||||
|
<< " var url = myDownloadLink[i].getUrl();" << std::endl
|
||||||
|
<< " var EpisodeName = myDownloadLink[i].getName();" << std::endl
|
||||||
|
<< " var foundLine = true;" << std::endl
|
||||||
|
<< " var LineWithEp = "";" << std::endl
|
||||||
|
<< "" << std::endl
|
||||||
|
<< " if (EpisodeName.indexOf(\".mp4\") == -1) continue;" << std::endl
|
||||||
|
<< "" << std::endl
|
||||||
|
<< " for (var x = LinkFileLineArray.length - 1; x >= 0; x--)" << std::endl
|
||||||
|
<< " if (LinkFileLineArray[x].indexOf(url) !== -1) {" << std::endl
|
||||||
|
<< " LineWithEp = LinkFileLineArray[x];" << std::endl
|
||||||
|
<< " break;" << std::endl
|
||||||
|
<< " } else if (x == 0) {" << std::endl
|
||||||
|
<< " //alert(\"Error: Für den Link '\" + url + \"' wurde in dem TextFile: '\" + FilePath + \"' keine Passende Zeile gefunden.\");" << std::endl
|
||||||
|
<< " foundLine = false;" << std::endl
|
||||||
|
<< " }" << std::endl
|
||||||
|
<< " if (!foundLine) continue;" << std::endl
|
||||||
|
<< "" << std::endl
|
||||||
|
<< " var addPart = LineWithEp.substring(0, LineWithEp.indexOf(\":\"));" << std::endl
|
||||||
|
<< " if (EpisodeName.indexOf(addPart) !== -1) continue;" << std::endl
|
||||||
|
<< " if (ReplaceWholeName) myDownloadLink[i].setName(addPart + EpisodeName.substring(EpisodeName.lastIndexOf(\".\")));" << std::endl
|
||||||
|
<< " else myDownloadLink[i].setName(addPart + Delimeter + EpisodeName)" << std::endl
|
||||||
|
<< "" << std::endl
|
||||||
|
<< "}" << std::endl;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
@ -25,10 +25,9 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#define UpdaterCloudUrlWithPath "https://cloud.obermui.de/s/tXz7SWdaPJ7TacZ/download?path=%2F&files="
|
#define UpdaterCloudUrlWithPath "https://cloud.obermui.de/s/tXz7SWdaPJ7TacZ/download?path=%2F&files="
|
||||||
#define SecondUpdaterCloudUrlWithPath "https://snew4.obermui.de/download?path=%2F&files="
|
#define SecondUpdaterCloudUrlWithPath "https://snew4.obermui.de/download?path=%2F&files="
|
||||||
#define VERSION "5.2.0"
|
#define VERSION "5.2.1"
|
||||||
#define DEFAULT_FILE_VERSION "2.3"
|
#define DEFAULT_FILE_VERSION "2.3"
|
||||||
|
|
||||||
//default, anime, normal,
|
//default, anime, normal,
|
||||||
@ -244,6 +243,9 @@ void unterOption_info_help(std::string programName);
|
|||||||
|
|
||||||
void unterOption_clean(Settings * settings, int argc, char **argv);
|
void unterOption_clean(Settings * settings, int argc, char **argv);
|
||||||
|
|
||||||
|
int unterOption_printJD2_renameSkript(Settings * settings, int, char **);
|
||||||
|
|
||||||
|
|
||||||
int unterOption_news(Settings * settings, int argc, char **argv);
|
int unterOption_news(Settings * settings, int argc, char **argv);
|
||||||
void unterOption_news_help(std::string programName);
|
void unterOption_news_help(std::string programName);
|
||||||
|
|
||||||
|
@ -117,7 +117,7 @@ void * threadFunction(void * data) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for (int i = 1; i <= 3; ++i) {
|
for (int i = 1; i <= 3; ++i) {
|
||||||
auto REPLy = myThreadData->pageManager->getUrlAfterRedirect( myThreadData->page.protocol, myThreadData->page.url + Link, myThreadData->settings->cookieFilePath + "_" + myThreadData->page.url);
|
auto REPLy = myThreadData->pageManager->getUrlAfterRedirect( myThreadData->page.protocol, myThreadData->page.url + Link, myThreadData->settings->cookieFilePath + "_" + myThreadData->page.url + std::to_string(myThreadData->id));
|
||||||
std::string newUrl = REPLy.url;
|
std::string newUrl = REPLy.url;
|
||||||
if (newUrl == "-1") {
|
if (newUrl == "-1") {
|
||||||
if(myThreadData->settings->debugMode)
|
if(myThreadData->settings->debugMode)
|
||||||
@ -133,7 +133,7 @@ void * threadFunction(void * data) {
|
|||||||
} else if(newUrl.find("/redirect/") != std::string::npos ) {
|
} else if(newUrl.find("/redirect/") != std::string::npos ) {
|
||||||
if(myThreadData->settings->debugMode)
|
if(myThreadData->settings->debugMode)
|
||||||
std::cout << " > Thread " << myThreadData->id << "Warnung: Redirect Link nach umwandlung (Capcha?) --> Neuer Account" << std::endl;
|
std::cout << " > Thread " << myThreadData->id << "Warnung: Redirect Link nach umwandlung (Capcha?) --> Neuer Account" << std::endl;
|
||||||
if(myThreadData->pageManager->login(myThreadData->page, myThreadData->accountManager->getNextAccount(), myThreadData->settings->cookieFilePath + "_" + myThreadData->page.url) != 0) {
|
if(myThreadData->pageManager->login(myThreadData->page, myThreadData->accountManager->getNextAccount(), myThreadData->settings->cookieFilePath + "_" + myThreadData->page.url + std::to_string(myThreadData->id)) != 0) {
|
||||||
if(myThreadData->settings->debugMode)
|
if(myThreadData->settings->debugMode)
|
||||||
std::cerr << " => Debug: In Thread: "<< myThreadData->id << ": login Function failed." << std::endl;
|
std::cerr << " => Debug: In Thread: "<< myThreadData->id << ": login Function failed." << std::endl;
|
||||||
return myThreadData->setState(17);
|
return myThreadData->setState(17);
|
||||||
|
Loading…
Reference in New Issue
Block a user