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;
28 bool process(std::string& request, PFMap& postFields, std::string& returnData);
31 std::shared_ptr<spd::logger> logger;
32 bool gettime(PFMap& postFields, Json::Value& returnJSON);
33 bool diskstats(PFMap& postFields, Json::Value& returnJSON);
34 bool channellist(PFMap& postFields, Json::Value& returnJSON);
35 bool reclist(PFMap& postFields, Json::Value& returnJSON);
36 bool timerlist(PFMap& postFields, Json::Value& returnJSON);
37 bool epgdownload(PFMap& postFields, Json::Value& returnJSON);
38 bool tunersstatus(PFMap& postFields, Json::Value& returnJSON);
39 bool epgfilterget(PFMap& postFields, Json::Value& js);
41 bool channelschedule(PFMap& postFields, Json::Value& returnJSON); // throws BadParamException
42 bool getscheduleevent(PFMap& postFields, Json::Value& returnJSON); // throws BadParamException
43 bool epgsearch(PFMap& postFields, Json::Value& returnJSON); // throws BadParamException
44 bool epgsearchsame(PFMap& postFields, Json::Value& returnJSON); // throws BadParamException
45 bool epgsearchotherhalf(PFMap& postFields, Json::Value& returnJSON); // throws BadParamException
46 bool timerset(PFMap& postFields, Json::Value& returnJSON); // throws BadParamException
47 bool recinfo(PFMap& postFields, Json::Value& returnJSON); // throws BadParamException
48 bool recstop(PFMap& postFields, Json::Value& returnJSON); // throws BadParamException
49 bool recdel(PFMap& postFields, Json::Value& returnJSON); // throws BadParamException
50 bool recrename(PFMap& postFields, Json::Value& returnJSON); // throws BadParamException
51 bool recmove(PFMap& postFields, Json::Value& returnJSON); // throws BadParamException
52 bool timersetactive(PFMap& postFields, Json::Value& returnJSON); // throws BadParamException
53 bool timerdel(PFMap& postFields, Json::Value& returnJSON); // throws BadParamException
54 bool timerisrecording(PFMap& postFields, Json::Value& returnJSON); // throws BadParamException
55 bool recresetresume(PFMap& postFields, Json::Value& returnJSON); // throws BadParamException
56 bool timeredit(PFMap& postFields, Json::Value& returnJSON); // throws BadParamException
57 bool epgfilteradd(PFMap& postFields, Json::Value& returnJSON); // throws BadParamException
58 bool epgfilterdel(PFMap& postFields, Json::Value& js); // throws BadParamException
60 cTimer* findTimer(cTimers* Timers,
61 const char* rChannelID, const char* rName, const char* rStartTime, const char* rStopTime, const char* rWeekDays);
62 const cTimer* findTimer(const cTimers* Timers,
63 const char* rChannelID, const char* rName, const char* rStartTime, const char* rStopTime, const char* rWeekDays);
64 cTimer* findTimer2(cTimers* Timers,
65 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);
66 const cEvent* getEvent(const cChannels* Channels, const cSchedules* Schedules,
67 Json::Value& js, int channelNumber, int eventID, int aroundTime);
69 void pathsForRecordingName(const cRecordings* Recordings,
70 const std::string& recordingName,
71 std::string& dirNameSingleDate,
72 std::string& dirNameSingleTitle,
73 std::string& dirNameSingleFolder,
74 std::string& dirNameFullPathTitle,
75 std::string& dirNameFullPathDate); // throws int
77 int getVarInt(PFMap& postFields, const char* paramName); // THROWS
78 std::string getVarString(PFMap& postFields, const char* paramName); // THROWS
80 bool loadEpgFilter(libconfig::Config& epgFilter);
81 bool saveEpgFilter(libconfig::Config& epgFilter);
83 class BadParamException : public std::exception
87 BadParamException(const char* _param) { param = _param; }
89 virtual const char* what() const throw()