forked from markus/S_New4
checked .. url & fast search (fixes)..
This commit is contained in:
parent
c9cdfdac46
commit
69d7c41df6
2
main.cpp
2
main.cpp
@ -10,5 +10,5 @@ int main(int argc, char *argv[])
|
|||||||
if(res != 0)
|
if(res != 0)
|
||||||
return (res == -1) ? 0 : res;
|
return (res == -1) ? 0 : res;
|
||||||
|
|
||||||
return mainProgram.start(settings);
|
return mainProgram.start(&settings);
|
||||||
}
|
}
|
||||||
|
@ -274,7 +274,7 @@ int PageManager::writeToFile(std::string path, std::string text)
|
|||||||
std::ofstream of;
|
std::ofstream of;
|
||||||
of.open(path, std::ios::out | std::ios::app);
|
of.open(path, std::ios::out | std::ios::app);
|
||||||
if(!of.is_open()) {
|
if(!of.is_open()) {
|
||||||
perror(" => Error: Konnte output Datei nicht öffnen");
|
perror(" => Error: Konnte Output Datei nicht öffnen");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
of << text << std::endl;
|
of << text << std::endl;
|
||||||
|
@ -22,9 +22,10 @@ int manageParameter(Settings &settings, int argc, char **argv)
|
|||||||
{
|
{
|
||||||
//Path settings
|
//Path settings
|
||||||
setPaths(settings, argv[0]);
|
setPaths(settings, argv[0]);
|
||||||
|
settings.argv0 = argv[0];
|
||||||
|
|
||||||
if(argc < 2) {
|
if(argc < 2) {
|
||||||
std::cout << " => Keine Unteroption angegeben." << std::endl;
|
std::cout << " => Error: Keine Unteroption angegeben." << std::endl;
|
||||||
std::cout << "Aufruf: " << getProgramName(argv[0]) << " [Unteroption] [PARAMETER]" << std::endl;
|
std::cout << "Aufruf: " << getProgramName(argv[0]) << " [Unteroption] [PARAMETER]" << std::endl;
|
||||||
std::cout << "„" << getProgramName(argv[0]) << " --help“ liefert weitere Informationen." << std::endl;
|
std::cout << "„" << getProgramName(argv[0]) << " --help“ liefert weitere Informationen." << std::endl;
|
||||||
return 1;
|
return 1;
|
||||||
@ -32,7 +33,8 @@ int manageParameter(Settings &settings, int argc, char **argv)
|
|||||||
|
|
||||||
int res = compare("--help\ndefault\nurl\n--version\nsearch", argv[1]);
|
int res = compare("--help\ndefault\nurl\n--version\nsearch", argv[1]);
|
||||||
if(res != 1) {
|
if(res != 1) {
|
||||||
std::cout << " => Unbekannte Unteroption: '" << argv[1] << "': Mehrere oder keine Option gefunden: " << res << " Möglichkeiten." << std::endl;
|
std::cout << " => Error: " << ( (res == 0) ? std::string("Unbekannte Unteroption: '") + argv[1] + "'" :
|
||||||
|
std::string("Mehrere Optionen für '") + argv[1] + std::string("' gefunden.") ) << std::endl;
|
||||||
std::cout << "Aufruf: " << getProgramName(argv[0]) << " [Unteroption] [PARAMETER]" << std::endl;
|
std::cout << "Aufruf: " << getProgramName(argv[0]) << " [Unteroption] [PARAMETER]" << std::endl;
|
||||||
std::cout << "„" << getProgramName(argv[0]) << " --help“ liefert weitere Informationen." << std::endl;
|
std::cout << "„" << getProgramName(argv[0]) << " --help“ liefert weitere Informationen." << std::endl;
|
||||||
return 2;
|
return 2;
|
||||||
@ -88,7 +90,6 @@ int unterOption_default(Settings *settings, int argc, char ** argv)
|
|||||||
|
|
||||||
int c = 0;
|
int c = 0;
|
||||||
const option long_opts[] = {
|
const option long_opts[] = {
|
||||||
{"name", required_argument, nullptr, 'n'},
|
|
||||||
{"socks5-proxy", required_argument, nullptr, 'p'},
|
{"socks5-proxy", required_argument, nullptr, 'p'},
|
||||||
{"genauer-hoster", required_argument, nullptr, 'g'},
|
{"genauer-hoster", required_argument, nullptr, 'g'},
|
||||||
{"languages", required_argument, nullptr, 'l'},
|
{"languages", required_argument, nullptr, 'l'},
|
||||||
@ -112,14 +113,8 @@ int unterOption_default(Settings *settings, int argc, char ** argv)
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
while( ( c = getopt_long (argc, argv, "n:p:g:l:o:e:E:s:S:C:m:t:hcd", long_opts, nullptr) ) != -1 ) {
|
while( ( c = getopt_long (argc, argv, "p:g:l:o:e:E:s:S:C:m:t:hcd", long_opts, nullptr) ) != -1 ) {
|
||||||
switch(c) {
|
switch(c) {
|
||||||
case 'n':
|
|
||||||
if(optarg)
|
|
||||||
settings->name = optarg;
|
|
||||||
if(settings->debugMode)
|
|
||||||
std::cout << "Name: " << settings->name << std::endl;
|
|
||||||
break;
|
|
||||||
case 'p': {
|
case 'p': {
|
||||||
if(!optarg || std::string(optarg) == "")
|
if(!optarg || std::string(optarg) == "")
|
||||||
break;
|
break;
|
||||||
@ -245,6 +240,12 @@ int unterOption_default(Settings *settings, int argc, char ** argv)
|
|||||||
settings->colorless = true;
|
settings->colorless = true;
|
||||||
if(settings->debugMode)
|
if(settings->debugMode)
|
||||||
std::cout << "Farblos: true" << std::endl;
|
std::cout << "Farblos: true" << std::endl;
|
||||||
|
if(argc > optind)
|
||||||
|
if(argv[optind][0] != '-' && std::string(argv[optind]).find(settings->pathSymbol) != std::string::npos) {
|
||||||
|
std::cout << " => Upps: Hast du -c (--colorless) mit -C (--check-dir) verwechselt?" << std::endl
|
||||||
|
<< " (Hat “Argument“ mit “"<< settings->pathSymbol << "“: '-c " << std::string(argv[optind]) << "')." << std::endl;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case 'd':
|
case 'd':
|
||||||
settings->debugMode = true;
|
settings->debugMode = true;
|
||||||
@ -260,19 +261,28 @@ int unterOption_default(Settings *settings, int argc, char ** argv)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(settings->debugMode)
|
//Alle nicht verwendeten Parameter == Name
|
||||||
|
while (optind < argc) {
|
||||||
|
if(argv[optind][0]) {
|
||||||
|
settings->name.append(argv[optind++]).append(" ");
|
||||||
|
} else
|
||||||
|
optind++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(settings->name.length() > 0)
|
||||||
|
settings->name.pop_back();
|
||||||
|
if(settings->debugMode) {
|
||||||
|
std::cout << "Name: " << settings->name << std::endl;
|
||||||
std::cout << "Modus: DEFAULT_MODUS" << std::endl;
|
std::cout << "Modus: DEFAULT_MODUS" << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void unterOption_default_help(Settings *, char * argv0)
|
void unterOption_default_help(Settings *, char * argv0)
|
||||||
{
|
{
|
||||||
std::cout << "Usage: " << getProgramName(argv0) << " default [ Parameter & {-n [Name]} ]..." << std::endl
|
std::cout << "Usage: " << getProgramName(argv0) << " default [OPTION]... [NAME]..." << std::endl
|
||||||
<< "Parameter:" << std::endl << std::endl
|
<< "Parameter:" << std::endl << std::endl
|
||||||
<< " > Muss-Parameter:" << std::endl
|
|
||||||
<< "\t-n [Name], --name [Name]" << std::endl
|
|
||||||
<< "\t -> Namen der Serie, deren Links du willst." << std::endl
|
|
||||||
<< std::endl
|
|
||||||
<< " > Auswahloptionen:" << std::endl
|
<< " > Auswahloptionen:" << std::endl
|
||||||
<< "\t-g [Hoster1,Hoster2,...], --genauer-hoster [Hoster1,Hoster2,...]" << std::endl
|
<< "\t-g [Hoster1,Hoster2,...], --genauer-hoster [Hoster1,Hoster2,...]" << std::endl
|
||||||
<< "\t -> Die Namen der Hoster, deren Links du willst. Der wichtigste zuerst." << std::endl
|
<< "\t -> Die Namen der Hoster, deren Links du willst. Der wichtigste zuerst." << std::endl
|
||||||
@ -330,7 +340,6 @@ int unterOption_url(Settings *settings, int argc, char **argv)
|
|||||||
|
|
||||||
int c = 0;
|
int c = 0;
|
||||||
const option long_opts[] = {
|
const option long_opts[] = {
|
||||||
{"url", required_argument, nullptr, 'u'},
|
|
||||||
{"socks5-proxy", required_argument, nullptr, 'p'},
|
{"socks5-proxy", required_argument, nullptr, 'p'},
|
||||||
{"output-file", required_argument, nullptr, 'o'},
|
{"output-file", required_argument, nullptr, 'o'},
|
||||||
|
|
||||||
@ -342,15 +351,8 @@ int unterOption_url(Settings *settings, int argc, char **argv)
|
|||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
while( ( c = getopt_long (argc, argv, "u:p:o:hcd", long_opts, nullptr) ) != -1 ) {
|
while( ( c = getopt_long (argc, argv, "p:o:hcd", long_opts, nullptr) ) != -1 ) {
|
||||||
switch(c) {
|
switch(c) {
|
||||||
case 'u':
|
|
||||||
if(optarg)
|
|
||||||
settings->name = optarg;
|
|
||||||
if(settings->debugMode)
|
|
||||||
std::cout << "Urls: " << settings->name << std::endl;
|
|
||||||
break;
|
|
||||||
|
|
||||||
case 'p': {
|
case 'p': {
|
||||||
if(!optarg || std::string(optarg) == "")
|
if(!optarg || std::string(optarg) == "")
|
||||||
break;
|
break;
|
||||||
@ -400,34 +402,41 @@ int unterOption_url(Settings *settings, int argc, char **argv)
|
|||||||
return 21;
|
return 21;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(settings->debugMode)
|
|
||||||
|
|
||||||
|
//Alle nicht verwendeten Parameter == Name
|
||||||
|
while (optind < argc) {
|
||||||
|
if(argv[optind][0]) {
|
||||||
|
settings->name.append(argv[optind++]).append(",");
|
||||||
|
} else
|
||||||
|
optind++;
|
||||||
|
}
|
||||||
|
|
||||||
|
if(settings->name.length() > 0)
|
||||||
|
settings->name.pop_back();
|
||||||
|
if(settings->debugMode) {
|
||||||
|
std::cout << "Urls: " << settings->name << std::endl;
|
||||||
std::cout << "Modus: DIRECT_LINK_MODUS" << std::endl;
|
std::cout << "Modus: DIRECT_LINK_MODUS" << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void unterOption_url_help(Settings *, char * argv0)
|
void unterOption_url_help(Settings *, char * argv0)
|
||||||
{
|
{
|
||||||
std::cout << "Usage: " << getProgramName(argv0) << " url [ Parameter & {-u [Url]} ]..." << std::endl
|
std::cout << "Usage: " << getProgramName(argv0) << " url [OPTION]... [URL]..." << std::endl
|
||||||
<< "Parameter:" << std::endl
|
<< "Parameter:" << std::endl
|
||||||
<< "\t-u [Url1,Url2,...], --url [Url1,Url2,...]" << std::endl
|
|
||||||
<< "\t -> Die zu umwandelnden redirect-Links." << std::endl
|
|
||||||
<< "\t-p [ProxyAddresse], --socks5-proxy [ProxyAddresse]" << std::endl
|
<< "\t-p [ProxyAddresse], --socks5-proxy [ProxyAddresse]" << std::endl
|
||||||
<< "\t -> Type: Socks5, Default: 127.0.0.1:9050" << std::endl
|
<< "\t -> Type: Socks5, Default: 127.0.0.1:9050" << std::endl
|
||||||
<< "\t-o [Pfad], --output-file [Pfad]" << std::endl
|
<< "\t-o [Pfad], --output-file [Pfad]" << std::endl
|
||||||
<< "\t-c, --colorless" << std::endl
|
<< "\t-c, --colorless" << std::endl
|
||||||
<< "\t -> Default: false ." << std::endl
|
<< "\t -> Default: false" << std::endl
|
||||||
<< "\t-d, --debug-mode" << std::endl
|
<< "\t-d, --debug-mode" << std::endl
|
||||||
<< "\t -> Debug Nachrichten an. Default: false" << std::endl
|
<< "\t -> Debug Nachrichten an. Default: false" << std::endl
|
||||||
<< "\t-h, --help" << std::endl;
|
<< "\t-h, --help" << std::endl;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
std::string getProgramName(char *argv0)
|
|
||||||
{
|
|
||||||
return std::string(argv0).erase(0, ( (std::string(argv0).find_last_of("/\\") != std::string::npos ) ? std::string(argv0).find_last_of("/\\") +1 : 0 ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
int compare(std::string All_Options_with_komma_between, std::string input)
|
int compare(std::string All_Options_with_komma_between, std::string input)
|
||||||
{
|
{
|
||||||
std::istringstream iStrStream( All_Options_with_komma_between + "\n");
|
std::istringstream iStrStream( All_Options_with_komma_between + "\n");
|
||||||
@ -447,7 +456,6 @@ int unterOption_search(Settings *settings, int argc, char **argv)
|
|||||||
|
|
||||||
int c = 0;
|
int c = 0;
|
||||||
const option long_opts[] = {
|
const option long_opts[] = {
|
||||||
{"name", required_argument, nullptr, 'n'},
|
|
||||||
{"socks5-proxy", required_argument, nullptr, 'p'},
|
{"socks5-proxy", required_argument, nullptr, 'p'},
|
||||||
|
|
||||||
{"help", no_argument, nullptr, 'h'},
|
{"help", no_argument, nullptr, 'h'},
|
||||||
@ -463,12 +471,6 @@ int unterOption_search(Settings *settings, int argc, char **argv)
|
|||||||
|
|
||||||
while( ( c = getopt_long (argc, argv, "n:p:hcdeu", long_opts, nullptr) ) != -1 ) {
|
while( ( c = getopt_long (argc, argv, "n:p:hcdeu", long_opts, nullptr) ) != -1 ) {
|
||||||
switch(c) {
|
switch(c) {
|
||||||
case 'n':
|
|
||||||
if(optarg)
|
|
||||||
settings->name = optarg;
|
|
||||||
if(settings->debugMode)
|
|
||||||
std::cout << "Name: " << settings->name << std::endl;
|
|
||||||
break;
|
|
||||||
case 'p': {
|
case 'p': {
|
||||||
if(!optarg || std::string(optarg) == "")
|
if(!optarg || std::string(optarg) == "")
|
||||||
break;
|
break;
|
||||||
@ -522,18 +524,29 @@ int unterOption_search(Settings *settings, int argc, char **argv)
|
|||||||
return 21;
|
return 21;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(settings->debugMode)
|
|
||||||
std::cout << "Modus: Search_MODUS" << std::endl;
|
|
||||||
return 0;
|
|
||||||
|
|
||||||
|
//Alle nicht verwendeten Parameter == Name
|
||||||
|
while (optind < argc) {
|
||||||
|
if(argv[optind][0]) {
|
||||||
|
settings->name.append(argv[optind++]).append(" ");
|
||||||
|
} else
|
||||||
|
optind++;
|
||||||
|
}
|
||||||
|
if(settings->name.length() > 0)
|
||||||
|
settings->name.pop_back();
|
||||||
|
if(settings->debugMode) {
|
||||||
|
std::cout << "Name: " << settings->name << std::endl;
|
||||||
|
std::cout << "Modus: Search_MODUS" << std::endl;
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
void unterOption_search_help(Settings *, char *argv0)
|
void unterOption_search_help(Settings *, char *argv0)
|
||||||
{
|
{
|
||||||
std::cout << "Usage: " << getProgramName(argv0) << " search [ Parameter & {-n [Name] / -u} ]..." << std::endl
|
std::cout << "Usage: " << getProgramName(argv0) << " search [OPTION]... [NAME]" << std::endl
|
||||||
|
<< " " << getProgramName(argv0) << " search [-u, --update]" << std::endl
|
||||||
<< "Parameter:" << std::endl
|
<< "Parameter:" << std::endl
|
||||||
<< "\t-n [Name], --name [Name]" << std::endl
|
|
||||||
<< "\t -> (Teil)Namen der gesuchten Serie." << std::endl
|
|
||||||
<< "\t-p [Socks5Proxy], --socks5-proxy [Socks5Proxy]" << std::endl
|
<< "\t-p [Socks5Proxy], --socks5-proxy [Socks5Proxy]" << std::endl
|
||||||
<< "\t -> Verwende diesen Socks5-Proxy. Default: 127.0.0.1:9050" << std::endl
|
<< "\t -> Verwende diesen Socks5-Proxy. Default: 127.0.0.1:9050" << std::endl
|
||||||
<< "\t-c, --colorless" << std::endl
|
<< "\t-c, --colorless" << std::endl
|
||||||
@ -555,3 +568,8 @@ bool dirExists(std::string dir)
|
|||||||
struct stat sb;
|
struct stat sb;
|
||||||
return (stat(dir.c_str(), &sb) == 0 && S_ISDIR(sb.st_mode)) ? true : false;
|
return (stat(dir.c_str(), &sb) == 0 && S_ISDIR(sb.st_mode)) ? true : false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
std::string getProgramName(const char *argv0)
|
||||||
|
{
|
||||||
|
return std::string(argv0).erase(0, ( (std::string(argv0).find_last_of("/\\") != std::string::npos ) ? std::string(argv0).find_last_of("/\\") +1 : 0 ) );
|
||||||
|
}
|
||||||
|
@ -31,7 +31,8 @@ struct Settings {
|
|||||||
version = "2.0.0",
|
version = "2.0.0",
|
||||||
outputFilePath = "",
|
outputFilePath = "",
|
||||||
default_checkDirPath = "",
|
default_checkDirPath = "",
|
||||||
default_Searchmuster = "S%Staffel%E%Folge%";
|
default_Searchmuster = "S%Staffel%E%Folge%",
|
||||||
|
argv0 = "";
|
||||||
|
|
||||||
Modus modus = Modus::DEFAULT_MODUS;
|
Modus modus = Modus::DEFAULT_MODUS;
|
||||||
bool colorless = false,
|
bool colorless = false,
|
||||||
@ -49,7 +50,7 @@ struct Settings {
|
|||||||
};
|
};
|
||||||
|
|
||||||
int manageParameter(Settings &settings, int argc, char ** argv);
|
int manageParameter(Settings &settings, int argc, char ** argv);
|
||||||
std::string getProgramName(char * argv0);
|
std::string getProgramName(const char * argv0);
|
||||||
int compare(std::string All_Options_with_komma_between, std::string input);
|
int compare(std::string All_Options_with_komma_between, std::string input);
|
||||||
void setPaths(Settings &settings, std::string executablePathTo);
|
void setPaths(Settings &settings, std::string executablePathTo);
|
||||||
bool dirExists(std::string dir);
|
bool dirExists(std::string dir);
|
||||||
|
@ -10,19 +10,19 @@ ProgramManager::~ProgramManager()
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int ProgramManager::start(Settings settings)
|
int ProgramManager::start(Settings *settings)
|
||||||
{
|
{
|
||||||
pageManager.setProxy(settings.proxy_ip, settings.proxy_port);
|
pageManager.setProxy(settings->proxy_ip, settings->proxy_port);
|
||||||
pageManager.setCookieFilePath(settings.cookieFilePath);
|
pageManager.setCookieFilePath(settings->cookieFilePath);
|
||||||
pageManager.setDebugMode(settings.debugMode);
|
pageManager.setDebugMode(settings->debugMode);
|
||||||
|
|
||||||
switch (settings.modus) {
|
switch (settings->modus) {
|
||||||
case Modus::DEFAULT_MODUS:
|
case Modus::DEFAULT_MODUS:
|
||||||
return defaultModus(&settings);
|
return defaultModus(settings);
|
||||||
case Modus::DIRECT_LINK_MODUS:
|
case Modus::DIRECT_LINK_MODUS:
|
||||||
return directLinkModus(&settings);
|
return directLinkModus(settings);
|
||||||
case Modus::Search_MODUS:
|
case Modus::Search_MODUS:
|
||||||
return searchModus(&settings);
|
return searchModus(settings);
|
||||||
default:
|
default:
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
@ -59,7 +59,7 @@ int ProgramManager::defaultModus(Settings *settings)
|
|||||||
dirFiles.pop_back();
|
dirFiles.pop_back();
|
||||||
|
|
||||||
//Wenn Debug Mode, gib die Liste aus
|
//Wenn Debug Mode, gib die Liste aus
|
||||||
if(settings->debugMode)
|
if(settings->debugMode && settings->default_checkDirPath != "")
|
||||||
std::cout << " > [-C] Files:\n" << dirFiles << std::endl;
|
std::cout << " > [-C] Files:\n" << dirFiles << std::endl;
|
||||||
|
|
||||||
//Führe Function aus, die überprüft ob die serie existiert
|
//Führe Function aus, die überprüft ob die serie existiert
|
||||||
@ -145,7 +145,9 @@ int ProgramManager::directLinkModus(Settings *settings)
|
|||||||
AccountManager accountManager(settings->accountFilePath, settings->accountNumberPath);
|
AccountManager accountManager(settings->accountFilePath, settings->accountNumberPath);
|
||||||
|
|
||||||
if(settings->name == "") {
|
if(settings->name == "") {
|
||||||
std::cout << " => Error: Kein(e) Link(s) angegeben: Missing Parameter -u [Url]." << std::endl;
|
std::cout << " => Error: Kein(e) Link(s) angegeben." << std::endl;
|
||||||
|
std::cout << "Aufruf: " << getProgramName(settings->argv0.c_str()) << " url [PARAMETER]" << std::endl;
|
||||||
|
std::cout << "„" << getProgramName(settings->argv0.c_str()) << " url --help“ liefert weitere Informationen." << std::endl;
|
||||||
return 76;
|
return 76;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -169,7 +171,6 @@ int ProgramManager::directLinkModus(Settings *settings)
|
|||||||
|
|
||||||
int ProgramManager::searchModus(Settings *settings)
|
int ProgramManager::searchModus(Settings *settings)
|
||||||
{
|
{
|
||||||
|
|
||||||
if(settings->search_wantUpdate) {
|
if(settings->search_wantUpdate) {
|
||||||
int res = searchModus_update(settings) ;
|
int res = searchModus_update(settings) ;
|
||||||
if( res == 0)
|
if( res == 0)
|
||||||
@ -179,7 +180,9 @@ int ProgramManager::searchModus(Settings *settings)
|
|||||||
return res;
|
return res;
|
||||||
|
|
||||||
} else if(settings->name == "") {
|
} else if(settings->name == "") {
|
||||||
std::cout << " => Error: Kein Name angegeben: Missing Parameter -n [Name]." << std::endl;
|
std::cout << " => Error: Kein Name angegeben." << std::endl;
|
||||||
|
std::cout << "Aufruf: " << getProgramName(settings->argv0.c_str()) << " search [PARAMETER]" << std::endl;
|
||||||
|
std::cout << "„" << getProgramName(settings->argv0.c_str()) << " search --help“ liefert weitere Informationen." << std::endl;
|
||||||
return 27;
|
return 27;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -222,7 +225,7 @@ int ProgramManager::searchModus(Settings *settings)
|
|||||||
std::string line;
|
std::string line;
|
||||||
std::cout << " => Für '" << settings->name << "' wurde(n) folgende Serie(n) gefunden: " << std::endl;
|
std::cout << " => Für '" << settings->name << "' wurde(n) folgende Serie(n) gefunden: " << std::endl;
|
||||||
while (getline(strstream, line)) {
|
while (getline(strstream, line)) {
|
||||||
std::cout << " > " << line.substr(line.find("|", line.find("/")) + 1, line.length() - line.find("|", line.find("/")) -1 )
|
std::cout << " > " << line.substr(line.find("|", line.find("/")) + 1, line.length() - line.find("|", line.find("/")) -1 )
|
||||||
<< "\t[" << line.substr(line.find("/") + 1, line.find("|", line.find("/")) - line.find("/") - 1) << "]"
|
<< "\t[" << line.substr(line.find("/") + 1, line.find("|", line.find("/")) - line.find("/") - 1) << "]"
|
||||||
<< ( (line[0] == '|') ? "" : "\t( " + line.substr(0, line.find("|")) + " )" ) << std::endl;
|
<< ( (line[0] == '|') ? "" : "\t( " + line.substr(0, line.find("|")) + " )" ) << std::endl;
|
||||||
}
|
}
|
||||||
@ -266,8 +269,18 @@ int ProgramManager::searchModus_update(Settings *settings)
|
|||||||
//...\n|/serie/stream/2012-das-jahr-null"_weg_>2012 - Das Jahr Null|\n...
|
//...\n|/serie/stream/2012-das-jahr-null"_weg_>2012 - Das Jahr Null|\n...
|
||||||
|
|
||||||
serienListe += line + "\n";
|
serienListe += line + "\n";
|
||||||
} serienListe.pop_back();
|
}
|
||||||
|
if(serienListe.length() > 0)
|
||||||
|
serienListe.pop_back();
|
||||||
|
|
||||||
|
//Anzahl der Serien/Zeilen vorher:
|
||||||
|
ssize_t countBef = 0;
|
||||||
|
std::ifstream myFileBef(settings->serienListPath);
|
||||||
|
if(myFileBef.is_open())
|
||||||
|
for(countBef = 0; std::getline(myFileBef,line); countBef++);
|
||||||
|
myFileBef.close();
|
||||||
|
|
||||||
|
//Schreibe die Liste in das TextFile
|
||||||
std::ofstream ofs(settings->serienListPath, std::ios::trunc);
|
std::ofstream ofs(settings->serienListPath, std::ios::trunc);
|
||||||
if(!ofs.is_open()) {
|
if(!ofs.is_open()) {
|
||||||
perror("Konnte SerienListe-Datei nicht öffnen");
|
perror("Konnte SerienListe-Datei nicht öffnen");
|
||||||
@ -276,6 +289,14 @@ int ProgramManager::searchModus_update(Settings *settings)
|
|||||||
ofs << serienListe << std::endl;
|
ofs << serienListe << std::endl;
|
||||||
ofs.close();
|
ofs.close();
|
||||||
|
|
||||||
|
//Anzahl der Zeile nachher
|
||||||
|
ssize_t countAf = 0;
|
||||||
|
std::ifstream myFileAf(settings->serienListPath);
|
||||||
|
if(myFileAf.is_open())
|
||||||
|
for(countAf = 0; std::getline(myFileAf,line); countAf++);
|
||||||
|
myFileAf.close();
|
||||||
|
|
||||||
|
std::cout << "Serienunterschied: " << ( ((countAf - countBef) > 0) ? "+" : "") << countAf - countBef << " Serien." << std::endl;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -351,14 +372,14 @@ int ProgramManager::convertLink(std::string redirectLink, AccountManager * accou
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
std::cout << " => " << folgenID << ": " << green << newUrl << "\033[0m" << std::endl;
|
std::cout << " => " << folgenID << ( (folgenID == "") ? "" : ": " ) << green << newUrl << "\033[0m" << std::endl;
|
||||||
if(settings->outputFilePath != "")
|
if(settings->outputFilePath != "")
|
||||||
if(pageManager.writeToFile(settings->outputFilePath,folgenID + newUrl) != 0)
|
if(pageManager.writeToFile(settings->outputFilePath,folgenID + newUrl) != 0)
|
||||||
return 108;
|
return 108;
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
std::cout << " => " << folgenID << ": " << red << "https://s.to" << redirectLink << "\033[0m" << std::endl;
|
std::cout << " => " << folgenID << ( (folgenID == "") ? "" : ": " ) << red << "https://s.to" << redirectLink << "\033[0m" << std::endl;
|
||||||
if(settings->outputFilePath != "")
|
if(settings->outputFilePath != "")
|
||||||
if(pageManager.writeToFile(settings->outputFilePath, folgenID + redirectLink) != 0)
|
if(pageManager.writeToFile(settings->outputFilePath, folgenID + redirectLink) != 0)
|
||||||
return 114;
|
return 114;
|
||||||
|
@ -14,7 +14,7 @@ class ProgramManager
|
|||||||
public:
|
public:
|
||||||
ProgramManager();
|
ProgramManager();
|
||||||
~ProgramManager();
|
~ProgramManager();
|
||||||
int start(Settings setting);
|
int start(Settings *setting);
|
||||||
int listDir(std::string &list, std::string path, int maxDepth);
|
int listDir(std::string &list, std::string path, int maxDepth);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
Loading…
Reference in New Issue
Block a user