forked from markus/S_New4
windows
This commit is contained in:
@ -1,19 +1,19 @@
|
||||
QMAKE_CXX.QT_COMPILER_STDCXX = 199711L
|
||||
QMAKE_CXX.QMAKE_GCC_MAJOR_VERSION = 5
|
||||
QMAKE_CXX.QMAKE_GCC_MINOR_VERSION = 5
|
||||
QMAKE_CXX.QMAKE_GCC_PATCH_VERSION = 0
|
||||
QMAKE_CXX.COMPILER_MACROS = \
|
||||
QT_COMPILER_STDCXX \
|
||||
QMAKE_GCC_MAJOR_VERSION \
|
||||
QMAKE_GCC_MINOR_VERSION \
|
||||
QMAKE_GCC_PATCH_VERSION
|
||||
QMAKE_CXX.INCDIRS = \
|
||||
/home/markus/git/mxe/usr/lib/gcc/x86_64-w64-mingw32.static/5.5.0/include/c++ \
|
||||
/home/markus/git/mxe/usr/lib/gcc/x86_64-w64-mingw32.static/5.5.0/include/c++/x86_64-w64-mingw32.static \
|
||||
/home/markus/git/mxe/usr/lib/gcc/x86_64-w64-mingw32.static/5.5.0/include/c++/backward \
|
||||
/home/markus/git/mxe/usr/lib/gcc/x86_64-w64-mingw32.static/5.5.0/include \
|
||||
/home/markus/git/mxe/usr/lib/gcc/x86_64-w64-mingw32.static/5.5.0/include-fixed \
|
||||
/home/markus/git/mxe/usr/x86_64-w64-mingw32.static/include
|
||||
QMAKE_CXX.LIBDIRS = \
|
||||
/home/markus/git/mxe/usr/lib/gcc/x86_64-w64-mingw32.static/5.5.0 \
|
||||
/home/markus/git/mxe/usr/x86_64-w64-mingw32.static/lib
|
||||
QMAKE_CXX.QT_COMPILER_STDCXX = 199711L
|
||||
QMAKE_CXX.QMAKE_GCC_MAJOR_VERSION = 5
|
||||
QMAKE_CXX.QMAKE_GCC_MINOR_VERSION = 5
|
||||
QMAKE_CXX.QMAKE_GCC_PATCH_VERSION = 0
|
||||
QMAKE_CXX.COMPILER_MACROS = \
|
||||
QT_COMPILER_STDCXX \
|
||||
QMAKE_GCC_MAJOR_VERSION \
|
||||
QMAKE_GCC_MINOR_VERSION \
|
||||
QMAKE_GCC_PATCH_VERSION
|
||||
QMAKE_CXX.INCDIRS = \
|
||||
/home/markus/git/mxe/usr/lib/gcc/x86_64-w64-mingw32.static/5.5.0/include/c++ \
|
||||
/home/markus/git/mxe/usr/lib/gcc/x86_64-w64-mingw32.static/5.5.0/include/c++/x86_64-w64-mingw32.static \
|
||||
/home/markus/git/mxe/usr/lib/gcc/x86_64-w64-mingw32.static/5.5.0/include/c++/backward \
|
||||
/home/markus/git/mxe/usr/lib/gcc/x86_64-w64-mingw32.static/5.5.0/include \
|
||||
/home/markus/git/mxe/usr/lib/gcc/x86_64-w64-mingw32.static/5.5.0/include-fixed \
|
||||
/home/markus/git/mxe/usr/x86_64-w64-mingw32.static/include
|
||||
QMAKE_CXX.LIBDIRS = \
|
||||
/home/markus/git/mxe/usr/lib/gcc/x86_64-w64-mingw32.static/5.5.0 \
|
||||
/home/markus/git/mxe/usr/x86_64-w64-mingw32.static/lib
|
||||
|
@ -1,44 +1,44 @@
|
||||
QT -= gui
|
||||
#CONFIG += -static -libstdc++ -static-libgcc #-static
|
||||
|
||||
#Linux:
|
||||
unix: LIBS += -lcurl
|
||||
|
||||
#Windows
|
||||
win32: LIBS += -L$${_PRO_FILE_PWD_}\..\lib\ -lcurl # 7.82.0
|
||||
#win32: LIBS += -L$${_PRO_FILE_PWD_}\..\alt\ -lcurl # 7.64.1
|
||||
|
||||
|
||||
CONFIG += c++17 console
|
||||
CONFIG -= app_bundle
|
||||
|
||||
# The following define makes your compiler emit warnings if you use
|
||||
# any Qt feature that has been marked deprecated (the exact warnings
|
||||
# depend on your compiler). Please consult the documentation of the
|
||||
# deprecated API in order to know how to port your code away from it.
|
||||
DEFINES += QT_DEPRECATED_WARNINGS
|
||||
|
||||
# You can also make your code fail to compile if it uses deprecated APIs.
|
||||
# In order to do so, uncomment the following line.
|
||||
# You can also select to disable deprecated APIs only up to a certain version of Qt.
|
||||
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
||||
|
||||
SOURCES += \
|
||||
main.cpp \
|
||||
pageManager.cpp \
|
||||
parameterManager.cpp \
|
||||
programManager.cpp \
|
||||
accountManager.cpp \
|
||||
logger.cpp
|
||||
|
||||
# Default rules for deployment.
|
||||
qnx: target.path = /tmp/$${TARGET}/bin
|
||||
else: unix:!android: target.path = /opt/$${TARGET}/bin
|
||||
!isEmpty(target.path): INSTALLS += target
|
||||
|
||||
HEADERS += \
|
||||
pageManager.h \
|
||||
parameterManager.h \
|
||||
programManager.h \
|
||||
accountManager.h \
|
||||
logger.h
|
||||
QT -= gui
|
||||
#CONFIG += -static -libstdc++ -static-libgcc #-static
|
||||
|
||||
#Linux:
|
||||
unix: LIBS += -lcurl
|
||||
|
||||
#Windows
|
||||
win32: LIBS += -L$${_PRO_FILE_PWD_}\..\lib\ -lcurl # 7.82.0
|
||||
#win32: LIBS += -L$${_PRO_FILE_PWD_}\..\alt\ -lcurl # 7.64.1
|
||||
|
||||
|
||||
CONFIG += c++17 console
|
||||
CONFIG -= app_bundle
|
||||
|
||||
# The following define makes your compiler emit warnings if you use
|
||||
# any Qt feature that has been marked deprecated (the exact warnings
|
||||
# depend on your compiler). Please consult the documentation of the
|
||||
# deprecated API in order to know how to port your code away from it.
|
||||
DEFINES += QT_DEPRECATED_WARNINGS
|
||||
|
||||
# You can also make your code fail to compile if it uses deprecated APIs.
|
||||
# In order to do so, uncomment the following line.
|
||||
# You can also select to disable deprecated APIs only up to a certain version of Qt.
|
||||
#DEFINES += QT_DISABLE_DEPRECATED_BEFORE=0x060000 # disables all the APIs deprecated before Qt 6.0.0
|
||||
|
||||
SOURCES += \
|
||||
main.cpp \
|
||||
pageManager.cpp \
|
||||
parameterManager.cpp \
|
||||
programManager.cpp \
|
||||
accountManager.cpp \
|
||||
logger.cpp
|
||||
|
||||
# Default rules for deployment.
|
||||
qnx: target.path = /tmp/$${TARGET}/bin
|
||||
else: unix:!android: target.path = /opt/$${TARGET}/bin
|
||||
!isEmpty(target.path): INSTALLS += target
|
||||
|
||||
HEADERS += \
|
||||
pageManager.h \
|
||||
parameterManager.h \
|
||||
programManager.h \
|
||||
accountManager.h \
|
||||
logger.h
|
||||
|
@ -1,275 +1,275 @@
|
||||
#include "accountManager.h"
|
||||
|
||||
AccountManager::AccountManager(std::string pathToFil, std::string pathToAccountNumberFile, PAGE page, const PAGE *pagesALL)
|
||||
: pagesALL(pagesALL), pathToAccountNumberFile(pathToAccountNumberFile + "_" + page.name_id), pageInUse(page)
|
||||
{
|
||||
std::string pathToAccountsFile = pathToFil + "_" + page.name_id;
|
||||
std::ifstream ifs(pathToAccountsFile);
|
||||
if(!ifs.is_open()) {
|
||||
if(writeDefault(pathToAccountsFile) != 0)
|
||||
exit(12);
|
||||
ifs.open(pathToAccountsFile);
|
||||
if(!ifs.is_open()) {
|
||||
std::cout << " => Error: Konnte Account File nicht aufmachen" << std::endl;
|
||||
exit(13);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
std::string line;
|
||||
while (std::getline(ifs, line)) {
|
||||
if(line.length() > 0 && line[0] == '#')
|
||||
continue;
|
||||
Account account;
|
||||
size_t Delimeter = line.find("/");
|
||||
|
||||
if(Delimeter == std::string::npos) {
|
||||
account.Email = line;
|
||||
account.Password = line;
|
||||
} else {
|
||||
account.Email = std::string(line).erase(Delimeter, line.length() - Delimeter);
|
||||
account.Password = line.erase(0, Delimeter + 1);
|
||||
}
|
||||
if(account.Email == "" || account.Password == "")
|
||||
continue;
|
||||
else
|
||||
accounts.push_back(account);
|
||||
}
|
||||
|
||||
ifs.close();
|
||||
|
||||
}
|
||||
|
||||
Account AccountManager::getNextAccount()
|
||||
{
|
||||
if(accounts.size() == 0) {
|
||||
std::cout << " => Error: Keine Accounts vorhanden." << std::endl;
|
||||
exit(36);
|
||||
}
|
||||
size_t accountNumber = getLastAccountNumber();
|
||||
++accountNumber;
|
||||
|
||||
if( accountNumber >= accounts.size() )
|
||||
accountNumber=0;
|
||||
if(setLastAccountNumber(accountNumber) != 0)
|
||||
exit(45);
|
||||
|
||||
return accounts.at(accountNumber);
|
||||
}
|
||||
|
||||
int AccountManager::writeDefault(std::string path)
|
||||
{
|
||||
std::ofstream ofs(path);
|
||||
if(!ofs.is_open()) {
|
||||
perror((std::string(" => Error: Konnte Account Datei nicht aufmachen: ") + path).c_str());
|
||||
return -1;
|
||||
}
|
||||
std::cout << " => Erstelle Datei mit Accounts unter: " << path << "..." <<std::endl;
|
||||
ofs << "# <- Am Anfang der Zeile deaktiviert diese." << std::endl;
|
||||
ofs << "#Email/Passwort - Falls diese gleich sind, geht auch nur Email oder Passwort" << std::endl;
|
||||
|
||||
enum pagesID {
|
||||
STO,
|
||||
ANICLOUD,
|
||||
STOIP,
|
||||
SERIENCAM,
|
||||
SERIENSTREAMTO
|
||||
};
|
||||
|
||||
if( pageInUse.url == pagesALL[STO].url
|
||||
|| pageInUse.url == pagesALL[STOIP].url
|
||||
|| pageInUse.url == pagesALL[SERIENCAM].url
|
||||
|| pageInUse.url == pagesALL[SERIENSTREAMTO].url)
|
||||
{
|
||||
ofs << "EntzueckendPackenderSkorpion@oida.icu" << std::endl;
|
||||
ofs << "HumorvollWundervollerDelfin@spam.care/HumorvollWundervollerDelfin@spam.care" << std::endl;
|
||||
ofs << "ExzellentPackenderHirsch@muell.icu/ExzellentPackenderHirsch@muell.icu" << std::endl;
|
||||
ofs << "GrandiosLeuchtenderPanda@papierkorb.me" << std::endl;
|
||||
ofs << "AttraktivPositiverSteinbock@magspam.net" << std::endl;
|
||||
ofs << "FreundlichKostbarerSteinbock@spam.care" << std::endl;
|
||||
ofs << "FabelhaftSelbstsichererUhu@spam.care" << std::endl;
|
||||
ofs << "HumorvollSinnlicherRabe@muell.icu" << std::endl;
|
||||
ofs << "AnspruchsvollTraumhafterPavian@ultra.fyi" << std::endl;
|
||||
ofs << "FaszinierendRiskanterLuchs@magspam.net" << std::endl;
|
||||
ofs << "BeruehmtMystischerPanda@ultra.fyi" << std::endl;
|
||||
ofs << "CharmantRasanterLoewe@existiert.net" << std::endl;
|
||||
ofs << "BedeutendLuesternerAal@existiert.net" << std::endl;
|
||||
ofs << "ElegantSelbstsichererAdler@ultra.fyi" << std::endl;
|
||||
ofs << "FaszinierendKoeniglicherBaer@spam.care" << std::endl;
|
||||
ofs << "CharmantKostbarerLoewe@magspam.net" << std::endl;
|
||||
ofs << "BedeutendPrallerSkorpion@muellemail.com" << std::endl;
|
||||
ofs << "FreundlichPerfekterRochen@muellmail.com" << std::endl;
|
||||
ofs << "AusgelassenKostbarerBasilisk@magspam.net" << std::endl;
|
||||
ofs << "FabelhaftLebhafterSchakal@ultra.fyi" << std::endl;
|
||||
ofs << "ExzellentSchoenerSteinbock@existiert.net" << std::endl;
|
||||
ofs << "ErhellendLustvollerAdler@muell.icu" << std::endl;
|
||||
ofs << "ExzellentIdealerSchakal@muell.icu" << std::endl;
|
||||
ofs << "BrillantVitalerSalamander@spam.care" << std::endl;
|
||||
ofs << "BezauberndRiesigerSchakal@oida.icu" << std::endl;
|
||||
ofs << "DynamischWarmerBaer@magspam.net" << std::endl;
|
||||
ofs << "EmotionalLeidenschaftlicherBaer@oida.icu" << std::endl;
|
||||
ofs << "BewundernswertWarmerSchwan@oida.icu" << std::endl;
|
||||
ofs << "HuebschUnfassbarerAal@papierkorb.me" << std::endl;
|
||||
ofs << "FroehlichWundervollerBiber@muellmail.com" << std::endl;
|
||||
ofs << "BefreiendWilderDelfin@spam.care" << std::endl;
|
||||
ofs << "FreundlichStilvollerTiger@oida.icu" << std::endl;
|
||||
ofs << "EchtKoeniglicherStorch@existiert.net" << std::endl;
|
||||
ofs << "BefluegeltPrallerSchwan@spam.care" << std::endl;
|
||||
ofs << "ErhellendSeltenerSeeloewe@ultra.fyi" << std::endl;
|
||||
ofs << "FreundlichZuverlaessigerSchwan@spam.care" << std::endl;
|
||||
ofs << "HervorragendWundervollerReiher@oida.icu" << std::endl;
|
||||
ofs << "AnspruchsvollStilvollerUhu@magspam.net" << std::endl;
|
||||
ofs << "AnmutigTraumhafterHai@muellemail.com" << std::endl;
|
||||
ofs << "AtemberaubendIdealerTapir@ultra.fyi" << std::endl;
|
||||
ofs << "GeheimLeuchtenderLuchs@muellemail.com" << std::endl;
|
||||
ofs << "DuftendKlarerTapir@muellmail.com" << std::endl;
|
||||
ofs << "GeheimUnwiderstehlicherRabe@muell.icu" << std::endl;
|
||||
ofs << "ExtravagantSpektakulaererAdler@spam.care" << std::endl;
|
||||
ofs << "BildlichWarmerLoewe@oida.icu" << std::endl;
|
||||
ofs << "AktivKlarerHai@spam.care" << std::endl;
|
||||
ofs << "AktivKostbarerElch@oida.icu" << std::endl;
|
||||
ofs << "Strust1991@jourrapide.com" << std::endl;
|
||||
ofs << "Natchoughe1928@dayrep.com" << std::endl;
|
||||
ofs << "zweirot@einrot.com" << std::endl;
|
||||
ofs << "AktivMagischerFrosch@existiert.net" << std::endl;
|
||||
ofs << "ErhellendPerfekterDachs@existiert.net" << std::endl;
|
||||
ofs << "ojfvwj.fgf@existiert.net" << std::endl;
|
||||
ofs << "lusiouae@wegwerfemail.de" << std::endl;
|
||||
ofs << "fraiwrou@wegwerfemail.de" << std::endl;
|
||||
ofs << "driotean@wegwerfemail.de" << std::endl;
|
||||
ofs << "tiaprour@wegwerfemail.de" << std::endl;
|
||||
ofs << "FeurigWarmerPapagei@existiert.net" << std::endl;
|
||||
ofs << "FrischStilvollerPavian@magspam.net" << std::endl;
|
||||
ofs << "FeurigZaghafterLoewe@muellmail.com" << std::endl;
|
||||
ofs << "GigantischKoeniglicherSchwan@magspam.net" << std::endl;
|
||||
ofs << "FreizuegigPersoenlicherLemming@spam.care" << std::endl;
|
||||
ofs << "BelebtIntelligenterHusky@papierkorb.me" << std::endl;
|
||||
ofs << "FreundlichMaximalerSpecht@muellmail.com" << std::endl;
|
||||
ofs << "FreundlichStarkerHirsch@ultra.fyi" << std::endl;
|
||||
ofs << "ErstklassigRasanterElch@oida.icu" << std::endl;
|
||||
ofs << "FreundlichStarkerPavian@ultra.fyi" << std::endl;
|
||||
ofs << "EinfuehlsamRiskanterPapagei@oida.icu" << std::endl;
|
||||
ofs << "FantastischPositiverHirsch@existiert.net" << std::endl;
|
||||
ofs << "GeborgenIndividuellerOtter@muell.icu" << std::endl;
|
||||
ofs << "HervorragendSensibelerWal@oida.icu" << std::endl;
|
||||
ofs << "HerrlichIndividuellerPelikan@spam.care" << std::endl;
|
||||
ofs << "HerrlichLeuchtenderTapir@muellmail.com" << std::endl;
|
||||
ofs << "ErstaunlichIntensiverEsel@magspam.net" << std::endl;
|
||||
ofs << "ExtravagantPraechtigerWal@muellemail.com" << std::endl;
|
||||
ofs << "GravierendWundervollerFalke@spam.care" << std::endl;
|
||||
ofs << "EntzueckendLebhafterFlamingo@magspam.net" << std::endl;
|
||||
ofs << "GeheimSprachloserStorch@existiert.net" << std::endl;
|
||||
ofs << "GravierendVitalerOtter@spam.care" << std::endl;
|
||||
ofs << "GrenzenlosInteressanterElch@oida.icu" << std::endl;
|
||||
ofs << "HellPackenderGoldfisch@muellemail.com" << std::endl;
|
||||
ofs << "AbenteuerlichSelbstloserFalke@muell.icu" << std::endl;
|
||||
ofs << "EmotionalZaghafterPapagei@magspam.net" << std::endl;
|
||||
ofs << "HellLiebenswerterElefant@muellemail.com" << std::endl;
|
||||
ofs << "BildlichImponierenderEsel@muellemail.com" << std::endl;
|
||||
ofs << "ErstaunlichSprachloserPapagei@ultra.fyi" << std::endl;
|
||||
ofs << "BerauschendLebendigerDelfin@ultra.fyi" << std::endl;
|
||||
ofs << "GravierendIntensiverHase@oida.icu" << std::endl;
|
||||
ofs << "BerauschendUnglaublicherGorilla@oida.icu" << std::endl;
|
||||
ofs << "GenuesslichPraechtigerDachs@spam.care" << std::endl;
|
||||
|
||||
} else if( pageInUse.url == pagesALL[ANICLOUD].url ) {
|
||||
ofs << "C322334ark1954@teleworm.us/C322334ark1954@teleworm.us" << std::endl;
|
||||
ofs << "wemixex225@iconmle.com/wemixex225@iconmle.com" << std::endl;
|
||||
ofs << "Thw86757utary@teleworm.us" << std::endl;
|
||||
ofs << "thw811ssssutary@teleworm.us" << std::endl;
|
||||
ofs << "Leonardoutary@teleworm.us" << std::endl;
|
||||
ofs << "efgewtzhewtrhterw@tonne.to" << std::endl;
|
||||
ofs << "dwfwqefqefqe@dsgvo.ru" << std::endl;
|
||||
ofs << "dfdfgwgwrgwg@muell.ru" << std::endl;
|
||||
ofs << "BildlichSprachloserWal@spam.care" << std::endl;
|
||||
ofs << "BildlichLustvollerRochen@muell.ru" << std::endl;
|
||||
ofs << "AngenehmMaximalerHai@muell.icu" << std::endl;
|
||||
ofs << "FreundlichKostbarerWolf@fukaru.com" << std::endl;
|
||||
ofs << "animewatcherxgas120@oida.icu" << std::endl;
|
||||
ofs << "animewatcherxgas7776@oida.icu" << std::endl;
|
||||
ofs << "animewatcherxgas777116@oida.icu" << std::endl;
|
||||
|
||||
ofs << "" << std::endl;
|
||||
ofs << "" << std::endl;
|
||||
ofs << "" << std::endl;
|
||||
ofs << "" << std::endl;
|
||||
ofs << "" << std::endl;
|
||||
ofs << "" << std::endl;
|
||||
ofs << "" << std::endl;
|
||||
ofs << "" << std::endl;
|
||||
ofs << "" << std::endl;
|
||||
ofs << "" << std::endl;
|
||||
ofs << "" << std::endl;
|
||||
ofs << "" << std::endl;
|
||||
ofs << "" << std::endl;
|
||||
ofs << "" << std::endl;
|
||||
ofs << "" << std::endl;
|
||||
ofs << "" << std::endl;
|
||||
// ofs << "" << std::endl;
|
||||
// ofs << "" << std::endl;
|
||||
// ofs << "" << std::endl;
|
||||
// ofs << "" << std::endl;
|
||||
// ofs << "" << std::endl;
|
||||
// ofs << "" << std::endl;
|
||||
// ofs << "" << std::endl;
|
||||
// ofs << "" << std::endl;
|
||||
// ofs << "" << std::endl;
|
||||
// ofs << "" << std::endl;
|
||||
// ofs << "" << std::endl;
|
||||
// ofs << "" << std::endl;
|
||||
// ofs << "" << std::endl;
|
||||
// ofs << "" << std::endl;
|
||||
// ofs << "" << std::endl;
|
||||
// ofs << "" << std::endl;
|
||||
// ofs << "" << std::endl;
|
||||
// ofs << "" << std::endl;
|
||||
// ofs << "" << std::endl;
|
||||
// ofs << "" << std::endl;
|
||||
// ofs << "" << std::endl;
|
||||
// ofs << "" << std::endl;
|
||||
// ofs << "" << std::endl;
|
||||
// ofs << "" << std::endl;
|
||||
// ofs << "" << std::endl;
|
||||
// ofs << "" << std::endl;
|
||||
// ofs << "" << std::endl;
|
||||
} else {
|
||||
std::cout << " => WARNUNG: Keine standart Accounts für die Url '" << pageInUse.url << "' vorhanden." <<std::endl;
|
||||
}
|
||||
|
||||
ofs.close();
|
||||
return 0;
|
||||
}
|
||||
|
||||
size_t AccountManager::getLastAccountNumber()
|
||||
{
|
||||
std::ifstream fStream;
|
||||
fStream.open(pathToAccountNumberFile);
|
||||
if(!fStream.is_open()) {
|
||||
std::ofstream ofs;
|
||||
ofs.open(pathToAccountNumberFile);
|
||||
ofs << "0" << std::endl;
|
||||
ofs.close();
|
||||
fStream.open(pathToAccountNumberFile);
|
||||
if(!fStream.is_open()) {
|
||||
perror(" => Error: Konnte Account Number Datei nicht erstellen");
|
||||
exit(34);
|
||||
}
|
||||
}
|
||||
|
||||
std::string content( (std::istreambuf_iterator<char>(fStream) ), (std::istreambuf_iterator<char>() ) );
|
||||
return static_cast<size_t>( atoi(content.c_str()) );
|
||||
}
|
||||
|
||||
int AccountManager::setLastAccountNumber(size_t number)
|
||||
{
|
||||
std::ofstream ofs;
|
||||
ofs.open(pathToAccountNumberFile, std::ios::trunc);
|
||||
if(!ofs.is_open()) {
|
||||
std::cout << " => Error: Account Number Datei ist nicht aufgemacht." << std::endl;
|
||||
return 110;
|
||||
}
|
||||
//fStream.clear();
|
||||
ofs << number << std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
#include "accountManager.h"
|
||||
|
||||
AccountManager::AccountManager(std::string pathToFil, std::string pathToAccountNumberFile, PAGE page, const PAGE *pagesALL)
|
||||
: pagesALL(pagesALL), pathToAccountNumberFile(pathToAccountNumberFile + "_" + page.name_id), pageInUse(page)
|
||||
{
|
||||
std::string pathToAccountsFile = pathToFil + "_" + page.name_id;
|
||||
std::ifstream ifs(pathToAccountsFile);
|
||||
if(!ifs.is_open()) {
|
||||
if(writeDefault(pathToAccountsFile) != 0)
|
||||
exit(12);
|
||||
ifs.open(pathToAccountsFile);
|
||||
if(!ifs.is_open()) {
|
||||
std::cout << " => Error: Konnte Account File nicht aufmachen" << std::endl;
|
||||
exit(13);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
std::string line;
|
||||
while (std::getline(ifs, line)) {
|
||||
if(line.length() > 0 && line[0] == '#')
|
||||
continue;
|
||||
Account account;
|
||||
size_t Delimeter = line.find("/");
|
||||
|
||||
if(Delimeter == std::string::npos) {
|
||||
account.Email = line;
|
||||
account.Password = line;
|
||||
} else {
|
||||
account.Email = std::string(line).erase(Delimeter, line.length() - Delimeter);
|
||||
account.Password = line.erase(0, Delimeter + 1);
|
||||
}
|
||||
if(account.Email == "" || account.Password == "")
|
||||
continue;
|
||||
else
|
||||
accounts.push_back(account);
|
||||
}
|
||||
|
||||
ifs.close();
|
||||
|
||||
}
|
||||
|
||||
Account AccountManager::getNextAccount()
|
||||
{
|
||||
if(accounts.size() == 0) {
|
||||
std::cout << " => Error: Keine Accounts vorhanden." << std::endl;
|
||||
exit(36);
|
||||
}
|
||||
size_t accountNumber = getLastAccountNumber();
|
||||
++accountNumber;
|
||||
|
||||
if( accountNumber >= accounts.size() )
|
||||
accountNumber=0;
|
||||
if(setLastAccountNumber(accountNumber) != 0)
|
||||
exit(45);
|
||||
|
||||
return accounts.at(accountNumber);
|
||||
}
|
||||
|
||||
int AccountManager::writeDefault(std::string path)
|
||||
{
|
||||
std::ofstream ofs(path);
|
||||
if(!ofs.is_open()) {
|
||||
perror((std::string(" => Error: Konnte Account Datei nicht aufmachen: ") + path).c_str());
|
||||
return -1;
|
||||
}
|
||||
std::cout << " => Erstelle Datei mit Accounts unter: " << path << "..." <<std::endl;
|
||||
ofs << "# <- Am Anfang der Zeile deaktiviert diese." << std::endl;
|
||||
ofs << "#Email/Passwort - Falls diese gleich sind, geht auch nur Email oder Passwort" << std::endl;
|
||||
|
||||
enum pagesID {
|
||||
STO,
|
||||
ANICLOUD,
|
||||
STOIP,
|
||||
SERIENCAM,
|
||||
SERIENSTREAMTO
|
||||
};
|
||||
|
||||
if( pageInUse.url == pagesALL[STO].url
|
||||
|| pageInUse.url == pagesALL[STOIP].url
|
||||
|| pageInUse.url == pagesALL[SERIENCAM].url
|
||||
|| pageInUse.url == pagesALL[SERIENSTREAMTO].url)
|
||||
{
|
||||
ofs << "EntzueckendPackenderSkorpion@oida.icu" << std::endl;
|
||||
ofs << "HumorvollWundervollerDelfin@spam.care/HumorvollWundervollerDelfin@spam.care" << std::endl;
|
||||
ofs << "ExzellentPackenderHirsch@muell.icu/ExzellentPackenderHirsch@muell.icu" << std::endl;
|
||||
ofs << "GrandiosLeuchtenderPanda@papierkorb.me" << std::endl;
|
||||
ofs << "AttraktivPositiverSteinbock@magspam.net" << std::endl;
|
||||
ofs << "FreundlichKostbarerSteinbock@spam.care" << std::endl;
|
||||
ofs << "FabelhaftSelbstsichererUhu@spam.care" << std::endl;
|
||||
ofs << "HumorvollSinnlicherRabe@muell.icu" << std::endl;
|
||||
ofs << "AnspruchsvollTraumhafterPavian@ultra.fyi" << std::endl;
|
||||
ofs << "FaszinierendRiskanterLuchs@magspam.net" << std::endl;
|
||||
ofs << "BeruehmtMystischerPanda@ultra.fyi" << std::endl;
|
||||
ofs << "CharmantRasanterLoewe@existiert.net" << std::endl;
|
||||
ofs << "BedeutendLuesternerAal@existiert.net" << std::endl;
|
||||
ofs << "ElegantSelbstsichererAdler@ultra.fyi" << std::endl;
|
||||
ofs << "FaszinierendKoeniglicherBaer@spam.care" << std::endl;
|
||||
ofs << "CharmantKostbarerLoewe@magspam.net" << std::endl;
|
||||
ofs << "BedeutendPrallerSkorpion@muellemail.com" << std::endl;
|
||||
ofs << "FreundlichPerfekterRochen@muellmail.com" << std::endl;
|
||||
ofs << "AusgelassenKostbarerBasilisk@magspam.net" << std::endl;
|
||||
ofs << "FabelhaftLebhafterSchakal@ultra.fyi" << std::endl;
|
||||
ofs << "ExzellentSchoenerSteinbock@existiert.net" << std::endl;
|
||||
ofs << "ErhellendLustvollerAdler@muell.icu" << std::endl;
|
||||
ofs << "ExzellentIdealerSchakal@muell.icu" << std::endl;
|
||||
ofs << "BrillantVitalerSalamander@spam.care" << std::endl;
|
||||
ofs << "BezauberndRiesigerSchakal@oida.icu" << std::endl;
|
||||
ofs << "DynamischWarmerBaer@magspam.net" << std::endl;
|
||||
ofs << "EmotionalLeidenschaftlicherBaer@oida.icu" << std::endl;
|
||||
ofs << "BewundernswertWarmerSchwan@oida.icu" << std::endl;
|
||||
ofs << "HuebschUnfassbarerAal@papierkorb.me" << std::endl;
|
||||
ofs << "FroehlichWundervollerBiber@muellmail.com" << std::endl;
|
||||
ofs << "BefreiendWilderDelfin@spam.care" << std::endl;
|
||||
ofs << "FreundlichStilvollerTiger@oida.icu" << std::endl;
|
||||
ofs << "EchtKoeniglicherStorch@existiert.net" << std::endl;
|
||||
ofs << "BefluegeltPrallerSchwan@spam.care" << std::endl;
|
||||
ofs << "ErhellendSeltenerSeeloewe@ultra.fyi" << std::endl;
|
||||
ofs << "FreundlichZuverlaessigerSchwan@spam.care" << std::endl;
|
||||
ofs << "HervorragendWundervollerReiher@oida.icu" << std::endl;
|
||||
ofs << "AnspruchsvollStilvollerUhu@magspam.net" << std::endl;
|
||||
ofs << "AnmutigTraumhafterHai@muellemail.com" << std::endl;
|
||||
ofs << "AtemberaubendIdealerTapir@ultra.fyi" << std::endl;
|
||||
ofs << "GeheimLeuchtenderLuchs@muellemail.com" << std::endl;
|
||||
ofs << "DuftendKlarerTapir@muellmail.com" << std::endl;
|
||||
ofs << "GeheimUnwiderstehlicherRabe@muell.icu" << std::endl;
|
||||
ofs << "ExtravagantSpektakulaererAdler@spam.care" << std::endl;
|
||||
ofs << "BildlichWarmerLoewe@oida.icu" << std::endl;
|
||||
ofs << "AktivKlarerHai@spam.care" << std::endl;
|
||||
ofs << "AktivKostbarerElch@oida.icu" << std::endl;
|
||||
ofs << "Strust1991@jourrapide.com" << std::endl;
|
||||
ofs << "Natchoughe1928@dayrep.com" << std::endl;
|
||||
ofs << "zweirot@einrot.com" << std::endl;
|
||||
ofs << "AktivMagischerFrosch@existiert.net" << std::endl;
|
||||
ofs << "ErhellendPerfekterDachs@existiert.net" << std::endl;
|
||||
ofs << "ojfvwj.fgf@existiert.net" << std::endl;
|
||||
ofs << "lusiouae@wegwerfemail.de" << std::endl;
|
||||
ofs << "fraiwrou@wegwerfemail.de" << std::endl;
|
||||
ofs << "driotean@wegwerfemail.de" << std::endl;
|
||||
ofs << "tiaprour@wegwerfemail.de" << std::endl;
|
||||
ofs << "FeurigWarmerPapagei@existiert.net" << std::endl;
|
||||
ofs << "FrischStilvollerPavian@magspam.net" << std::endl;
|
||||
ofs << "FeurigZaghafterLoewe@muellmail.com" << std::endl;
|
||||
ofs << "GigantischKoeniglicherSchwan@magspam.net" << std::endl;
|
||||
ofs << "FreizuegigPersoenlicherLemming@spam.care" << std::endl;
|
||||
ofs << "BelebtIntelligenterHusky@papierkorb.me" << std::endl;
|
||||
ofs << "FreundlichMaximalerSpecht@muellmail.com" << std::endl;
|
||||
ofs << "FreundlichStarkerHirsch@ultra.fyi" << std::endl;
|
||||
ofs << "ErstklassigRasanterElch@oida.icu" << std::endl;
|
||||
ofs << "FreundlichStarkerPavian@ultra.fyi" << std::endl;
|
||||
ofs << "EinfuehlsamRiskanterPapagei@oida.icu" << std::endl;
|
||||
ofs << "FantastischPositiverHirsch@existiert.net" << std::endl;
|
||||
ofs << "GeborgenIndividuellerOtter@muell.icu" << std::endl;
|
||||
ofs << "HervorragendSensibelerWal@oida.icu" << std::endl;
|
||||
ofs << "HerrlichIndividuellerPelikan@spam.care" << std::endl;
|
||||
ofs << "HerrlichLeuchtenderTapir@muellmail.com" << std::endl;
|
||||
ofs << "ErstaunlichIntensiverEsel@magspam.net" << std::endl;
|
||||
ofs << "ExtravagantPraechtigerWal@muellemail.com" << std::endl;
|
||||
ofs << "GravierendWundervollerFalke@spam.care" << std::endl;
|
||||
ofs << "EntzueckendLebhafterFlamingo@magspam.net" << std::endl;
|
||||
ofs << "GeheimSprachloserStorch@existiert.net" << std::endl;
|
||||
ofs << "GravierendVitalerOtter@spam.care" << std::endl;
|
||||
ofs << "GrenzenlosInteressanterElch@oida.icu" << std::endl;
|
||||
ofs << "HellPackenderGoldfisch@muellemail.com" << std::endl;
|
||||
ofs << "AbenteuerlichSelbstloserFalke@muell.icu" << std::endl;
|
||||
ofs << "EmotionalZaghafterPapagei@magspam.net" << std::endl;
|
||||
ofs << "HellLiebenswerterElefant@muellemail.com" << std::endl;
|
||||
ofs << "BildlichImponierenderEsel@muellemail.com" << std::endl;
|
||||
ofs << "ErstaunlichSprachloserPapagei@ultra.fyi" << std::endl;
|
||||
ofs << "BerauschendLebendigerDelfin@ultra.fyi" << std::endl;
|
||||
ofs << "GravierendIntensiverHase@oida.icu" << std::endl;
|
||||
ofs << "BerauschendUnglaublicherGorilla@oida.icu" << std::endl;
|
||||
ofs << "GenuesslichPraechtigerDachs@spam.care" << std::endl;
|
||||
|
||||
} else if( pageInUse.url == pagesALL[ANICLOUD].url ) {
|
||||
ofs << "C322334ark1954@teleworm.us/C322334ark1954@teleworm.us" << std::endl;
|
||||
ofs << "wemixex225@iconmle.com/wemixex225@iconmle.com" << std::endl;
|
||||
ofs << "Thw86757utary@teleworm.us" << std::endl;
|
||||
ofs << "thw811ssssutary@teleworm.us" << std::endl;
|
||||
ofs << "Leonardoutary@teleworm.us" << std::endl;
|
||||
ofs << "efgewtzhewtrhterw@tonne.to" << std::endl;
|
||||
ofs << "dwfwqefqefqe@dsgvo.ru" << std::endl;
|
||||
ofs << "dfdfgwgwrgwg@muell.ru" << std::endl;
|
||||
ofs << "BildlichSprachloserWal@spam.care" << std::endl;
|
||||
ofs << "BildlichLustvollerRochen@muell.ru" << std::endl;
|
||||
ofs << "AngenehmMaximalerHai@muell.icu" << std::endl;
|
||||
ofs << "FreundlichKostbarerWolf@fukaru.com" << std::endl;
|
||||
ofs << "animewatcherxgas120@oida.icu" << std::endl;
|
||||
ofs << "animewatcherxgas7776@oida.icu" << std::endl;
|
||||
ofs << "animewatcherxgas777116@oida.icu" << std::endl;
|
||||
|
||||
ofs << "" << std::endl;
|
||||
ofs << "" << std::endl;
|
||||
ofs << "" << std::endl;
|
||||
ofs << "" << std::endl;
|
||||
ofs << "" << std::endl;
|
||||
ofs << "" << std::endl;
|
||||
ofs << "" << std::endl;
|
||||
ofs << "" << std::endl;
|
||||
ofs << "" << std::endl;
|
||||
ofs << "" << std::endl;
|
||||
ofs << "" << std::endl;
|
||||
ofs << "" << std::endl;
|
||||
ofs << "" << std::endl;
|
||||
ofs << "" << std::endl;
|
||||
ofs << "" << std::endl;
|
||||
ofs << "" << std::endl;
|
||||
// ofs << "" << std::endl;
|
||||
// ofs << "" << std::endl;
|
||||
// ofs << "" << std::endl;
|
||||
// ofs << "" << std::endl;
|
||||
// ofs << "" << std::endl;
|
||||
// ofs << "" << std::endl;
|
||||
// ofs << "" << std::endl;
|
||||
// ofs << "" << std::endl;
|
||||
// ofs << "" << std::endl;
|
||||
// ofs << "" << std::endl;
|
||||
// ofs << "" << std::endl;
|
||||
// ofs << "" << std::endl;
|
||||
// ofs << "" << std::endl;
|
||||
// ofs << "" << std::endl;
|
||||
// ofs << "" << std::endl;
|
||||
// ofs << "" << std::endl;
|
||||
// ofs << "" << std::endl;
|
||||
// ofs << "" << std::endl;
|
||||
// ofs << "" << std::endl;
|
||||
// ofs << "" << std::endl;
|
||||
// ofs << "" << std::endl;
|
||||
// ofs << "" << std::endl;
|
||||
// ofs << "" << std::endl;
|
||||
// ofs << "" << std::endl;
|
||||
// ofs << "" << std::endl;
|
||||
// ofs << "" << std::endl;
|
||||
// ofs << "" << std::endl;
|
||||
} else {
|
||||
std::cout << " => WARNUNG: Keine standart Accounts für die Url '" << pageInUse.url << "' vorhanden." <<std::endl;
|
||||
}
|
||||
|
||||
ofs.close();
|
||||
return 0;
|
||||
}
|
||||
|
||||
size_t AccountManager::getLastAccountNumber()
|
||||
{
|
||||
std::ifstream fStream;
|
||||
fStream.open(pathToAccountNumberFile);
|
||||
if(!fStream.is_open()) {
|
||||
std::ofstream ofs;
|
||||
ofs.open(pathToAccountNumberFile);
|
||||
ofs << "0" << std::endl;
|
||||
ofs.close();
|
||||
fStream.open(pathToAccountNumberFile);
|
||||
if(!fStream.is_open()) {
|
||||
perror(" => Error: Konnte Account Number Datei nicht erstellen");
|
||||
exit(34);
|
||||
}
|
||||
}
|
||||
|
||||
std::string content( (std::istreambuf_iterator<char>(fStream) ), (std::istreambuf_iterator<char>() ) );
|
||||
return static_cast<size_t>( atoi(content.c_str()) );
|
||||
}
|
||||
|
||||
int AccountManager::setLastAccountNumber(size_t number)
|
||||
{
|
||||
std::ofstream ofs;
|
||||
ofs.open(pathToAccountNumberFile, std::ios::trunc);
|
||||
if(!ofs.is_open()) {
|
||||
std::cout << " => Error: Account Number Datei ist nicht aufgemacht." << std::endl;
|
||||
return 110;
|
||||
}
|
||||
//fStream.clear();
|
||||
ofs << number << std::endl;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -1,36 +1,36 @@
|
||||
#ifndef ACCOUNTMANAGER_H
|
||||
#define ACCOUNTMANAGER_H
|
||||
|
||||
|
||||
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include <fstream>
|
||||
|
||||
struct Account {
|
||||
std::string Email,
|
||||
Password;
|
||||
};
|
||||
|
||||
|
||||
//wichtig vor Account declaration!!!!
|
||||
#include "parameterManager.h"
|
||||
|
||||
class AccountManager
|
||||
{
|
||||
public:
|
||||
AccountManager(std::string pathToFile, std::string pathToAccountNumberFile, PAGE page, const PAGE * pagesALL);
|
||||
Account getNextAccount();
|
||||
size_t getLastAccountNumber();
|
||||
const PAGE * pagesALL;
|
||||
|
||||
private:
|
||||
std::vector<Account> accounts;
|
||||
std::string pathToAccountNumberFile;
|
||||
PAGE pageInUse;
|
||||
int setLastAccountNumber(size_t number);
|
||||
int writeDefault(std::string path);
|
||||
|
||||
};
|
||||
|
||||
#endif // ACCOUNTMANAGER_H
|
||||
#ifndef ACCOUNTMANAGER_H
|
||||
#define ACCOUNTMANAGER_H
|
||||
|
||||
|
||||
|
||||
#include <iostream>
|
||||
#include <vector>
|
||||
#include <fstream>
|
||||
|
||||
struct Account {
|
||||
std::string Email,
|
||||
Password;
|
||||
};
|
||||
|
||||
|
||||
//wichtig vor Account declaration!!!!
|
||||
#include "parameterManager.h"
|
||||
|
||||
class AccountManager
|
||||
{
|
||||
public:
|
||||
AccountManager(std::string pathToFile, std::string pathToAccountNumberFile, PAGE page, const PAGE * pagesALL);
|
||||
Account getNextAccount();
|
||||
size_t getLastAccountNumber();
|
||||
const PAGE * pagesALL;
|
||||
|
||||
private:
|
||||
std::vector<Account> accounts;
|
||||
std::string pathToAccountNumberFile;
|
||||
PAGE pageInUse;
|
||||
int setLastAccountNumber(size_t number);
|
||||
int writeDefault(std::string path);
|
||||
|
||||
};
|
||||
|
||||
#endif // ACCOUNTMANAGER_H
|
||||
|
BIN
src/debug/S_New4.exe
Normal file
BIN
src/debug/S_New4.exe
Normal file
Binary file not shown.
170
src/logger.cpp
170
src/logger.cpp
@ -1,85 +1,85 @@
|
||||
#include "logger.h"
|
||||
|
||||
Logger::Logger(std::string logFilePathm)
|
||||
: filePath(logFilePathm)
|
||||
{
|
||||
if(openFile(filePath))
|
||||
exit(234);
|
||||
}
|
||||
|
||||
Logger::~Logger()
|
||||
{
|
||||
file.close();
|
||||
}
|
||||
|
||||
std::string Logger::getFilePath()
|
||||
{
|
||||
return filePath;
|
||||
}
|
||||
|
||||
int Logger::logCommandLine(std::string logText)
|
||||
{
|
||||
std::time_t now = std::time(nullptr);
|
||||
struct tm *tm_now = localtime(&now);
|
||||
std::string date((tm_now->tm_mday < 10 ? "0" : "") + std::to_string(tm_now->tm_mday) + "." +
|
||||
(tm_now->tm_mon +1 < 10 ? "0" : "" ) + std::to_string(tm_now->tm_mon +1) + "." +
|
||||
std::to_string(1900 + tm_now->tm_year) + " - " +
|
||||
(tm_now->tm_hour < 10 ? "0" : "" ) + std::to_string(tm_now->tm_hour) + ":" +
|
||||
(tm_now->tm_min < 10 ? "0" : "" ) + std::to_string(tm_now->tm_min));
|
||||
return writetoFile( " -> " + date + ": \"" + logText + "\"");
|
||||
}
|
||||
|
||||
int Logger::logSubLine(std::string line)
|
||||
{
|
||||
return writetoFile("\t\t" + line);
|
||||
}
|
||||
|
||||
std::string Logger::getLogText()
|
||||
{
|
||||
return std::string((std::istreambuf_iterator<char>(file)), std::istreambuf_iterator<char>());
|
||||
}
|
||||
|
||||
int Logger::clearFile()
|
||||
{
|
||||
//close it
|
||||
file.close();
|
||||
|
||||
//open it empty + close it
|
||||
std::ofstream ofs;
|
||||
ofs.open(filePath, std::ofstream::out | std::ofstream::trunc);
|
||||
if(!ofs.is_open()) {
|
||||
perror("Open File for clearing failed");
|
||||
return 35;
|
||||
}
|
||||
ofs.close();
|
||||
|
||||
//reopen it
|
||||
return openFile(filePath);
|
||||
}
|
||||
|
||||
int Logger::writetoFile(std::string t)
|
||||
{
|
||||
file << t << std::endl;
|
||||
return file.good();
|
||||
}
|
||||
|
||||
int Logger::openFile(std::string path)
|
||||
{
|
||||
file.open(path, std::ios::in | std::ios::out | std::ios::app);
|
||||
if(!file.is_open()) {
|
||||
//Exestiert nicht => Erstelle Datei
|
||||
std::ofstream ofs(path);
|
||||
if(!ofs.is_open()) {
|
||||
perror((" => Error: Konnte LogDatei nicht erstellen: '" + path + "'").c_str());
|
||||
return (5656);
|
||||
} else {
|
||||
ofs.close();
|
||||
}
|
||||
file.open(path);
|
||||
if(!file.is_open()) {
|
||||
perror((" => Error: Konnte LogDatei nicht aufmachen: '" + path + "'").c_str());
|
||||
return (5657);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#include "logger.h"
|
||||
|
||||
Logger::Logger(std::string logFilePathm)
|
||||
: filePath(logFilePathm)
|
||||
{
|
||||
if(openFile(filePath))
|
||||
exit(234);
|
||||
}
|
||||
|
||||
Logger::~Logger()
|
||||
{
|
||||
file.close();
|
||||
}
|
||||
|
||||
std::string Logger::getFilePath()
|
||||
{
|
||||
return filePath;
|
||||
}
|
||||
|
||||
int Logger::logCommandLine(std::string logText)
|
||||
{
|
||||
std::time_t now = std::time(nullptr);
|
||||
struct tm *tm_now = localtime(&now);
|
||||
std::string date((tm_now->tm_mday < 10 ? "0" : "") + std::to_string(tm_now->tm_mday) + "." +
|
||||
(tm_now->tm_mon +1 < 10 ? "0" : "" ) + std::to_string(tm_now->tm_mon +1) + "." +
|
||||
std::to_string(1900 + tm_now->tm_year) + " - " +
|
||||
(tm_now->tm_hour < 10 ? "0" : "" ) + std::to_string(tm_now->tm_hour) + ":" +
|
||||
(tm_now->tm_min < 10 ? "0" : "" ) + std::to_string(tm_now->tm_min));
|
||||
return writetoFile( " -> " + date + ": \"" + logText + "\"");
|
||||
}
|
||||
|
||||
int Logger::logSubLine(std::string line)
|
||||
{
|
||||
return writetoFile("\t\t" + line);
|
||||
}
|
||||
|
||||
std::string Logger::getLogText()
|
||||
{
|
||||
return std::string((std::istreambuf_iterator<char>(file)), std::istreambuf_iterator<char>());
|
||||
}
|
||||
|
||||
int Logger::clearFile()
|
||||
{
|
||||
//close it
|
||||
file.close();
|
||||
|
||||
//open it empty + close it
|
||||
std::ofstream ofs;
|
||||
ofs.open(filePath, std::ofstream::out | std::ofstream::trunc);
|
||||
if(!ofs.is_open()) {
|
||||
perror("Open File for clearing failed");
|
||||
return 35;
|
||||
}
|
||||
ofs.close();
|
||||
|
||||
//reopen it
|
||||
return openFile(filePath);
|
||||
}
|
||||
|
||||
int Logger::writetoFile(std::string t)
|
||||
{
|
||||
file << t << std::endl;
|
||||
return file.good();
|
||||
}
|
||||
|
||||
int Logger::openFile(std::string path)
|
||||
{
|
||||
file.open(path, std::ios::in | std::ios::out | std::ios::app);
|
||||
if(!file.is_open()) {
|
||||
//Exestiert nicht => Erstelle Datei
|
||||
std::ofstream ofs(path);
|
||||
if(!ofs.is_open()) {
|
||||
perror((" => Error: Konnte LogDatei nicht erstellen: '" + path + "'").c_str());
|
||||
return (5656);
|
||||
} else {
|
||||
ofs.close();
|
||||
}
|
||||
file.open(path);
|
||||
if(!file.is_open()) {
|
||||
perror((" => Error: Konnte LogDatei nicht aufmachen: '" + path + "'").c_str());
|
||||
return (5657);
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
72
src/logger.h
72
src/logger.h
@ -1,36 +1,36 @@
|
||||
#ifndef LOGGER_H
|
||||
#define LOGGER_H
|
||||
|
||||
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
#include <streambuf>
|
||||
#include <ctime> // std::time, localtime ...
|
||||
|
||||
|
||||
#include "parameterManager.h"
|
||||
|
||||
|
||||
class Logger
|
||||
{
|
||||
public:
|
||||
Logger(std::string logFilePathm);
|
||||
~Logger();
|
||||
std::string getFilePath();
|
||||
std::fstream file;
|
||||
|
||||
int logCommandLine(std::string logText);
|
||||
int logSubLine(std::string line);
|
||||
std::string getLogText();
|
||||
int clearFile();
|
||||
|
||||
|
||||
private:
|
||||
std::string filePath;
|
||||
int writetoFile(std::string t);
|
||||
int openFile(std::string path);
|
||||
};
|
||||
|
||||
#endif // LOGGER_H
|
||||
#ifndef LOGGER_H
|
||||
#define LOGGER_H
|
||||
|
||||
|
||||
|
||||
#include <iostream>
|
||||
#include <fstream>
|
||||
#include <string>
|
||||
#include <streambuf>
|
||||
#include <ctime> // std::time, localtime ...
|
||||
|
||||
|
||||
#include "parameterManager.h"
|
||||
|
||||
|
||||
class Logger
|
||||
{
|
||||
public:
|
||||
Logger(std::string logFilePathm);
|
||||
~Logger();
|
||||
std::string getFilePath();
|
||||
std::fstream file;
|
||||
|
||||
int logCommandLine(std::string logText);
|
||||
int logSubLine(std::string line);
|
||||
std::string getLogText();
|
||||
int clearFile();
|
||||
|
||||
|
||||
private:
|
||||
std::string filePath;
|
||||
int writetoFile(std::string t);
|
||||
int openFile(std::string path);
|
||||
};
|
||||
|
||||
#endif // LOGGER_H
|
||||
|
42
src/main.cpp
42
src/main.cpp
@ -1,21 +1,21 @@
|
||||
#include "programManager.h"
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
ProgramManager mainProgram;
|
||||
Settings settings;
|
||||
int res = manageParameter(settings, argc, argv);
|
||||
if(res == -1)
|
||||
return 0;
|
||||
else if(res != 0) {
|
||||
if(settings.debugMode)
|
||||
std::cout << " => Error: Das Auswerten der Parameter ist fehlgeschlagen!" << std::endl;
|
||||
return res;
|
||||
} else {
|
||||
if( (res = mainProgram.start(&settings)) != 0 )
|
||||
std::cout << (" => Entschuldigung, ein Fehler ist aufgetreten!\n Bei wiederholtem Auftreten verwenden Sie -d, --debug für mehr Infos\n"
|
||||
" oder --update um, falls vorhanden, auf eine neuere Version des Programms zu wechseln") << std::endl;
|
||||
return res;
|
||||
}
|
||||
}
|
||||
#include "programManager.h"
|
||||
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
ProgramManager mainProgram;
|
||||
Settings settings;
|
||||
int res = manageParameter(settings, argc, argv);
|
||||
if(res == -1)
|
||||
return 0;
|
||||
else if(res != 0) {
|
||||
if(settings.debugMode)
|
||||
std::cout << " => Error: Das Auswerten der Parameter ist fehlgeschlagen!" << std::endl;
|
||||
return res;
|
||||
} else {
|
||||
if( (res = mainProgram.start(&settings)) != 0 )
|
||||
std::cout << (" => Entschuldigung, ein Fehler ist aufgetreten!\n Bei wiederholtem Auftreten verwenden Sie -d, --debug für mehr Infos\n"
|
||||
" oder --update um, falls vorhanden, auf eine neuere Version des Programms zu wechseln") << std::endl;
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
1451
src/pageManager.cpp
1451
src/pageManager.cpp
File diff suppressed because it is too large
Load Diff
@ -1,81 +1,83 @@
|
||||
#ifndef MANAGEPAGE_H
|
||||
#define MANAGEPAGE_H
|
||||
|
||||
|
||||
#include "accountManager.h"
|
||||
#include "parameterManager.h" // for isNumber
|
||||
|
||||
#ifdef _WIN32
|
||||
#include "./../include/curl/curl.h"
|
||||
#include <windows.h>
|
||||
|
||||
//----------------------?????????????????
|
||||
#define noSLLCheck
|
||||
|
||||
#else
|
||||
#include "curl/curl.h"
|
||||
#endif
|
||||
|
||||
#include <sstream>
|
||||
#include <unistd.h> // sleep
|
||||
#include <algorithm>
|
||||
#include <ctime> // std::time, localtime ...
|
||||
|
||||
|
||||
struct Reply {
|
||||
Reply() {}
|
||||
Reply(std::string value_both) : html(value_both), url(value_both) {}
|
||||
Reply(std::string html, std::string url) : html(html), url(url) {}
|
||||
|
||||
std::string html, url;
|
||||
};
|
||||
|
||||
struct checkNameRply {
|
||||
std::string name;
|
||||
PAGE pageInUse;
|
||||
enum STATUS { SUCCESS, FAILED, NOTHING_FOUND, MULTIPLE_OPTIONS, NO_WORKING_PAGE } status;
|
||||
|
||||
checkNameRply(const std::string &name, const PAGE &p, const checkNameRply::STATUS &s )
|
||||
: name(name), pageInUse(p), status(s) {}
|
||||
};
|
||||
|
||||
|
||||
class PageManager
|
||||
{
|
||||
public:
|
||||
PageManager(std::string sock5ProxyOnlyAddress = "127.0.0.1:9150");
|
||||
~PageManager();
|
||||
|
||||
void setProxy(std::string ip, int port);
|
||||
void setDebugMode(bool status);
|
||||
|
||||
void get_terminal_size(int& width);
|
||||
|
||||
Reply getServerRequest(std::string protocol, std::string Url, bool useCookies = false, std::string data = "", bool generateCookieFile = false, bool UrlAfterRedirectOnlyNeeded = false, std::string cookieFilePath = "");
|
||||
int downLoadToFile(std::string filePath, std::string url);
|
||||
|
||||
int login(PAGE page, Account account, std::string cookieFilePath);
|
||||
Reply getUrlAfterRedirect(std::string p, std::string Url, std::string cookieFilePath);
|
||||
checkNameRply checkName(std::vector<PAGE> &pages, std::string Name, bool useFirstPage);
|
||||
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, bool withWarnMsg);
|
||||
std::string getLinkAfterHosterBasedOperation(std::string url);
|
||||
|
||||
int counterContains(std::string text, std::string substring_with_prozent_i_for_number, int starte_mit_dieser_Zahl = 1);
|
||||
std::string grep(std::string text, std::string substring, bool IgnoreCaseSensetifity = false);
|
||||
static std::string upper_string(const std::string& str);
|
||||
size_t getDate();
|
||||
std::string getExePath();
|
||||
|
||||
int compareVersions(std::string Version1, std::string Version2);
|
||||
|
||||
int writeToFile(std::vector<std::string> paths, std::string text);
|
||||
|
||||
static std::string getCurlVersion();
|
||||
|
||||
std::string sock5Proxy;
|
||||
private:
|
||||
bool debugMode = false;
|
||||
};
|
||||
|
||||
#endif // MANAGEPAGE_H
|
||||
#ifndef MANAGEPAGE_H
|
||||
#define MANAGEPAGE_H
|
||||
|
||||
|
||||
#include "accountManager.h"
|
||||
#include "parameterManager.h" // for isNumber
|
||||
|
||||
#ifdef _WIN32
|
||||
#include "./../include/curl/curl.h"
|
||||
#include <windows.h>
|
||||
|
||||
//----------------------?????????????????
|
||||
#define noSLLCheck
|
||||
|
||||
#else
|
||||
#include "curl/curl.h"
|
||||
#endif
|
||||
|
||||
#include <sstream>
|
||||
#include <unistd.h> // sleep
|
||||
#include <algorithm>
|
||||
#include <ctime> // std::time, localtime ...
|
||||
|
||||
|
||||
struct Reply {
|
||||
Reply() {}
|
||||
Reply(std::string value_both) : html(value_both), url(value_both) {}
|
||||
Reply(std::string html, std::string url) : html(html), url(url) {}
|
||||
|
||||
std::string html, url;
|
||||
};
|
||||
|
||||
struct checkNameRply {
|
||||
std::string name;
|
||||
PAGE pageInUse;
|
||||
enum STATUS { SUCCESS, FAILED, NOTHING_FOUND, MULTIPLE_OPTIONS, NO_WORKING_PAGE }
|
||||
status;
|
||||
|
||||
|
||||
checkNameRply(const std::string &name, const PAGE &p, const checkNameRply::STATUS &s )
|
||||
: name(name), pageInUse(p), status(s) {}
|
||||
};
|
||||
|
||||
|
||||
class PageManager
|
||||
{
|
||||
public:
|
||||
PageManager(std::string sock5ProxyOnlyAddress = "127.0.0.1:9150");
|
||||
~PageManager();
|
||||
|
||||
void setProxy(std::string ip, int port);
|
||||
void setDebugMode(bool status);
|
||||
|
||||
void get_terminal_size(int& width);
|
||||
|
||||
Reply getServerRequest(std::string protocol, std::string Url, bool useCookies = false, std::string data = "", bool generateCookieFile = false, bool UrlAfterRedirectOnlyNeeded = false, std::string cookieFilePath = "");
|
||||
int downLoadToFile(std::string filePath, std::string url);
|
||||
|
||||
int login(PAGE page, Account account, std::string cookieFilePath);
|
||||
Reply getUrlAfterRedirect(std::string p, std::string Url, std::string cookieFilePath);
|
||||
checkNameRply checkName(std::vector<PAGE> &pages, std::string Name, bool useFirstPage, std::vector<std::string> &outPutFilePaths /*for replacement*/);
|
||||
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, bool withWarnMsg);
|
||||
std::string getLinkAfterHosterBasedOperation(std::string url);
|
||||
|
||||
int counterContains(std::string text, std::string substring_with_prozent_i_for_number, int starte_mit_dieser_Zahl = 1);
|
||||
std::string grep(std::string text, std::string substring, bool IgnoreCaseSensetifity = false);
|
||||
static std::string upper_string(const std::string& str);
|
||||
size_t getDate();
|
||||
std::string getExePath();
|
||||
|
||||
int compareVersions(std::string Version1, std::string Version2);
|
||||
|
||||
int writeToFile(std::vector<std::string> paths, std::string text);
|
||||
|
||||
static std::string getCurlVersion();
|
||||
|
||||
std::string sock5Proxy;
|
||||
private:
|
||||
bool debugMode = false;
|
||||
};
|
||||
|
||||
#endif // MANAGEPAGE_H
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,279 +1,279 @@
|
||||
#ifndef PARAMETERMANAGER_H
|
||||
#define PARAMETERMANAGER_H
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef __linux__
|
||||
#ifndef _WIN32
|
||||
#error "Error Invalid System: Only for Linux and Windows systems!"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#include <iostream>
|
||||
#include <getopt.h>
|
||||
#include <string.h> // strlen
|
||||
#include <sstream>
|
||||
#include <sys/stat.h>
|
||||
#include <fstream>
|
||||
#include <vector>
|
||||
|
||||
#include <limits.h> // PATH_MAX
|
||||
#include <unistd.h> // readlink()
|
||||
#include <dirent.h>
|
||||
|
||||
|
||||
|
||||
#define UpdaterCloudUrlWithPath "https://cloud.obermui.de/s/tXz7SWdaPJ7TacZ/download?path=%2F&files="
|
||||
#define SecondUpdaterCloudUrlWithPath "https://snew4.obermui.de/download?path=%2F&files="
|
||||
#define VERSION "5.2.1"
|
||||
#define DEFAULT_FILE_VERSION "2.3"
|
||||
|
||||
//default, anime, normal,
|
||||
//suche: für jede katego. eine
|
||||
//zu beginn, erst eiunmal serie suchen
|
||||
|
||||
|
||||
|
||||
|
||||
enum Modus {
|
||||
EXIT = -1,
|
||||
DEFAULT_MODUS = 0,
|
||||
DIRECT_LINK_MODUS = 1,
|
||||
SEARCH_MODUS = 2,
|
||||
INFO_MODUS = 3,
|
||||
NEWS_MODUS = 4,
|
||||
UPDATE_MODUS = 5,
|
||||
REMOVE_SETTINGS_AND_CACHE_MODUS = 6,
|
||||
PRINT_LOG_FILE_MODUS
|
||||
|
||||
};
|
||||
|
||||
struct PAGE {
|
||||
PAGE() {}
|
||||
PAGE( std::string protocol, std::string url, std::string nameID, std::string urlAphabetSerienList, std::string urlDir )
|
||||
: protocol(protocol), name_id(nameID), url(url), urlAlphabetSerienList(urlAphabetSerienList), UrlDir(urlDir)
|
||||
{
|
||||
|
||||
}
|
||||
std::string protocol, name_id, url, urlAlphabetSerienList, UrlDir;
|
||||
};
|
||||
|
||||
#include "logger.h"
|
||||
|
||||
//Wichtig nach MODUS UND PAGE DECLARATION
|
||||
#include "pageManager.h"
|
||||
|
||||
|
||||
struct Settings {
|
||||
|
||||
const std::string programName = "S_New4";
|
||||
const PAGE _sto = PAGE( "https://", "s.to", "Normale_Serien", "/serien-alphabet", "/serie/stream/"),
|
||||
_stoIP = PAGE( "", "190.115.18.20", "Normale_Serien", "/serien-alphabet", "/serie/stream/"),
|
||||
serienstreamto = PAGE("https://", "serienstream.to", "Normale_Serien", "/serien-alphabet", "/serie/stream/"),
|
||||
seriencam = PAGE("https://", "serien.cam", "Normale_Serien", "/serien-alphabet", "/serie/stream/"),
|
||||
// _serienstreamsx = PAGE( "https://", "serienstream.sx", "Normale_Serien", "/serien-alphabet", "/serie/stream/"),
|
||||
|
||||
_anicio = PAGE( "https://" , "AniWorld.to", "Animes", "/animes-alphabet", "/anime/stream/");
|
||||
const PAGE pagesALL[5] = { _sto, _anicio, _stoIP, /*_serienstreamsx,*/ seriencam, serienstreamto };
|
||||
|
||||
std::vector<PAGE> pagesInUse; // Priority sorted
|
||||
bool useFirstPage = false;
|
||||
|
||||
PAGE direktLink_explizitPage;
|
||||
|
||||
|
||||
Settings() {
|
||||
for(const auto &e : pagesALL)
|
||||
pagesInUse.push_back( e );
|
||||
}
|
||||
|
||||
// Wenn das Betriebsystem x86 ist:
|
||||
#if defined (_X86_) || defined (__amd64__) || defined (_M_IX86)
|
||||
// Wenn das Betriebsystem LINUX ist und 64 Bit ist:
|
||||
#if defined (__linux) && ( defined (_LP64) || defined (__LP64__))
|
||||
const std::string VersionFileName = std::string("Version-LINx86.txt");
|
||||
const std::string ProgrammFileName = std::string("S_New4-LINx86");
|
||||
#else
|
||||
//Wenn das Betriebsystem Windows ist und 64 Bit ist
|
||||
#if defined (_WIN64)
|
||||
const std::string VersionFileName = std::string("Version-WINx86.txt");
|
||||
const std::string ProgrammFileName = std::string("S_New4-WINx86.exe");
|
||||
#else
|
||||
//Ungültiges Betriebsystem => Error
|
||||
#error Kein Windows oder Linux 64 Bit System: Der Updater Fuktion wird nicht Funktionieren! Remove this Line in the Code to use S_New4 without the Updater. ( But your System must be Windows or Linux )
|
||||
const std::string VersionFileName = "";
|
||||
const std::string ProgrammFileName = "";
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//Nicht x86 Architekture
|
||||
#else
|
||||
//Raspberry Pi -> ARMv6 -> 32Bit
|
||||
#if defined(__ARM_ARCH_6__) && defined (__linux)
|
||||
const std::string VersionFileName = std::string("Version-LIN-ARMv6.txt");
|
||||
const std::string ProgrammFileName = std::string("S_New4-LIN-ARMv6");
|
||||
#else
|
||||
#error Falsche Architektur: Der Updater Fuktion wird nicht Funktionieren! Remove this Line in the Code to use S_New4 without the Updater. ( But your System must be Windows or Linux )
|
||||
const std::string VersionFileName = "";
|
||||
const std::string ProgrammFileName = "";
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
std::string name,
|
||||
accountFilePath = "",
|
||||
accountNumberPath= "",
|
||||
cookieFilePath = "",
|
||||
serienListPath = "",
|
||||
|
||||
lastUpdateDateFilePath = "",
|
||||
lastProgrammUpdateDateFilePath = "",
|
||||
|
||||
|
||||
configDir="",
|
||||
cacheDir="",
|
||||
logFilePath="",
|
||||
|
||||
defaultsFilePath = "",
|
||||
proxy_ip = "127.0.0.1",
|
||||
languages = "GerDub,GerSub,Eng,",
|
||||
genaueHoster = "",
|
||||
version = VERSION,
|
||||
defaultFileVersion= DEFAULT_FILE_VERSION,
|
||||
default_checkPath = "",
|
||||
default_Searchmuster = "S%Staffel%E%Folge%",
|
||||
argv0;
|
||||
|
||||
std::vector<std::string> outputFilePaths;
|
||||
|
||||
|
||||
Modus modus = Modus::EXIT;
|
||||
bool colorless = false,
|
||||
debugMode = false,
|
||||
search_IgnoreUpperLower = true,
|
||||
search_wantUpdate = false,
|
||||
search_show_othernames = false,
|
||||
askForEveryDir = true,
|
||||
skipEpisodenNameOutput = false,
|
||||
showLastUpdate = false;
|
||||
|
||||
int startEpisode = 1,
|
||||
stopEpisode = 0,
|
||||
startSeason = 1,
|
||||
stopSeason = 0,
|
||||
proxy_port = 9050,
|
||||
default_maxDirs = 20,
|
||||
updateWarningDays = 10,
|
||||
|
||||
programmUpdateWarningDays = 20;
|
||||
|
||||
|
||||
char pathSymbol = '/';
|
||||
char wrongPathSymbol = '\\';
|
||||
unsigned maxThreads = 0;
|
||||
|
||||
enum COLOR {
|
||||
NO_COLOR = 0,
|
||||
Black = 30,
|
||||
Dark_Gray = 90,
|
||||
Red = 31,
|
||||
Light_Red = 91,
|
||||
Green = 32,
|
||||
Light_Green = 92,
|
||||
Brown_Orange = 33,
|
||||
Yellow = 93,
|
||||
Blue = 34,
|
||||
Light_Blue = 94,
|
||||
Purple = 35,
|
||||
Light_Purple = 95,
|
||||
Cyan = 36,
|
||||
Light_Cyan = 96,
|
||||
Light_Gray = 37,
|
||||
White = 97
|
||||
|
||||
};
|
||||
std::string setPColor(const COLOR &color) {
|
||||
return ( (colorless) ? "" : "\033[" + std::to_string(color) +"m" );
|
||||
}
|
||||
std::string resetPColor() {
|
||||
return ( (colorless) ? "" : "\033[0m" );
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
std::string replace(std::string str, std::string substr1, std::string substr2);
|
||||
|
||||
int manageParameter(Settings &settings, int argc, char ** argv);
|
||||
int loadDefaulOptions(Settings & settings);
|
||||
std::vector<std::string> compare(std::string All_Options_with_komma_between, std::string input);
|
||||
bool isSame(char ** argv, std::string FunktionName);
|
||||
bool isNumber(std::string number);
|
||||
|
||||
int setPaths(Settings &settings);
|
||||
|
||||
bool fileExists (const std::string& name);
|
||||
bool dirExists(std::string dir);
|
||||
bool nothingExists(std::string path);
|
||||
|
||||
bool createDirIsOk(std::string path);
|
||||
bool makePathIsOk(std::string path);
|
||||
bool removeDirIsOk(std::string path, Settings *settings, bool askForDelete);
|
||||
|
||||
int unterOption_help(Settings &settings);
|
||||
void unterOption_printVersion(Settings &settings);
|
||||
|
||||
int unterOption_default(Settings * settings, int argc, char **argv);
|
||||
void unterOption_default_help(std::string programName);
|
||||
|
||||
int unterOption_url(Settings * settings, int argc, char **argv);
|
||||
void unterOption_url_help(std::string programName);
|
||||
|
||||
int unterOption_search(Settings * settings, int argc, char **argv);
|
||||
void unterOption_search_help(std::string programName);
|
||||
|
||||
int unterOption_info(Settings * settings, int argc, char **argv);
|
||||
void unterOption_info_help(std::string programName);
|
||||
|
||||
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);
|
||||
void unterOption_news_help(std::string programName);
|
||||
|
||||
int unterOption_update(Settings * settings, int argc, char **argv);
|
||||
void unterOption_update_help(std::string programName);
|
||||
|
||||
int unterOption_RemoveSettings_or_CacheDir(Settings * settings, int argc, char **argv);
|
||||
void unterOption_RemoveSettings_or_CacheDire_help(std::string programName);
|
||||
|
||||
int unterOption_printLogFile(Settings * settings, int argc, char **argv);
|
||||
void unterOption_printLogFile(std::string programName);
|
||||
|
||||
int setS5ProxytoSettings(Settings &settings, std::string optarg);
|
||||
int setUpInternetPages(Settings &settings, std::string optarg);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // PARAMETERMANAGER_H
|
||||
#ifndef PARAMETERMANAGER_H
|
||||
#define PARAMETERMANAGER_H
|
||||
|
||||
|
||||
|
||||
|
||||
#ifndef __linux__
|
||||
#ifndef _WIN32
|
||||
#error "Error Invalid System: Only for Linux and Windows systems!"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
#include <iostream>
|
||||
#include <getopt.h>
|
||||
#include <string.h> // strlen
|
||||
#include <sstream>
|
||||
#include <sys/stat.h>
|
||||
#include <fstream>
|
||||
#include <vector>
|
||||
|
||||
#include <limits.h> // PATH_MAX
|
||||
#include <unistd.h> // readlink()
|
||||
#include <dirent.h>
|
||||
|
||||
|
||||
|
||||
#define UpdaterCloudUrlWithPath "https://cloud.obermui.de/s/tXz7SWdaPJ7TacZ/download?path=%2F&files="
|
||||
#define SecondUpdaterCloudUrlWithPath "https://snew4.obermui.de/download?path=%2F&files="
|
||||
#define VERSION "5.2.1"
|
||||
#define DEFAULT_FILE_VERSION "2.3"
|
||||
|
||||
//default, anime, normal,
|
||||
//suche: für jede katego. eine
|
||||
//zu beginn, erst eiunmal serie suchen
|
||||
|
||||
|
||||
|
||||
|
||||
enum Modus {
|
||||
EXIT = -1,
|
||||
DEFAULT_MODUS = 0,
|
||||
DIRECT_LINK_MODUS = 1,
|
||||
SEARCH_MODUS = 2,
|
||||
INFO_MODUS = 3,
|
||||
NEWS_MODUS = 4,
|
||||
UPDATE_MODUS = 5,
|
||||
REMOVE_SETTINGS_AND_CACHE_MODUS = 6,
|
||||
PRINT_LOG_FILE_MODUS
|
||||
|
||||
};
|
||||
|
||||
struct PAGE {
|
||||
PAGE() {}
|
||||
PAGE( std::string protocol, std::string url, std::string nameID, std::string urlAphabetSerienList, std::string urlDir )
|
||||
: protocol(protocol), name_id(nameID), url(url), urlAlphabetSerienList(urlAphabetSerienList), UrlDir(urlDir)
|
||||
{
|
||||
|
||||
}
|
||||
std::string protocol, name_id, url, urlAlphabetSerienList, UrlDir;
|
||||
};
|
||||
|
||||
#include "logger.h"
|
||||
|
||||
//Wichtig nach MODUS UND PAGE DECLARATION
|
||||
#include "pageManager.h"
|
||||
|
||||
|
||||
struct Settings {
|
||||
|
||||
const std::string programName = "S_New4";
|
||||
const PAGE _sto = PAGE( "https://", "s.to", "Normale_Serien", "/serien-alphabet", "/serie/stream/"),
|
||||
_stoIP = PAGE( "http://", "190.115.18.20", "Normale_Serien", "/serien-alphabet", "/serie/stream/"),
|
||||
serienstreamto = PAGE("https://", "serienstream.to", "Normale_Serien", "/serien-alphabet", "/serie/stream/"),
|
||||
seriencam = PAGE("https://", "serien.cam", "Normale_Serien", "/serien-alphabet", "/serie/stream/"),
|
||||
|
||||
_anicio = PAGE( "https://" , "aniworld.to", "Animes", "/animes-alphabet", "/anime/stream/");
|
||||
const PAGE pagesALL[5] = { _sto, _anicio, _stoIP, /*_serienstreamsx,*/ seriencam, serienstreamto };
|
||||
|
||||
std::vector<PAGE> pagesInUse; // Priority sorted
|
||||
bool useFirstPage = false;
|
||||
|
||||
PAGE direktLink_explizitPage;
|
||||
|
||||
|
||||
Settings() {
|
||||
for(const auto &e : pagesALL)
|
||||
pagesInUse.push_back( e );
|
||||
}
|
||||
|
||||
// Wenn das Betriebsystem x86 ist:
|
||||
#if defined (_X86_) || defined (__amd64__) || defined (_M_IX86)
|
||||
// Wenn das Betriebsystem LINUX ist und 64 Bit ist:
|
||||
#if defined (__linux) && ( defined (_LP64) || defined (__LP64__))
|
||||
const std::string VersionFileName = std::string("Version-LINx86.txt");
|
||||
const std::string ProgrammFileName = std::string("S_New4-LINx86");
|
||||
#else
|
||||
//Wenn das Betriebsystem Windows ist und 64 Bit ist
|
||||
#if defined (_WIN64)
|
||||
const std::string VersionFileName = std::string("Version-WINx86.txt");
|
||||
const std::string ProgrammFileName = std::string("S_New4-WINx86.exe");
|
||||
#else
|
||||
//Ungültiges Betriebsystem => Error
|
||||
#error Kein Windows oder Linux 64 Bit System: Der Updater Fuktion wird nicht Funktionieren! Remove this Line in the Code to use S_New4 without the Updater. ( But your System must be Windows or Linux )
|
||||
const std::string VersionFileName = "";
|
||||
const std::string ProgrammFileName = "";
|
||||
#endif
|
||||
#endif
|
||||
|
||||
//Nicht x86 Architekture
|
||||
#else
|
||||
//Raspberry Pi -> ARMv6 -> 32Bit
|
||||
#if defined(__ARM_ARCH_6__) && defined (__linux)
|
||||
const std::string VersionFileName = std::string("Version-LIN-ARMv6.txt");
|
||||
const std::string ProgrammFileName = std::string("S_New4-LIN-ARMv6");
|
||||
#else
|
||||
#error Falsche Architektur: Der Updater Fuktion wird nicht Funktionieren! Remove this Line in the Code to use S_New4 without the Updater. ( But your System must be Windows or Linux )
|
||||
const std::string VersionFileName = "";
|
||||
const std::string ProgrammFileName = "";
|
||||
#endif
|
||||
#endif
|
||||
|
||||
|
||||
|
||||
|
||||
std::string name,
|
||||
accountFilePath = "",
|
||||
accountNumberPath= "",
|
||||
cookieFilePath = "",
|
||||
serienListPath = "",
|
||||
|
||||
lastUpdateDateFilePath = "",
|
||||
lastProgrammUpdateDateFilePath = "",
|
||||
|
||||
|
||||
configDir="",
|
||||
cacheDir="",
|
||||
logFilePath="",
|
||||
|
||||
defaultsFilePath = "",
|
||||
proxy_ip = "127.0.0.1",
|
||||
languages = "GerDub,GerSub,Eng,",
|
||||
genaueHoster = "",
|
||||
version = VERSION,
|
||||
defaultFileVersion= DEFAULT_FILE_VERSION,
|
||||
default_checkPath = "",
|
||||
default_Searchmuster = "S%Staffel%E%Folge%",
|
||||
argv0,
|
||||
downloadCoverPfad;
|
||||
|
||||
std::vector<std::string> outputFilePaths;
|
||||
|
||||
|
||||
Modus modus = Modus::EXIT;
|
||||
bool colorless = false,
|
||||
debugMode = false,
|
||||
search_IgnoreUpperLower = true,
|
||||
search_wantUpdate = false,
|
||||
search_show_othernames = false,
|
||||
askForEveryDir = true,
|
||||
skipEpisodenNameOutput = false,
|
||||
showLastUpdate = false;
|
||||
|
||||
int startEpisode = 1,
|
||||
stopEpisode = 0,
|
||||
startSeason = 1,
|
||||
stopSeason = 0,
|
||||
proxy_port = 9050,
|
||||
default_maxDirs = 20,
|
||||
updateWarningDays = 10,
|
||||
|
||||
programmUpdateWarningDays = 20;
|
||||
|
||||
|
||||
char pathSymbol = '/';
|
||||
char wrongPathSymbol = '\\';
|
||||
unsigned maxThreads = 0;
|
||||
|
||||
enum COLOR {
|
||||
NO_COLOR = 0,
|
||||
Black = 30,
|
||||
Dark_Gray = 90,
|
||||
Red = 31,
|
||||
Light_Red = 91,
|
||||
Green = 32,
|
||||
Light_Green = 92,
|
||||
Brown_Orange = 33,
|
||||
Yellow = 93,
|
||||
Blue = 34,
|
||||
Light_Blue = 94,
|
||||
Purple = 35,
|
||||
Light_Purple = 95,
|
||||
Cyan = 36,
|
||||
Light_Cyan = 96,
|
||||
Light_Gray = 37,
|
||||
White = 97
|
||||
|
||||
};
|
||||
std::string setPColor(const COLOR &color) {
|
||||
return ( (colorless) ? "" : "\033[" + std::to_string(color) +"m" );
|
||||
}
|
||||
std::string resetPColor() {
|
||||
return ( (colorless) ? "" : "\033[0m" );
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
std::string replace(std::string str, std::string substr1, std::string substr2);
|
||||
|
||||
int manageParameter(Settings &settings, int argc, char ** argv);
|
||||
int loadDefaulOptions(Settings & settings);
|
||||
std::vector<std::string> compare(std::string All_Options_with_komma_between, std::string input);
|
||||
bool isSame(char ** argv, std::string FunktionName);
|
||||
bool isNumber(std::string number);
|
||||
|
||||
int setPaths(Settings &settings);
|
||||
|
||||
bool fileExists (const std::string& name);
|
||||
bool dirExists(std::string dir);
|
||||
bool nothingExists(std::string path);
|
||||
|
||||
bool createDirIsOk(std::string path);
|
||||
bool makePathIsOk(std::string path);
|
||||
bool removeDirIsOk(std::string path, Settings *settings, bool askForDelete);
|
||||
|
||||
int unterOption_help(Settings &settings);
|
||||
void unterOption_printVersion(Settings &settings);
|
||||
|
||||
int unterOption_default(Settings * settings, int argc, char **argv);
|
||||
void unterOption_default_help(std::string programName);
|
||||
|
||||
int unterOption_url(Settings * settings, int argc, char **argv);
|
||||
void unterOption_url_help(std::string programName);
|
||||
|
||||
int unterOption_search(Settings * settings, int argc, char **argv);
|
||||
void unterOption_search_help(std::string programName);
|
||||
|
||||
int unterOption_info(Settings * settings, int argc, char **argv);
|
||||
void unterOption_info_help(std::string programName);
|
||||
|
||||
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);
|
||||
void unterOption_news_help(std::string programName);
|
||||
|
||||
int unterOption_update(Settings * settings, int argc, char **argv);
|
||||
void unterOption_update_help(std::string programName);
|
||||
|
||||
int unterOption_RemoveSettings_or_CacheDir(Settings * settings, int argc, char **argv);
|
||||
void unterOption_RemoveSettings_or_CacheDire_help(std::string programName);
|
||||
|
||||
int unterOption_printLogFile(Settings * settings, int argc, char **argv);
|
||||
void unterOption_printLogFile(std::string programName);
|
||||
|
||||
int setS5ProxytoSettings(Settings &settings, std::string optarg);
|
||||
int setUpInternetPages(Settings &settings, std::string optarg);
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#endif // PARAMETERMANAGER_H
|
||||
|
File diff suppressed because it is too large
Load Diff
@ -1,72 +1,72 @@
|
||||
#ifndef MANAGEPROGRAM_H
|
||||
#define MANAGEPROGRAM_H
|
||||
|
||||
|
||||
|
||||
|
||||
//#include "pageManager.h"
|
||||
#include "parameterManager.h"
|
||||
//#include "accountManager.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <pthread.h>
|
||||
|
||||
|
||||
struct ThreadData
|
||||
{
|
||||
ThreadData(unsigned id, pthread_t init, std::string nameinUrl,int exitStateInit, Settings * settings, AccountManager * accountMg, PageManager * pM, PAGE p)
|
||||
: id(id), page(p), thread(init), nameInUrl(nameinUrl), exitState(exitStateInit), settings(settings), accountManager(accountMg), pageManager(pM) {}
|
||||
|
||||
unsigned id;
|
||||
PAGE page;
|
||||
pthread_t thread;
|
||||
std::string nameInUrl, returnValue;
|
||||
int staffel, folge, exitState;
|
||||
Settings * settings;
|
||||
AccountManager * accountManager;
|
||||
PageManager * pageManager;
|
||||
|
||||
void * setState(int state) {
|
||||
this->exitState = state;
|
||||
return nullptr;
|
||||
}
|
||||
void setData(int staffel, int folge) { this->staffel = staffel; this->folge = folge; }
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
class ProgramManager
|
||||
{
|
||||
public:
|
||||
ProgramManager();
|
||||
~ProgramManager();
|
||||
int start(Settings *setting);
|
||||
int listDir(std::string &list, std::string path, int maxDepth, bool debugMode);
|
||||
|
||||
private:
|
||||
int defaultModus(Settings * settings);
|
||||
int directLinkModus(Settings * settings);
|
||||
int searchModus(Settings * settings, std::string *saveTo = nullptr, bool noPrint = false);
|
||||
int infoModus(Settings * settings);
|
||||
int newsModus(Settings *settings);
|
||||
int updateModus(Settings *settings);
|
||||
int cleanUpSettingsAndCache(Settings *settings);
|
||||
|
||||
|
||||
PageManager pageManager;
|
||||
std::vector<ThreadData*> threadList;
|
||||
unsigned nextThread;
|
||||
|
||||
int convertLink(PAGE page, std::string redirectLink, AccountManager *accountManager, Settings * settings, int Staffel = -1, int Folge = -1, std::string allLinks = "NOT_EMPTY");
|
||||
int searchModus_update(Settings * settings);
|
||||
int waitForThreads();
|
||||
int sucheNach_1_Serien(Settings *settings, PageManager &pageManager, checkNameRply &newNameAndPage);
|
||||
int checkLastUpdate(Settings * settings, ssize_t *days);
|
||||
|
||||
int checkLastProgrammUpdate(Settings *settings);
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif // MANAGEPROGRAM_H
|
||||
#ifndef MANAGEPROGRAM_H
|
||||
#define MANAGEPROGRAM_H
|
||||
|
||||
|
||||
|
||||
|
||||
//#include "pageManager.h"
|
||||
#include "parameterManager.h"
|
||||
//#include "accountManager.h"
|
||||
|
||||
#include <sys/types.h>
|
||||
#include <pthread.h>
|
||||
|
||||
|
||||
struct ThreadData
|
||||
{
|
||||
ThreadData(unsigned id, pthread_t init, std::string nameinUrl,int exitStateInit, Settings * settings, AccountManager * accountMg, PageManager * pM, PAGE p)
|
||||
: id(id), page(p), thread(init), nameInUrl(nameinUrl), exitState(exitStateInit), settings(settings), accountManager(accountMg), pageManager(pM) {}
|
||||
|
||||
unsigned id;
|
||||
PAGE page;
|
||||
pthread_t thread;
|
||||
std::string nameInUrl, returnValue;
|
||||
int staffel, folge, exitState;
|
||||
Settings * settings;
|
||||
AccountManager * accountManager;
|
||||
PageManager * pageManager;
|
||||
|
||||
void * setState(int state) {
|
||||
this->exitState = state;
|
||||
return nullptr;
|
||||
}
|
||||
void setData(int staffel, int folge) { this->staffel = staffel; this->folge = folge; }
|
||||
|
||||
};
|
||||
|
||||
|
||||
|
||||
class ProgramManager
|
||||
{
|
||||
public:
|
||||
ProgramManager();
|
||||
~ProgramManager();
|
||||
int start(Settings *setting);
|
||||
int listDir(std::string &list, std::string path, int maxDepth, bool debugMode);
|
||||
|
||||
private:
|
||||
int defaultModus(Settings * settings);
|
||||
int directLinkModus(Settings * settings);
|
||||
int searchModus(Settings * settings, std::string *saveTo = nullptr, bool noPrint = false);
|
||||
int infoModus(Settings * settings);
|
||||
int newsModus(Settings *settings);
|
||||
int updateModus(Settings *settings);
|
||||
int cleanUpSettingsAndCache(Settings *settings);
|
||||
|
||||
|
||||
PageManager pageManager;
|
||||
std::vector<ThreadData*> threadList;
|
||||
unsigned nextThread;
|
||||
|
||||
int convertLink(PAGE page, std::string redirectLink, AccountManager *accountManager, Settings * settings, int Staffel = -1, int Folge = -1, std::string allLinks = "NOT_EMPTY");
|
||||
int searchModus_update(Settings * settings);
|
||||
int waitForThreads();
|
||||
int sucheNach_1_Serien(Settings *settings, PageManager &pageManager, checkNameRply &newNameAndPage);
|
||||
int checkLastUpdate(Settings * settings, ssize_t *days);
|
||||
|
||||
int checkLastProgrammUpdate(Settings *settings);
|
||||
|
||||
|
||||
};
|
||||
|
||||
#endif // MANAGEPROGRAM_H
|
||||
|
Reference in New Issue
Block a user