forked from markus/S_New4
66 lines
1.9 KiB
C++
66 lines
1.9 KiB
C++
#ifndef MANAGEPROGRAM_H
|
|
#define MANAGEPROGRAM_H
|
|
|
|
#include "pageManager.h"
|
|
#include "parameterManager.h"
|
|
#include "accountManager.h"
|
|
|
|
#include <sys/types.h>
|
|
#include <dirent.h>
|
|
#include <pthread.h>
|
|
|
|
|
|
struct ThreadData
|
|
{
|
|
ThreadData(unsigned id, pthread_t init, std::string nameinUrl,int exitStateInit, Settings * settings, AccountManager * accountMg, PageManager * pM)
|
|
: id(id), thread(init), nameInUrl(nameinUrl), exitState(exitStateInit), settings(settings), accountManager(accountMg), pageManager(pM) {}
|
|
|
|
unsigned id;
|
|
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);
|
|
|
|
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);
|
|
|
|
PageManager pageManager;
|
|
std::vector<ThreadData*> threadList;
|
|
unsigned nextThread;
|
|
|
|
int convertLink(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, std::string &newName);
|
|
int checkLastUpdate(Settings * settings);
|
|
|
|
|
|
};
|
|
|
|
#endif // MANAGEPROGRAM_H
|