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++>
18 typedef std::map<std::string, std::string> PFMap;
24 bool process(std::string& request, PFMap& postFields, std::string& returnData);
27 std::shared_ptr<spd::logger> logger;
28 bool gettime(PFMap& postFields, Json::Value& returnJSON);
29 bool diskstats(PFMap& postFields, Json::Value& returnJSON);
30 bool channellist(PFMap& postFields, Json::Value& returnJSON);
31 bool reclist(PFMap& postFields, Json::Value& returnJSON);
32 bool timerlist(PFMap& postFields, Json::Value& returnJSON);
33 bool epgdownload(PFMap& postFields, Json::Value& returnJSON);
34 bool tunersstatus(PFMap& postFields, Json::Value& returnJSON);
35 bool epgfilterget(PFMap& postFields, Json::Value& js);
37 bool channelschedule(PFMap& postFields, Json::Value& returnJSON); // throws BadParamException
38 bool getscheduleevent(PFMap& postFields, Json::Value& returnJSON); // throws BadParamException
39 bool epgsearch(PFMap& postFields, Json::Value& returnJSON); // throws BadParamException
40 bool epgsearchsame(PFMap& postFields, Json::Value& returnJSON); // throws BadParamException
41 bool timerset(PFMap& postFields, Json::Value& returnJSON); // throws BadParamException
42 bool recinfo(PFMap& postFields, Json::Value& returnJSON); // throws BadParamException
43 bool recstop(PFMap& postFields, Json::Value& returnJSON); // throws BadParamException
44 bool recdel(PFMap& postFields, Json::Value& returnJSON); // throws BadParamException
45 bool recrename(PFMap& postFields, Json::Value& returnJSON); // throws BadParamException
46 bool recmove(PFMap& postFields, Json::Value& returnJSON); // throws BadParamException
47 bool timersetactive(PFMap& postFields, Json::Value& returnJSON); // throws BadParamException
48 bool timerdel(PFMap& postFields, Json::Value& returnJSON); // throws BadParamException
49 bool timerisrecording(PFMap& postFields, Json::Value& returnJSON); // throws BadParamException
50 bool recresetresume(PFMap& postFields, Json::Value& returnJSON); // throws BadParamException
51 bool timeredit(PFMap& postFields, Json::Value& returnJSON); // throws BadParamException
52 bool epgfilteradd(PFMap& postFields, Json::Value& returnJSON); // throws BadParamException
53 bool epgfilterdel(PFMap& postFields, Json::Value& js); // throws BadParamException
55 cTimer* findTimer(const char* rChannelID, const char* rName, const char* rStartTime, const char* rStopTime, const char* rWeekDays);
56 cTimer* findTimer2(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);
57 const cEvent* getEvent(Json::Value& js, int channelNumber, int eventID, int aroundTime);
59 void pathsForRecordingName(const std::string& recordingName,
60 std::string& dirNameSingleDate,
61 std::string& dirNameSingleTitle,
62 std::string& dirNameSingleFolder,
63 std::string& dirNameFullPathTitle,
64 std::string& dirNameFullPathDate); // throws int
66 int getVarInt(PFMap& postFields, const char* paramName); // THROWS
67 std::string getVarString(PFMap& postFields, const char* paramName); // THROWS
69 libconfig::Config epgFilter;
70 bool epgFilterLoaded = false;
74 class BadParamException : public std::exception
78 BadParamException(const char* _param) { param = _param; }
80 virtual const char* what() const throw()