S_New4/parameterManager.h

95 lines
2.3 KiB
C
Raw Normal View History

2019-07-06 18:47:29 +00:00
#ifndef PARAMETERMANAGER_H
#define PARAMETERMANAGER_H
#include <iostream>
2019-07-07 16:30:37 +00:00
#include <getopt.h>
#include <string.h>
2019-07-08 18:17:11 +00:00
#include <sstream>
#include <sys/stat.h>
#include <fstream>
2019-08-13 16:59:01 +00:00
#include <limits.h> // PATH_MAX
#include <unistd.h> // readlink()
#include <vector>
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,
DIRECT_LINK_MODUS = 1,
2019-08-13 16:59:01 +00:00
SEARCH_MODUS = 2,
INFO_MODUS = 3
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-07-07 16:30:37 +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",
serienListPath = "/tmp/SerienListe",
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-08-21 19:23:01 +00:00
version = "2.4.3",
2019-08-17 16:01:36 +00:00
defaultFileVersion="1.3",
2019-08-03 19:48:27 +00:00
outputFilePath = "",
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,
debugMode = false,
search_IgnoreUpperLower = true,
search_wantUpdate = false;
2019-07-08 18:17:11 +00:00
int startEpisode = 1,
stopEpisode = 0,
startSeason = 1,
stopSeason = 0,
2019-08-03 19:48:27 +00:00
proxy_port = 9050,
default_maxDirs = 20;
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
};
int manageParameter(Settings &settings, int argc, char ** argv);
2019-08-17 14:03:28 +00:00
int loadDefaulOptions(Settings & settings);
std::vector<std::string> compare(std::string All_Options_with_komma_between, std::string input);
2019-07-07 16:30:37 +00:00
2019-08-17 14:03:28 +00:00
std::string getProgramName();
2019-08-13 16:59:01 +00:00
std::string getexepath();
2019-08-17 14:03:28 +00:00
2019-08-13 16:59:01 +00:00
void setPathSymbol(Settings &settings);
2019-08-17 14:03:28 +00:00
void 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);
bool nothingExists(std::string path);
2019-08-13 16:59:01 +00:00
int unterOption_help();
2019-07-07 16:30:37 +00:00
int unterOption_default(Settings * settings, int argc, char **argv);
2019-08-13 16:59:01 +00:00
void unterOption_default_help();
2019-07-07 16:30:37 +00:00
int unterOption_url(Settings * settings, int argc, char **argv);
2019-08-13 16:59:01 +00:00
void unterOption_url_help();
2019-07-07 16:30:37 +00:00
int unterOption_search(Settings * settings, int argc, char **argv);
2019-08-13 16:59:01 +00:00
void unterOption_search_help();
2019-08-13 16:59:01 +00:00
int unterOption_info(Settings * settings, int argc, char **argv);
void unterOption_info_help();
void unterOption_clean(Settings * settings, int argc, char **argv);
2019-07-06 18:47:29 +00:00
#endif // PARAMETERMANAGER_H