4 #include <jsoncpp/json/json.h>
6 // Log docs: https://github.com/gabime/spdlog
7 #include <spdlog/spdlog.h>
8 namespace spd = spdlog;
10 // Config docs: http://www.hyperrealm.com/libconfig/libconfig_manual.html#The-C_002b_002b-API
11 #include <libconfig.h++>
22 typedef std::map<std::string, std::string> PFMap;
25 VDRClient(const std::string& configDir);
28 bool process(std::string& request, PFMap& postFields, std::string& returnData);
31 const std::string& configDir;
33 std::shared_ptr<spd::logger> logger;
34 bool gettime(PFMap& postFields, Json::Value& returnJSON);
35 bool diskstats(PFMap& postFields, Json::Value& returnJSON);
36 bool channellist(PFMap& postFields, Json::Value& returnJSON);
37 bool reclist(PFMap& postFields, Json::Value& returnJSON);
38 bool timerlist(PFMap& postFields, Json::Value& returnJSON);
39 bool epgdownload(PFMap& postFields, Json::Value& returnJSON);
40 bool tunersstatus(PFMap& postFields, Json::Value& returnJSON);
41 bool epgfilterget(PFMap& postFields, Json::Value& js);
43 bool channelschedule(PFMap& postFields, Json::Value& returnJSON); // throws BadParamException
44 bool getscheduleevent(PFMap& postFields, Json::Value& returnJSON); // throws BadParamException
45 bool epgsearch(PFMap& postFields, Json::Value& returnJSON); // throws BadParamException
46 bool epgsearchsame(PFMap& postFields, Json::Value& returnJSON); // throws BadParamException
47 bool epgsearchotherhalf(PFMap& postFields, Json::Value& returnJSON); // throws BadParamException
48 bool timerset(PFMap& postFields, Json::Value& returnJSON); // throws BadParamException
49 bool recinfo(PFMap& postFields, Json::Value& returnJSON); // throws BadParamException
50 bool recstop(PFMap& postFields, Json::Value& returnJSON); // throws BadParamException
51 bool recdel(PFMap& postFields, Json::Value& returnJSON); // throws BadParamException
52 bool recrename(PFMap& postFields, Json::Value& returnJSON); // throws BadParamException
53 bool recmove(PFMap& postFields, Json::Value& returnJSON); // throws BadParamException
54 bool timersetactive(PFMap& postFields, Json::Value& returnJSON); // throws BadParamException
55 bool timerdel(PFMap& postFields, Json::Value& returnJSON); // throws BadParamException
56 bool timerisrecording(PFMap& postFields, Json::Value& returnJSON); // throws BadParamException
57 bool recresetresume(PFMap& postFields, Json::Value& returnJSON); // throws BadParamException
58 bool timeredit(PFMap& postFields, Json::Value& returnJSON); // throws BadParamException
59 bool epgfilteradd(PFMap& postFields, Json::Value& returnJSON); // throws BadParamException
60 bool epgfilterdel(PFMap& postFields, Json::Value& js); // throws BadParamException
62 cTimer* findTimer(cTimers* Timers,
63 const char* rChannelID, const char* rName, const char* rStartTime, const char* rStopTime, const char* rWeekDays);
64 const cTimer* findTimer(const cTimers* Timers,
65 const char* rChannelID, const char* rName, const char* rStartTime, const char* rStopTime, const char* rWeekDays);
66 cTimer* findTimer2(cTimers* Timers,
67 const char* rName, const char* rActive, const char* rChannelID, const char* rDay, const char* rWeekDays, const char* rStartTime, const char* rStopTime, const char* rPriority, const char* rLifetime);
68 const cEvent* getEvent(const cChannels* Channels, const cSchedules* Schedules,
69 Json::Value& js, int channelNumber, int eventID, int aroundTime);
71 int getVarInt(PFMap& postFields, const char* paramName); // THROWS
72 std::string getVarString(PFMap& postFields, const char* paramName, bool emptyOk = false); // THROWS
74 bool loadEpgFilter(libconfig::Config& epgFilter);
75 bool saveEpgFilter(libconfig::Config& epgFilter);
77 class BadParamException : public std::exception
81 BadParamException(const char* _param) { param = _param; }
83 virtual const char* what() const throw()