1 module openwebif.api;
2 
3 ///
4 struct Movie {
5 	string fullname;
6 	string eventname;
7 	string filename;
8 	string filename_stripped;
9 	string description;
10 	string descriptionExtended;
11 	string tags;
12 	long filesize;
13 	string length;
14 	string servicename;
15 	string begintime;
16 	string serviceref;
17 	long lastseen;
18 	long recordingtime;
19 }
20 
21 ///
22 struct MovieList
23 {
24 	string directory;
25 	Movie[] movies;
26 	string[] bookmarks;
27 }
28 
29 ///
30 struct Subservice
31 {
32 	string servicereference;
33 	string servicename;
34 }
35 
36 ///
37 struct Service
38 {
39 	string servicereference;
40 	string servicename;
41 	Subservice[] subservices;
42 }
43 
44 ///
45 struct ServicesList
46 {
47 	bool result;
48 	Service[] services;
49 }
50 
51 ///
52 struct CurrentServiceInfo
53 {
54 	string name;
55 }
56 struct CurrentServiceEPG
57 {
58 	string sname;
59 	string title;
60 	long begin_timestamp;
61 	long now_timestamp;
62 	string shortdesc;
63 	string longdesc;
64 }
65 
66 ///
67 struct CurrentService
68 {
69 	CurrentServiceInfo info;	
70 	CurrentServiceEPG now;
71 	CurrentServiceEPG next;
72 }
73 
74 ///
75 struct Zap
76 {
77 	string message;
78 	bool result;
79 }
80 
81 ///
82 struct Vol
83 {
84 	int current;
85 	string message;
86 	bool result;
87 	bool ismute;
88 }
89 
90 ///
91 struct Timer 
92 {
93 	string servicename;
94 	string name;
95 	string realbegin;
96 	string realend;
97 }
98 
99 ///
100 struct TimerList
101 {
102 	Timer[] timers;
103 	bool result;
104 	string[] locations;
105 }
106 
107 ///
108 struct SleepTimer
109 {
110 	string action;
111 	int minutes;
112 	string message;
113 	bool enabled;
114 }
115 
116 ///
117 struct RecordNow
118 {
119 	string message;
120 	bool result;
121 }
122 
123 ///
124 struct PowerState
125 {
126 	bool instandby;
127 	bool result;
128 }
129 
130 ///
131 interface OpenWebifApi {
132 
133 	import vibe.web.rest:method;
134 	import vibe.http.common:HTTPMethod;
135 	import vibe.data.json;
136 
137 	///
138 	MovieList movielist();
139 	///
140 	ServicesList getallservices();
141 	///
142 	CurrentService getcurrent();
143 	///
144 	TimerList timerlist();
145 	///
146 	@method(HTTPMethod.GET)
147 	Zap zap(string sRef);
148 	/// vol expects a string containing up (increase by 5), down (decrease by 5), set<int> (set100) or mute for toogle mute state
149 	@method(HTTPMethod.GET)
150 	Vol vol(string set);
151 	///
152 	Vol vol();
153 	/// sleeptimer expects cmd=set|get action=standby|shutdown time=minutes 1-999 enabled=True|False
154 	@method(HTTPMethod.GET)
155 	SleepTimer sleeptimer(string cmd, string action, int time, string enabled);
156 	///
157 	@method(HTTPMethod.GET)
158 	RecordNow recordnow();
159 	/// powerstate expects 0 for toggle standby, 1 for deep stanbdy, 2 reboot box, 3 restart gui */
160 	@method(HTTPMethod.GET)
161 	PowerState powerstate(int newstate);
162 	///
163 	Json message(string text, int type, int timeout);
164 }