|
| 1 | +/* |
| 2 | +Copyright (C) 2004-2008 Christian Wieninger |
| 3 | +
|
| 4 | +This program is free software; you can redistribute it and/or |
| 5 | +modify it under the terms of the GNU General Public License |
| 6 | +as published by the Free Software Foundation; either version 2 |
| 7 | +of the License, or (at your option) any later version. |
| 8 | +
|
| 9 | +This program is distributed in the hope that it will be useful, |
| 10 | +but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 11 | +MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 12 | +GNU General Public License for more details. |
| 13 | +
|
| 14 | +You should have received a copy of the GNU General Public License |
| 15 | +along with this program; if not, write to the Free Software |
| 16 | +Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA |
| 17 | +Or, point your browser to http://www.gnu.org/licenses/old-licenses/gpl-2.0.html |
| 18 | +
|
| 19 | +The author can be reached at [email protected] |
| 20 | +
|
| 21 | +The project's page is at http://winni.vdr-developer.org/epgsearch |
| 22 | +*/ |
| 23 | + |
| 24 | +#ifndef EPGSEARCHSERVICES_INC |
| 25 | +#define EPGSEARCHSERVICES_INC |
| 26 | + |
| 27 | +#include <string> |
| 28 | +#include <list> |
| 29 | +#include <memory> |
| 30 | +#include <set> |
| 31 | +#include <vdr/osdbase.h> |
| 32 | + |
| 33 | +// Data structure for service "Epgsearch-search-v1.0" |
| 34 | +struct Epgsearch_search_v1_0 |
| 35 | +{ |
| 36 | +// in |
| 37 | + char* query; // search term |
| 38 | + int mode; // search mode (0=phrase, 1=and, 2=or, 3=regular expression) |
| 39 | + int channelNr; // channel number to search in (0=any) |
| 40 | + bool useTitle; // search in title |
| 41 | + bool useSubTitle; // search in subtitle |
| 42 | + bool useDescription; // search in description |
| 43 | +// out |
| 44 | + cOsdMenu* pResultMenu; // pointer to the menu of results |
| 45 | +}; |
| 46 | + |
| 47 | +// Data structure for service "Epgsearch-exttimeredit-v1.0" |
| 48 | +struct Epgsearch_exttimeredit_v1_0 |
| 49 | +{ |
| 50 | +// in |
| 51 | + cTimer* timer; // pointer to the timer to edit |
| 52 | + bool bNew; // flag that indicates, if this is a new timer or an existing one |
| 53 | + const cEvent* event; // pointer to the event corresponding to this timer (may be NULL) |
| 54 | +// out |
| 55 | + cOsdMenu* pTimerMenu; // pointer to the menu of results |
| 56 | +}; |
| 57 | + |
| 58 | +// Data structure for service "Epgsearch-updatesearchtimers-v1.0" |
| 59 | +struct Epgsearch_updatesearchtimers_v1_0 |
| 60 | +{ |
| 61 | +// in |
| 62 | + bool showMessage; // inform via osd when finished? |
| 63 | +}; |
| 64 | + |
| 65 | +// Data structure for service "Epgsearch-osdmessage-v1.0" |
| 66 | +struct Epgsearch_osdmessage_v1_0 |
| 67 | +{ |
| 68 | +// in |
| 69 | + char* message; // the message to display |
| 70 | + eMessageType type; |
| 71 | +}; |
| 72 | + |
| 73 | +// Data structure for service "EpgsearchMenu-v1.0" |
| 74 | +struct EpgSearchMenu_v1_0 |
| 75 | +{ |
| 76 | +// in |
| 77 | +// out |
| 78 | + cOsdMenu* Menu; // pointer to the menu |
| 79 | +}; |
| 80 | + |
| 81 | +// Data structure for service "Epgsearch-lastconflictinfo-v1.0" |
| 82 | +struct Epgsearch_lastconflictinfo_v1_0 |
| 83 | +{ |
| 84 | +// in |
| 85 | +// out |
| 86 | + time_t nextConflict; // next conflict date, 0 if none |
| 87 | + int relevantConflicts; // number of relevant conflicts |
| 88 | + int totalConflicts; // total number of conflicts |
| 89 | +}; |
| 90 | + |
| 91 | +// Data structure for service "Epgsearch-searchresults-v1.0" |
| 92 | +struct Epgsearch_searchresults_v1_0 |
| 93 | +{ |
| 94 | +// in |
| 95 | + char* query; // search term |
| 96 | + int mode; // search mode (0=phrase, 1=and, 2=or, 3=regular expression) |
| 97 | + int channelNr; // channel number to search in (0=any) |
| 98 | + bool useTitle; // search in title |
| 99 | + bool useSubTitle; // search in subtitle |
| 100 | + bool useDescription; // search in description |
| 101 | +// out |
| 102 | + |
| 103 | + class cServiceSearchResult : public cListObject |
| 104 | + { |
| 105 | + public: |
| 106 | + const cEvent* event; |
| 107 | + cServiceSearchResult(const cEvent* Event) : event(Event) {} |
| 108 | + }; |
| 109 | + |
| 110 | + cList<cServiceSearchResult>* pResultList; // pointer to the results |
| 111 | +}; |
| 112 | + |
| 113 | +// Data structure for service "Epgsearch-switchtimer-v1.0" |
| 114 | +struct Epgsearch_switchtimer_v1_0 |
| 115 | +{ |
| 116 | +// in |
| 117 | + const cEvent* event; |
| 118 | + int mode; // mode (0=query existance, 1=add/modify, 2=delete) |
| 119 | +// in/out |
| 120 | + int switchMinsBefore; |
| 121 | + int announceOnly; |
| 122 | +// out |
| 123 | + bool success; // result |
| 124 | +}; |
| 125 | + |
| 126 | +// Data structures for service "Epgsearch-services-v1.0" |
| 127 | +class cServiceHandler |
| 128 | +{ |
| 129 | + public: |
| 130 | + virtual std::list<std::string> SearchTimerList() = 0; |
| 131 | + // returns a list of search timer entries in the same format as used in epgsearch.conf |
| 132 | + virtual int AddSearchTimer(const std::string&) = 0; |
| 133 | + // adds a new search timer and returns its ID (-1 on error) |
| 134 | + virtual bool ModSearchTimer(const std::string&) = 0; |
| 135 | + // edits an existing search timer and returns success |
| 136 | + virtual bool DelSearchTimer(int) = 0; |
| 137 | + // deletes search timer with given ID and returns success |
| 138 | + virtual std::list<std::string> QuerySearchTimer(int) = 0; |
| 139 | + // returns the search result of the searchtimer with given ID in the same format as used in SVDRP command 'QRYS' (->MANUAL) |
| 140 | + virtual std::list<std::string> QuerySearch(std::string) = 0; |
| 141 | + // returns the search result of the searchtimer with given settings in the same format as used in SVDRP command 'QRYS' (->MANUAL) |
| 142 | + virtual std::list<std::string> ExtEPGInfoList() = 0; |
| 143 | + // returns a list of extended EPG categories in the same format as used in epgsearchcats.conf |
| 144 | + virtual std::list<std::string> ChanGrpList() = 0; |
| 145 | + // returns a list of channel groups maintained by epgsearch |
| 146 | + virtual std::list<std::string> BlackList() = 0; |
| 147 | + // returns a list of blacklists in the same format as used in epgsearchblacklists.conf |
| 148 | + virtual std::set<std::string> DirectoryList() = 0; |
| 149 | + // List of all recording directories used in recordings, timers, search timers or in epgsearchdirs.conf |
| 150 | + virtual ~cServiceHandler() {} |
| 151 | + // Read a setup value |
| 152 | + virtual std::string ReadSetupValue(const std::string& entry) = 0; |
| 153 | + // Write a setup value |
| 154 | + virtual bool WriteSetupValue(const std::string& entry, const std::string& value) = 0; |
| 155 | +}; |
| 156 | + |
| 157 | +struct Epgsearch_services_v1_0 |
| 158 | +{ |
| 159 | +// in/out |
| 160 | + std::auto_ptr<cServiceHandler> handler; |
| 161 | +}; |
| 162 | + |
| 163 | +// Data structures for service "Epgsearch-services-v1.1" |
| 164 | +class cServiceHandler_v1_1 : public cServiceHandler |
| 165 | +{ |
| 166 | + public: |
| 167 | + // Get timer conflicts |
| 168 | + virtual std::list<std::string> TimerConflictList(bool relOnly=false) = 0; |
| 169 | + // Check if a conflict check is advised |
| 170 | + virtual bool IsConflictCheckAdvised() = 0; |
| 171 | +}; |
| 172 | + |
| 173 | +struct Epgsearch_services_v1_1 |
| 174 | +{ |
| 175 | +// in/out |
| 176 | + std::auto_ptr<cServiceHandler_v1_1> handler; |
| 177 | +}; |
| 178 | + |
| 179 | +// Data structures for service "Epgsearch-services-v1.2" |
| 180 | +class cServiceHandler_v1_2 : public cServiceHandler_v1_1 |
| 181 | +{ |
| 182 | + public: |
| 183 | + // List of all recording directories used in recordings, timers (and optionally search timers or in epgsearchdirs.conf) |
| 184 | + virtual std::set<std::string> ShortDirectoryList() = 0; |
| 185 | + // Evaluate an expression against an event |
| 186 | + virtual std::string Evaluate(const std::string& expr, const cEvent* event) = 0; |
| 187 | +}; |
| 188 | + |
| 189 | +struct Epgsearch_services_v1_2 |
| 190 | +{ |
| 191 | +// in/out |
| 192 | + std::auto_ptr<cServiceHandler_v1_2> handler; |
| 193 | +}; |
| 194 | + |
| 195 | +#endif |
0 commit comments