File: services.h

package info (click to toggle)
vdr-plugin-epgsearch 2.4.0%2Bgit20191101-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye
  • size: 2,992 kB
  • sloc: ansic: 22,373; perl: 1,330; sh: 630; makefile: 226
file content (202 lines) | stat: -rw-r--r-- 7,289 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
/*                                                                  -*- c++ -*-
Copyright (C) 2004-2013 Christian Wieninger

This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Or, point your browser to http://www.gnu.org/licenses/old-licenses/gpl-2.0.html

The author can be reached at cwieninger@gmx.de

The project's page is at http://winni.vdr-developer.org/epgsearch
*/

#ifndef EPGSEARCHSERVICES_INC
#define EPGSEARCHSERVICES_INC

#include <string>
#include <list>
#include <memory>
#include <set>
#include <vdr/osdbase.h>

// Data structure for service "Epgsearch-search-v1.0"
struct Epgsearch_search_v1_0 {
// in
    char* query;               // search term
    int mode;                  // search mode (0=phrase, 1=and, 2=or, 3=regular expression)
    int channelNr;             // channel number to search in (0=any)
    bool useTitle;             // search in title
    bool useSubTitle;          // search in subtitle
    bool useDescription;       // search in description
// out
    cOsdMenu* pResultMenu;   // pointer to the menu of results
};

// Data structure for service "Epgsearch-exttimeredit-v1.0"
struct Epgsearch_exttimeredit_v1_0 {
// in
    cTimer* timer;             // pointer to the timer to edit
    bool bNew;                 // flag that indicates, if this is a new timer or an existing one
    const cEvent* event;             // pointer to the event corresponding to this timer (may be NULL)
// out
    cOsdMenu* pTimerMenu;   // pointer to the menu of results
};

// Data structure for service "Epgsearch-enablesearchtimers-v1.0"
struct Epgsearch_enablesearchtimers_v1_0 {
// in
    bool enable;           // enable search timer thread?
};

// Data structure for service "Epgsearch-updatesearchtimers-v1.0"
struct Epgsearch_updatesearchtimers_v1_0 {
// in
    bool showMessage;           // inform via osd when finished?
};

// Data structure for service "Epgsearch-osdmessage-v1.0"
struct Epgsearch_osdmessage_v1_0 {
// in
    char* message;             // the message to display
    eMessageType type;
};

// Data structure for service "EpgsearchMenu-v1.0"
struct EpgSearchMenu_v1_0 {
// in
// out
    cOsdMenu* Menu;   // pointer to the menu
};

// Data structure for service "Epgsearch-lastconflictinfo-v1.0"
struct Epgsearch_lastconflictinfo_v1_0 {
// in
// out
    time_t nextConflict;       // next conflict date, 0 if none
    int relevantConflicts;     // number of relevant conflicts
    int totalConflicts;        // total number of conflicts
};

// Data structure for service "Epgsearch-searchresults-v1.0"
struct Epgsearch_searchresults_v1_0 {
// in
    char* query;               // search term
    int mode;                  // search mode (0=phrase, 1=and, 2=or, 3=regular expression)
    int channelNr;             // channel number to search in (0=any)
    bool useTitle;             // search in title
    bool useSubTitle;          // search in subtitle
    bool useDescription;       // search in description
// out

    class cServiceSearchResult : public cListObject
    {
    public:
        const cEvent* event;
        cServiceSearchResult(const cEvent* Event) : event(Event) {}
    };

    cList<cServiceSearchResult>* pResultList;   // pointer to the results
};

// Data structure for service "Epgsearch-switchtimer-v1.0"
struct Epgsearch_switchtimer_v1_0 {
// in
    const cEvent* event;
    int mode;                  // mode (0=query existence, 1=add/modify, 2=delete)
// in/out
    int switchMinsBefore;
    int announceOnly;
// out
    bool success;              // result
};

// Data structures for service "Epgsearch-services-v1.0"
class cServiceHandler
{
public:
    virtual std::list<std::string> SearchTimerList() = 0;
    // returns a list of search timer entries in the same format as used in epgsearch.conf
    virtual int AddSearchTimer(const std::string&) = 0;
    // adds a new search timer and returns its ID (-1 on error)
    virtual bool ModSearchTimer(const std::string&) = 0;
    // edits an existing search timer and returns success
    virtual bool DelSearchTimer(int) = 0;
    // deletes search timer with given ID and returns success
    virtual std::list<std::string> QuerySearchTimer(int) = 0;
    // returns the search result of the searchtimer with given ID in the same format as used in SVDRP command 'QRYS' (->MANUAL)
    virtual std::list<std::string> QuerySearch(std::string) = 0;
    // returns the search result of the searchtimer with given settings in the same format as used in SVDRP command 'QRYS' (->MANUAL)
    virtual std::list<std::string> ExtEPGInfoList() = 0;
    // returns a list of extended EPG categories in the same format as used in epgsearchcats.conf
    virtual std::list<std::string> ChanGrpList() = 0;
    // returns a list of channel groups maintained by epgsearch
    virtual std::list<std::string> BlackList() = 0;
    // returns a list of blacklists in the same format as used in epgsearchblacklists.conf
    virtual std::set<std::string> DirectoryList() = 0;
    // List of all recording directories used in recordings, timers, search timers or in epgsearchdirs.conf
    virtual ~cServiceHandler() {}
    // Read a setup value
    virtual std::string ReadSetupValue(const std::string& entry) = 0;
    // Write a setup value
    virtual bool WriteSetupValue(const std::string& entry, const std::string& value) = 0;
};

struct Epgsearch_services_v1_0 {
// in/out
#if __cplusplus < 201103L
    std::auto_ptr<cServiceHandler> handler;
#else
    std::unique_ptr<cServiceHandler> handler;
#endif
};

// Data structures for service "Epgsearch-services-v1.1"
class cServiceHandler_v1_1 : public cServiceHandler
{
public:
    // Get timer conflicts
    virtual std::list<std::string> TimerConflictList(bool relOnly = false) = 0;
    // Check if a conflict check is advised
    virtual bool IsConflictCheckAdvised() = 0;
};

struct Epgsearch_services_v1_1 {
// in/out
#if __cplusplus < 201103L
    std::auto_ptr<cServiceHandler_v1_1> handler;
#else
    std::unique_ptr<cServiceHandler_v1_1> handler;
#endif
};

// Data structures for service "Epgsearch-services-v1.2"
class cServiceHandler_v1_2 : public cServiceHandler_v1_1
{
public:
    // List of all recording directories used in recordings, timers (and optionally search timers or in epgsearchdirs.conf)
    virtual std::set<std::string> ShortDirectoryList() = 0;
    // Evaluate an expression against an event
    virtual std::string Evaluate(const std::string& expr, const cEvent* event) = 0;
};

struct Epgsearch_services_v1_2 {
// in/out
#if __cplusplus < 201103L
    std::auto_ptr<cServiceHandler_v1_2> handler;
#else
    std::unique_ptr<cServiceHandler_v1_2> handler;
#endif
};

#endif