source: trunk/Modules/ZdechovNET/IPTVPage.pas

Last change on this file was 151, checked in by chronos, 9 months ago
File size: 14.6 KB
Line 
1unit IPTVPage;
2
3interface
4
5uses
6 Classes, SysUtils, FileUtil, WebPage, HTTPServer, ModuleUser,
7 Generics.Collections;
8
9type
10 TChannelGroup = (cpBasic, cpStandard, cpMax, cpFilm, cpSuperBox, cpDokument,
11 cpLaska, cpZpravodaj, cpDetske, cpSport, cpLeoTv, cpCesky);
12 TChannelGroups = set of TChannelGroup;
13
14 TChannel = class
15 Name: string;
16 Groups: TChannelGroups;
17 end;
18
19 { TChannels }
20
21 TChannels = class(TObjectList<TChannel>)
22 function AddNew(Name: string; Groups: TChannelGroups): TChannel;
23 function GetNamesByGroup(Group: TChannelGroup): string;
24 function GetCountByGroup(Group: TChannelGroup): Integer;
25 end;
26
27 { TIPTVPage }
28
29 TIPTVPage = class(TWebPage)
30 procedure DataModuleProduce(HandlerData: THTTPHandlerData);
31 private
32 function Row(Cells: array of string): string;
33 end;
34
35var
36 IPTVPage: TIPTVPage;
37
38
39implementation
40
41{$R *.lfm}
42
43uses
44 Core, HtmlClasses, WebSession;
45
46{ TChannels }
47
48function TChannels.AddNew(Name: string; Groups: TChannelGroups): TChannel;
49begin
50 Result := TChannel.Create;
51 Result.Name := Name;
52 Result.Groups := Groups;
53 Add(Result);
54end;
55
56function TChannels.GetNamesByGroup(Group: TChannelGroup): string;
57var
58 I: Integer;
59begin
60 Result := '';
61 for I := 0 to Count - 1 do begin
62 if Group in Items[I].Groups then begin
63 if Result <> '' then Result := Result + ', ';
64 Result := Result + Items[I].Name;
65 end;
66 end;
67end;
68
69function TChannels.GetCountByGroup(Group: TChannelGroup): Integer;
70var
71 I: Integer;
72begin
73 Result := 0;
74 for I := 0 to Count - 1 do begin
75 if Group in Items[I].Groups then begin
76 Inc(Result);
77 end;
78 end;
79end;
80
81{ TIPTVPage }
82
83procedure TIPTVPage.DataModuleProduce(HandlerData: THTTPHandlerData);
84var
85 Channels: TChannels;
86 ModuleUser: TModuleUser;
87begin
88 with TWebSession(HandlerData) do begin
89 ModuleUser := TModuleUser(ModuleManager.FindModuleByName('User'));
90 if Request.Path.Count > 1 then begin
91 PageNotFound;
92 Exit;
93 end;
94
95 ModuleUser.LoadUserInfo;
96 with HtmlDocument.Body, SubItems.AddString do begin
97 Channels := TChannels.Create;
98 with Channels do begin
99 AddNew('360TuneBox', [cpMax]);
100 AddNew('A11', [cpStandard, cpMax]);
101 AddNew('AMC HD', [cpStandard, cpMax]);
102 AddNew('Animal Planet HD', [cpStandard, cpMax, cpDokument]);
103 AddNew('Arena Sport 1 HD', [cpStandard, cpMax, cpSport]);
104 AddNew('Arena Sport 2 HD', [cpStandard, cpMax, cpSport]);
105 AddNew('ATV', [cpBasic, cpStandard, cpMax]);
106 AddNew('AXN', [cpStandard, cpMax, cpFilm]);
107 AddNew('AXN Black', [cpStandard, cpMax, cpFilm]);
108 AddNew('AXN White', [cpStandard, cpMax, cpFilm]);
109 AddNew('Baby TV', [cpStandard, cpMax, cpDetske]);
110 AddNew('BBC News', [cpMax, cpZpravodaj]);
111 AddNew('Brazzers TV Europe', [cpStandard, cpMax, cpLaska]);
112 AddNew('CNN', [cpStandard, cpMax]);
113 AddNew('CNN Prima News HD', [cpBasic, cpStandard, cpMax]);
114 AddNew('CS film/CS Horor', [cpStandard, cpMax, cpCesky]);
115 AddNew('CS History', [cpBasic, cpStandard, cpMax, cpCesky]);
116 AddNew('CS Mystery', [cpStandard, cpMax, cpCesky]);
117 AddNew('ČT :D HD/ Art HD', [cpBasic, cpStandard, cpMax]);
118 AddNew('ČT 1 HD', [cpBasic, cpStandard, cpMax]);
119 AddNew('ČT 1 JM HD', [cpBasic, cpStandard, cpMax]);
120 AddNew('ČT 1 JMC HD', [cpBasic, cpStandard, cpMax]);
121 AddNew('ČT 1 SM HD', [cpBasic, cpStandard, cpMax]);
122 AddNew('ČT 1 SMX HD', [cpBasic, cpStandard, cpMax]);
123 AddNew('ČT 2 HD', [cpBasic, cpStandard, cpMax]);
124 AddNew('ČT 3 HD', [cpBasic, cpStandard, cpMax]);
125 AddNew('ČT 24 HD', [cpBasic, cpStandard, cpMax]);
126 AddNew('ČT Sport HD', [cpBasic, cpStandard, cpMax]);
127 AddNew('Desire TV HD', [cpStandard, cpMax]);
128 AddNew('Discovery Channel HD', [cpStandard, cpMax, cpDokument]);
129 AddNew('Discovery Science HD', [cpMax, cpDokument]);
130 AddNew('Disney Channel', [cpStandard, cpMax, cpDetske]);
131 AddNew('Disney junior', [cpStandard, cpMax, cpDetske]);
132 AddNew('DocuBox HD', [cpMax]);
133 AddNew('DTX HD', [cpMax, cpDokument]);
134 AddNew('Dvojka HD', [cpBasic, cpStandard, cpMax]);
135 AddNew('DW TV HD', [cpStandard, cpMax, cpZpravodaj]);
136 AddNew('EroX HD', [cpMax, cpSuperBox, cpLaska]);
137 AddNew('EroXXX HD', [cpMax, cpSuperBox, cpLaska]);
138 AddNew('Euronews', [cpMax, cpZpravodaj]);
139 AddNew('Eurosport 1 HD', [cpStandard, cpMax, cpSport]);
140 AddNew('Eurosport 2 HD', [cpStandard, cpMax, cpSport]);
141 AddNew('Extasy TV HD', [cpLeoTv]);
142 AddNew('Fashion TV HD', [cpStandard, cpMax, cpZpravodaj]);
143 AddNew('FashionBox HD', [cpMax, cpSuperBox]);
144 AddNew('Fast&FunBox HD', [cpMax]);
145 AddNew('FightBox HD', [cpMax, cpSuperBox]);
146 AddNew('Film Europe HD', [cpStandard, cpMax, cpFilm]);
147 AddNew('Film Europe + HD', [cpMax, cpFilm, cpCesky]);
148 AddNew('Filmbox HD', [cpStandard, cpMax, cpSuperBox]);
149 AddNew('Filmbox Extra HD', [cpMax, cpSuperBox]);
150 AddNew('Filmbox Family', [cpMax, cpSuperBox]);
151 AddNew('Filmbox Stars HD', [cpMax, cpSuperBox]);
152 AddNew('Filmbox Premium HD', [cpMax, cpSuperBox]);
153 AddNew('Fishing & Hunting', [cpStandard, cpMax, cpDokument]);
154 AddNew('France 24 ENG', [cpMax, cpZpravodaj]);
155 AddNew('Golf Channel HD', [cpMax, cpSport]);
156 AddNew('Hobby TV HD', [cpBasic, cpStandard, cpMax]);
157 AddNew('iConcerts', [cpStandard, cpMax]);
158 AddNew('ID HD', [cpMax, cpDokument]);
159 AddNew('Jednotka HD', [cpBasic, cpStandard, cpMax]);
160 AddNew('Jihočeská televize', [cpBasic, cpStandard, cpMax]);
161 AddNew('JOJ Family HD', [cpBasic, cpStandard, cpMax]);
162 AddNew('JOJ Cinema HD', [cpStandard, cpMax, cpFilm]);
163 AddNew('Leo TV HD', [cpBasic, cpStandard, cpMax, cpLeoTv]);
164 AddNew('Leo TV GOLD HD', [cpLeoTv]);
165 AddNew('Markíza International HD', [cpStandard, cpMax]);
166 AddNew('Mezzo HD', [cpStandard, cpMax]);
167 AddNew('Minimax', [cpStandard, cpMax]);
168 AddNew('Mňam TV', [cpBasic, cpStandard, cpMax]);
169 AddNew('Mňau TV HD', [cpBasic, cpStandard, cpMax]);
170 AddNew('NASA TV HD', [cpBasic, cpStandard, cpMax]);
171 AddNew('National Geographic HD', [cpMax, cpDokument]);
172 AddNew('National Geographic Wild HD', [cpStandard, cpMax, cpDokument]);
173 AddNew('Nickelodeon', [cpStandard, cpMax, cpDetske]);
174 AddNew('Nickelodeon Jr.', [cpStandard, cpMax, cpDetske]);
175 AddNew('Nick. Ukraine Pluto TV', [cpStandard, cpMax, cpDetske]);
176 AddNew('Nova HD', [cpBasic, cpStandard, cpMax]);
177 AddNew('Nova Action HD', [cpBasic, cpStandard, cpMax]);
178 AddNew('Nova Cinema HD', [cpBasic, cpStandard, cpMax]);
179 AddNew('Nova Gold HD', [cpBasic, cpStandard, cpMax]);
180 AddNew('Nova Fun HD', [cpBasic, cpStandard, cpMax]);
181 AddNew('Nova Lady HD', [cpBasic, cpStandard, cpMax]);
182 AddNew('Nova Sport 1 HD', [cpMax, cpSport]);
183 AddNew('Nova Sport 2 HD', [cpStandard, cpMax, cpSport]);
184 AddNew('Óčko', [cpBasic, cpStandard, cpMax]);
185 AddNew('Óčko Star', [cpBasic, cpStandard, cpMax]);
186 AddNew('ORF1', [cpBasic, cpStandard, cpMax]);
187 AddNew('ORF2', [cpBasic, cpStandard, cpMax]);
188 AddNew('Paramount Network', [cpBasic, cpStandard, cpMax]);
189 AddNew('PassionXXX HD', [cpLeoTv]);
190 AddNew('Polar', [cpBasic, cpStandard, cpMax]);
191 AddNew('Polsat', [cpBasic, cpStandard, cpMax]);
192 AddNew('Praha TV', [cpBasic, cpStandard, cpMax]);
193 AddNew('Prima COOL HD', [cpBasic, cpStandard, cpMax]);
194 AddNew('Prima HD', [cpBasic, cpStandard, cpMax]);
195 AddNew('Prima Krimi HD', [cpBasic, cpStandard, cpMax]);
196 AddNew('Prima LOVE HD', [cpBasic, cpStandard, cpMax]);
197 AddNew('Prima MAX HD', [cpBasic, cpStandard, cpMax]);
198 AddNew('Prima Plus HD', [cpMax]);
199 AddNew('Prima Show HD', [cpBasic, cpStandard, cpMax]);
200 AddNew('Prima Star HD', [cpBasic, cpStandard, cpMax]);
201 AddNew('Prima ZOOM HD', [cpBasic, cpStandard, cpMax]);
202 AddNew('Reality Kings TV', [cpMax, cpLaska]);
203 AddNew('Regionální Televize TVS HD', [cpBasic, cpStandard, cpMax]);
204 AddNew('Relax', [cpBasic, cpStandard, cpMax]);
205 AddNew('Retro Music Television', [cpBasic, cpStandard, cpMax]);
206 AddNew('RTVS 24 HD', [cpBasic, cpStandard, cpMax]);
207 AddNew('RTVS Šport HD', [cpBasic, cpStandard, cpMax]);
208 AddNew('Seznam.cz TV HD', [cpBasic, cpStandard, cpMax]);
209 AddNew('Šlágr Muzika TV', [cpMax]);
210 AddNew('Šlágr Originál TV', [cpBasic, cpStandard, cpMax]);
211 AddNew('Spark TV HD', [cpStandard, cpMax]);
212 AddNew('Spektrum HD', [cpStandard, cpMax]);
213 AddNew('Spektrum Home HD', [cpBasic, cpStandard, cpMax]);
214 AddNew('Sport 1 HD', [cpStandard, cpMax]);
215 AddNew('Sport 5 HD', [cpMax, cpSport]);
216 AddNew('Sport 2 HD', [cpStandard, cpMax]);
217 AddNew('Super Polsat', [cpBasic, cpStandard, cpMax]);
218 AddNew('TA 3 HD', [cpBasic, cpStandard, cpMax]);
219 AddNew('TLC HD', [cpStandard, cpMax, cpDokument]);
220 AddNew('Travel Channel HD', [cpStandard, cpMax, cpDokument]);
221 AddNew('Travelxp HD', [cpStandard, cpMax, cpDokument]);
222 AddNew('Turbo TV HD', [cpStandard, cpMax, cpBasic]);
223 AddNew('TV Brno 1', [cpBasic, cpStandard, cpMax]);
224 AddNew('TV Lux', [cpBasic, cpStandard, cpMax]);
225 AddNew('TV Noe', [cpBasic, cpStandard, cpMax]);
226 AddNew('TV Puls', [cpBasic, cpStandard, cpMax]);
227 AddNew('TV Puls 2', [cpBasic, cpStandard, cpMax]);
228 AddNew('TV Rebel', [cpBasic, cpStandard, cpMax]);
229 AddNew('TV5 Monde', [cpMax, cpZpravodaj]);
230 AddNew('TVN', [cpBasic, cpStandard, cpMax]);
231 AddNew('TVN 7', [cpBasic, cpStandard, cpMax]);
232 AddNew('TVP Historia', [cpBasic, cpStandard, cpMax]);
233 AddNew('TVP 3 Katowice', [cpBasic, cpStandard, cpMax]);
234 AddNew('TVP Sport', [cpBasic, cpStandard, cpMax]);
235 AddNew('TVP1 HD', [cpBasic, cpStandard, cpMax]);
236 AddNew('TVP2 HD', [cpBasic, cpStandard, cpMax]);
237 AddNew('UA:Pershyi', [cpBasic, cpStandard, cpMax]);
238 AddNew('V1', [cpBasic, cpStandard, cpMax]);
239 AddNew('Viasat Explore HD', [cpStandard, cpMax, cpDokument]);
240 AddNew('Viasat History HD', [cpStandard, cpMax, cpDokument]);
241 AddNew('Viasat Nature HD', [cpStandard, cpMax, cpDokument]);
242 AddNew('ZAK TV', [cpBasic, cpStandard, cpMax]);
243 AddNew('ZDF', [cpBasic, cpStandard, cpMax]);
244 end;
245
246 Text := Text + '<h3>Výhody</h3>' +
247 '<ul>' +
248 '<li>velké množství televizních kanálů za nízkou cenu</li>' +
249 '<li>možnost si aktivovat službu a měnit balíčky po měsících bez několikaleté výpovědní lhůty</li>' +
250 '<li>zpětné přehrávání 7 dní nazpět (timeshift)</li>' +
251 '<li>možnost pozastavení přehrávání vysílání</li>' +
252 '<li>možnost záznamu pořadů</li>' +
253 '<li>televizi lze sledovat přes set-top box, Smart TV Samsung, LG a Android, tablet, smartphone nebo internetový prohlížeč</li>' +
254 '<li>lze spárovat až 4 zařízení na jeden účet</li>' +
255 '<li>vyzkoušení na měsíc zdarma</li>' +
256 '<li>převzaté vysílání zajišťuje společnost <a href="https://www.4net.tv">4NET.TV services s.r.o.</a></li>' +
257 '<li>pro provoz služby stačí i nejnižší internetový tarif Internet 20M za 190 Kč/měsíc</li>' +
258 '</ul><br/>' +
259
260 '<h3>Základní balíčky</h3>' +
261 '<table class="WideTable"><tr><th>Balíček</th><th>Cena [Kč/měsíc]</th><th>Počet kanálů</th><th>Kanály</th></tr>' +
262 Row(['Basic', '144', IntToStr(Channels.GetCountByGroup(cpBasic)), Channels.GetNamesByGroup(cpBasic)]) +
263 Row(['Basic + tématika', '157', IntToStr(Channels.GetCountByGroup(cpBasic)), Channels.GetNamesByGroup(cpBasic)]) +
264 Row(['Standard', '460', IntToStr(Channels.GetCountByGroup(cpStandard)), Channels.GetNamesByGroup(cpStandard)]) +
265 Row(['Max', '624', IntToStr(Channels.GetCountByGroup(cpMax)), Channels.GetNamesByGroup(cpMax)]) +
266 '</table>' +
267 'Balíček Basic obsahuje stejné kanály jako Basic + tématika. Pro možnost volby tématických balíčků je ale nutné mít balíček Basic + tématika.<br/>' +
268
269 '<h3>Tématické balíčky</h3>' +
270 '<table class="WideTable"><tr><th>Balíček</th><th>Cena [Kč/měsíc]</th><th>Počet kanálů</th><th>Kanály</th></tr>' +
271 Row(['Film', '53', IntToStr(Channels.GetCountByGroup(cpFilm)), Channels.GetNamesByGroup(cpFilm)]) +
272 Row(['Superbox', '158', IntToStr(Channels.GetCountByGroup(cpSuperBox)), Channels.GetNamesByGroup(cpSuperBox)]) +
273 Row(['Sport', '146', IntToStr(Channels.GetCountByGroup(cpSport)), Channels.GetNamesByGroup(cpSport)]) +
274 Row(['Dětské', '40', IntToStr(Channels.GetCountByGroup(cpDetske)), Channels.GetNamesByGroup(cpDetske)]) +
275 Row(['Česky', '45', IntToStr(Channels.GetCountByGroup(cpCesky)), Channels.GetNamesByGroup(cpCesky)]) +
276 Row(['Láska', '60', IntToStr(Channels.GetCountByGroup(cpLaska)), Channels.GetNamesByGroup(cpLaska)]) +
277 Row(['Zpravodaj', '19', IntToStr(Channels.GetCountByGroup(cpZpravodaj)), Channels.GetNamesByGroup(cpZpravodaj)]) +
278 Row(['Dokument', '136', IntToStr(Channels.GetCountByGroup(cpDokument)), Channels.GetNamesByGroup(cpDokument)]) +
279 Row(['Leo TV', '49', IntToStr(Channels.GetCountByGroup(cpLeoTv)), Channels.GetNamesByGroup(cpLeoTv)]) +
280 '</table>' +
281 'Celková cena vznikne jako součet zvolených tématických balíčků a základního balíčku Basic + tématika.<br/>' +
282
283 //'<h3>Programová nabídka</h3>' +
284 //'<table class="WideTable"><tr><th>Kanál</th><th>Basic</th><th>Basic+</th><th>Standard</th><th>Maxi</th><th>Second screen</th><th>PVR</th></tr>';
285
286 //Text := Text + '</table>Second Screen - možnost přehrávat v internetovém prohlížeči, tabletu, smartphone či Smart TV.</br/>' +
287 //'PVR - možnost záznamu pořadu na 1 měsíc.</br/>' +
288 '<h3>Zřízení služby</h3>' +
289 'Instalace a aktivace: zdarma<br/>' +
290 'Cena set-top boxu: 2000 Kč<br/>' +
291 'Webové rozhraní pro TV: <a href="https://live.4network.tv/">live.4network.tv</a><br/>' +
292 'Návod ke služby 4network.tv: <a href="/docs/navod_4network.tv.pdf">navod_4network.tv.pdf</a><br/>' +
293 '<br/>' +
294 'Ceny uvedeny včetně DPH platné od 1.1.2024.';
295 Channels.Free;
296 end;
297 GeneratePage(Self);
298 end;
299end;
300
301function TIPTVPage.Row(Cells: array of string): string;
302var
303 I: Integer;
304begin
305 Result := '';
306 for I := 0 to Length(Cells) - 1 do
307 Result := Result + '<td>' + Cells[I] + '</td>';
308 Result := '<tr>' + Result + '</tr>';
309end;
310
311end.
312
Note: See TracBrowser for help on using the repository browser.