2019-07-06 18:47:29 +00:00
|
|
|
#ifndef PARAMETERMANAGER_H
|
|
|
|
#define PARAMETERMANAGER_H
|
|
|
|
|
2019-09-23 14:41:30 +00:00
|
|
|
#ifndef __linux__
|
|
|
|
#ifndef _WIN32
|
2019-09-23 17:44:29 +00:00
|
|
|
#error "Error Invalid System: Only for Linux and Windows systems!"
|
2019-09-19 17:15:23 +00:00
|
|
|
#endif
|
|
|
|
#endif
|
2019-09-19 17:13:31 +00:00
|
|
|
|
2019-07-06 18:47:29 +00:00
|
|
|
#include <iostream>
|
2019-07-07 16:30:37 +00:00
|
|
|
#include <getopt.h>
|
2019-09-01 08:40:36 +00:00
|
|
|
#include <string.h> // strlen
|
2019-07-08 18:17:11 +00:00
|
|
|
#include <sstream>
|
2019-08-03 16:23:12 +00:00
|
|
|
#include <sys/stat.h>
|
2019-08-17 15:55:00 +00:00
|
|
|
#include <fstream>
|
2019-09-01 08:40:36 +00:00
|
|
|
#include <vector>
|
|
|
|
|
2019-08-13 16:59:01 +00:00
|
|
|
#include <limits.h> // PATH_MAX
|
|
|
|
#include <unistd.h> // readlink()
|
|
|
|
|
2019-10-04 18:11:01 +00:00
|
|
|
|
2019-08-13 16:59:01 +00:00
|
|
|
#ifdef _WIN32
|
|
|
|
#include <windows.h>
|
|
|
|
#endif
|
|
|
|
|
2019-07-06 18:47:29 +00:00
|
|
|
enum Modus {
|
|
|
|
EXIT = -1,
|
|
|
|
DEFAULT_MODUS = 0,
|
2019-08-03 16:23:12 +00:00
|
|
|
DIRECT_LINK_MODUS = 1,
|
2019-08-13 16:59:01 +00:00
|
|
|
SEARCH_MODUS = 2,
|
2019-09-20 19:47:02 +00:00
|
|
|
INFO_MODUS = 3,
|
2019-10-13 12:28:53 +00:00
|
|
|
NEWS_MODUS = 4,
|
|
|
|
UPDATE_MODUS = 5
|
2019-08-03 19:48:27 +00:00
|
|
|
|
2019-07-06 18:47:29 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
struct Settings {
|
|
|
|
Settings() {}
|
|
|
|
Settings(std::string name) : name(name) {}
|
|
|
|
|
2019-09-04 09:05:11 +00:00
|
|
|
const std::string programName = "S_New4";
|
2019-10-14 13:16:15 +00:00
|
|
|
const std::string VersionFileUrl = "https://cloud.obermui.de/s/H47Xoqy2czfJzYp/download?path=%2F&files=Version.txt";
|
|
|
|
const std::string ProgrammFileUrl = "https://cloud.obermui.de/s/H47Xoqy2czfJzYp/download?path=%2F&files=S_New4";
|
2019-10-13 12:28:53 +00:00
|
|
|
|
2019-09-04 09:05:11 +00:00
|
|
|
std::string name,
|
2019-07-08 18:17:11 +00:00
|
|
|
accountFilePath = "/tmp/a",
|
2019-08-17 14:03:28 +00:00
|
|
|
accountNumberPath= "/tmp/a_n",
|
2019-07-08 18:17:11 +00:00
|
|
|
cookieFilePath = "/tmp/S_New4_cookies",
|
2019-08-03 16:23:12 +00:00
|
|
|
serienListPath = "/tmp/SerienListe",
|
2019-10-04 18:11:01 +00:00
|
|
|
lastUpdateDateFilePath = "/tmp/lastUpdateDateFile",
|
2019-10-13 12:28:53 +00:00
|
|
|
configDir="/tmp/",
|
|
|
|
cacheDir="/tmp/",
|
2019-10-04 18:11:01 +00:00
|
|
|
|
2019-08-17 14:03:28 +00:00
|
|
|
defaultsFilePath = "/tmp/defaults",
|
2019-07-07 16:30:37 +00:00
|
|
|
proxy_ip = "127.0.0.1",
|
|
|
|
languages = "GerDub,GerSub,Eng",
|
2019-08-21 18:26:22 +00:00
|
|
|
genaueHoster = "",
|
2019-10-13 12:28:53 +00:00
|
|
|
version = "3.2.0",
|
2019-10-04 18:55:50 +00:00
|
|
|
defaultFileVersion="1.6",
|
2019-08-03 19:48:27 +00:00
|
|
|
outputFilePath = "",
|
2019-08-21 14:59:22 +00:00
|
|
|
default_checkPath = "",
|
2019-08-13 16:59:01 +00:00
|
|
|
default_Searchmuster = "S%Staffel%E%Folge%";
|
2019-08-03 19:48:27 +00:00
|
|
|
|
2019-07-06 18:47:29 +00:00
|
|
|
Modus modus = Modus::DEFAULT_MODUS;
|
2019-07-08 18:17:11 +00:00
|
|
|
bool colorless = false,
|
2019-08-03 16:23:12 +00:00
|
|
|
debugMode = false,
|
|
|
|
search_IgnoreUpperLower = true,
|
|
|
|
search_wantUpdate = false;
|
2019-07-08 18:17:11 +00:00
|
|
|
int startEpisode = 1,
|
|
|
|
stopEpisode = 0,
|
|
|
|
startSeason = 1,
|
2019-08-03 16:23:12 +00:00
|
|
|
stopSeason = 0,
|
2019-08-03 19:48:27 +00:00
|
|
|
proxy_port = 9050,
|
2019-10-04 18:11:01 +00:00
|
|
|
default_maxDirs = 20,
|
|
|
|
updateWarningDays = 10;
|
2019-08-13 16:59:01 +00:00
|
|
|
char pathSymbol = '/';
|
2019-08-16 12:34:44 +00:00
|
|
|
unsigned maxThreads = 0;
|
2019-07-08 18:17:11 +00:00
|
|
|
|
2019-07-06 18:47:29 +00:00
|
|
|
};
|
|
|
|
|
2019-08-03 16:23:12 +00:00
|
|
|
int manageParameter(Settings &settings, int argc, char ** argv);
|
2019-08-17 14:03:28 +00:00
|
|
|
int loadDefaulOptions(Settings & settings);
|
2019-08-21 16:39:35 +00:00
|
|
|
std::vector<std::string> compare(std::string All_Options_with_komma_between, std::string input);
|
2019-08-31 17:57:42 +00:00
|
|
|
bool isNumber(std::string number);
|
2019-07-07 16:30:37 +00:00
|
|
|
|
2019-09-04 08:42:20 +00:00
|
|
|
int setPaths(Settings &settings);
|
2019-08-13 16:59:01 +00:00
|
|
|
|
2019-08-17 14:03:28 +00:00
|
|
|
bool fileExists (const std::string& name);
|
|
|
|
bool dirExists(std::string dir);
|
2019-08-21 19:22:40 +00:00
|
|
|
bool nothingExists(std::string path);
|
2019-09-04 15:50:53 +00:00
|
|
|
|
2019-08-31 18:35:11 +00:00
|
|
|
bool createDirIsOk(std::string path);
|
2019-09-04 15:50:53 +00:00
|
|
|
bool makePathIsOk(std::string path);
|
2019-08-13 16:59:01 +00:00
|
|
|
|
2019-09-04 15:50:53 +00:00
|
|
|
int unterOption_help(Settings &settings);
|
2019-07-07 16:30:37 +00:00
|
|
|
|
2019-08-03 16:23:12 +00:00
|
|
|
int unterOption_default(Settings * settings, int argc, char **argv);
|
2019-09-04 09:04:20 +00:00
|
|
|
void unterOption_default_help(std::string programName);
|
2019-07-07 16:30:37 +00:00
|
|
|
|
2019-08-03 16:23:12 +00:00
|
|
|
int unterOption_url(Settings * settings, int argc, char **argv);
|
2019-09-04 09:04:20 +00:00
|
|
|
void unterOption_url_help(std::string programName);
|
2019-07-07 16:30:37 +00:00
|
|
|
|
2019-08-03 16:23:12 +00:00
|
|
|
int unterOption_search(Settings * settings, int argc, char **argv);
|
2019-09-04 09:04:20 +00:00
|
|
|
void unterOption_search_help(std::string programName);
|
2019-08-03 16:23:12 +00:00
|
|
|
|
2019-08-13 16:59:01 +00:00
|
|
|
int unterOption_info(Settings * settings, int argc, char **argv);
|
2019-09-04 09:04:20 +00:00
|
|
|
void unterOption_info_help(std::string programName);
|
2019-08-03 16:23:12 +00:00
|
|
|
|
2019-08-16 18:12:25 +00:00
|
|
|
void unterOption_clean(Settings * settings, int argc, char **argv);
|
|
|
|
|
2019-09-20 19:47:02 +00:00
|
|
|
int unterOption_news(Settings * settings, int argc, char **argv);
|
|
|
|
void unterOption_news_help(std::string programName);
|
|
|
|
|
2019-07-06 18:47:29 +00:00
|
|
|
|
2019-08-31 17:57:42 +00:00
|
|
|
int setS5ProxytoSettings(Settings &settings, std::string optarg);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
2019-07-06 18:47:29 +00:00
|
|
|
#endif // PARAMETERMANAGER_H
|