root/trunk/install/php/listreserve.php

リビジョン 51, 10.5 kB (コミッタ: sorshi, コミット時期: 17 年 前)

予約一覧でのチューナー重複検出機能を追加

Line 
1 <?php
2 /*
3  Anime recording system foltia
4  http://www.dcc-jpl.com/soft/foltia/
5
6 listreserve.php
7
8 目的
9 録画予約番組放映予定と予約番組名を表示します。
10
11 引数
12 r:録画デバイス数
13
14  DCC-JPL Japan/foltia project
15
16 */
17 ?>
18 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
19 <html lang="ja">
20 <head>
21 <meta http-equiv="Content-Type" content="text/html; charset=EUC-JP">
22 <meta http-equiv="Content-Style-Type" content="text/css">
23 <link rel="stylesheet" type="text/css" href="graytable.css">
24 <title>foltia:record plan</title>
25 </head>
26
27 <?php
28
29   include("./foltialib.php");
30
31 $con = m_connect();
32
33 $now = date("YmdHi");   
34
35     $query = "
36 SELECT
37 foltia_program .tid,
38 stationname,
39 foltia_program .title,
40 foltia_subtitle.countno,
41 foltia_subtitle.subtitle,
42 foltia_subtitle.startdatetime ,
43 foltia_subtitle.lengthmin ,
44 foltia_tvrecord.bitrate  ,
45 foltia_subtitle.startoffset ,
46 foltia_subtitle.pid 
47 FROM foltia_subtitle , foltia_program ,foltia_station ,foltia_tvrecord
48 WHERE foltia_tvrecord.tid = foltia_program.tid AND foltia_tvrecord.stationid = foltia_station .stationid AND foltia_program.tid = foltia_subtitle.tid AND foltia_station.stationid = foltia_subtitle.stationid
49 AND foltia_subtitle.enddatetime >= '$now'
50 UNION
51 SELECT
52 foltia_program .tid,
53 stationname,
54 foltia_program .title,
55 foltia_subtitle.countno,
56 foltia_subtitle.subtitle,
57 foltia_subtitle.startdatetime ,
58 foltia_subtitle.lengthmin ,
59 foltia_tvrecord.bitrate ,
60 foltia_subtitle.startoffset ,
61 foltia_subtitle.pid 
62 FROM foltia_tvrecord
63 LEFT OUTER JOIN foltia_subtitle on (foltia_tvrecord.tid = foltia_subtitle.tid )
64 LEFT OUTER JOIN foltia_program on (foltia_tvrecord.tid = foltia_program.tid )
65 LEFT OUTER JOIN foltia_station on (foltia_subtitle.stationid = foltia_station.stationid )
66 WHERE foltia_tvrecord.stationid = 0 AND
67 foltia_subtitle.enddatetime >= '$now' ORDER BY \"startdatetime\" ASC
68     ";
69
70     $rs = m_query($con, $query, "DBクエリに失敗しました");
71     $maxrows = pg_num_rows($rs);
72             
73
74 //チューナー数
75 if ($recunits > 1){
76 }else{
77 if (getgetnumform(r) != ""){
78     $recunits = getgetnumform(r);
79     }else{
80     $recunits = 2;
81 }
82 }
83 ?>
84
85 <body BGCOLOR="#ffffff" TEXT="#494949" LINK="#0047ff" VLINK="#000000" ALINK="#c6edff" >
86 <div align="center">
87 <?php
88 printhtmlpageheader();
89 ?>
90   <p align="left"><font color="#494949" size="6">予約一覧</font></p>
91   <hr size="4">
92 <p align="left">録画予約番組放映予定と予約番組名を表示します。</p>
93
94 <?
95     if ($maxrows == 0) {
96         print "番組データがありません<BR>\n";           
97         }else{
98
99
100         /* フィールド数 */
101         $maxcols = pg_num_fields($rs);
102         ?>
103   <table BORDER="0" CELLPADDING="0" CELLSPACING="2" WIDTH="100%">
104     <thead>
105         <tr>
106             <th align="left">TID</th>
107             <th align="left">放映局</th>
108             <th align="left">タイトル</th>
109             <th align="left">話数</th>
110             <th align="left">サブタイトル</th>
111             <th align="left">開始時刻</th>
112             <th align="left">総尺</th>
113             <th align="left">画質</th>
114
115         </tr>
116     </thead>
117
118     <tbody>
119         <?php
120             /* テーブルのデータを出力 */
121             for ($row = 0; $row < $maxrows; $row++) { /* 行に対応 */
122                 echo("<tr>\n");
123                 /* pg_fetch_row で一行取り出す */
124                 $rowdata = pg_fetch_row($rs, $row);
125 $pid = htmlspecialchars($rowdata[9]);
126
127 $tid = htmlspecialchars($rowdata[0]);
128 $title = htmlspecialchars($rowdata[2]);
129 $subtitle htmlspecialchars($rowdata[4]);
130 //重複検出
131 //開始時刻 $rowdata[5]
132 //終了時刻
133 $endtime = calcendtime($rowdata[5],$rowdata[6]);
134 //番組の開始時刻より遅い時刻に終了し、終了時刻より前にはじまる番組があるかどうか
135 //オンボードチューナー録画
136 $query = "
137 SELECT
138 foltia_program .tid,
139 stationname,
140 foltia_program .title,
141 foltia_subtitle.countno,
142 foltia_subtitle.subtitle,
143 foltia_subtitle.startdatetime ,
144 foltia_subtitle.lengthmin ,
145 foltia_tvrecord.bitrate  ,
146 foltia_subtitle.startoffset ,
147 foltia_subtitle.pid 
148 FROM foltia_subtitle , foltia_program ,foltia_station ,foltia_tvrecord
149 WHERE foltia_tvrecord.tid = foltia_program.tid AND foltia_tvrecord.stationid = foltia_station .stationid AND foltia_program.tid = foltia_subtitle.tid AND foltia_station.stationid = foltia_subtitle.stationid
150 AND foltia_subtitle.enddatetime >= '$rowdata[5]'
151 AND foltia_subtitle.startdatetime <= '$endtime' 
152 UNION
153 SELECT
154 foltia_program .tid,
155 stationname,
156 foltia_program .title,
157 foltia_subtitle.countno,
158 foltia_subtitle.subtitle,
159 foltia_subtitle.startdatetime ,
160 foltia_subtitle.lengthmin ,
161 foltia_tvrecord.bitrate  ,
162 foltia_subtitle.startoffset ,
163 foltia_subtitle.pid 
164 FROM foltia_tvrecord
165 LEFT OUTER JOIN foltia_subtitle on (foltia_tvrecord.tid = foltia_subtitle.tid )
166 LEFT OUTER JOIN foltia_program on (foltia_tvrecord.tid = foltia_program.tid )
167 LEFT OUTER JOIN foltia_station on (foltia_subtitle.stationid = foltia_station.stationid )
168 WHERE foltia_tvrecord.stationid = 0 AND
169 foltia_subtitle.enddatetime >= '$rowdata[5]' 
170 AND foltia_subtitle.startdatetime <= '$endtime' 
171     ";
172     $rclass = "";
173     $overlap = m_query($con, $query, "DBクエリに失敗しました");
174     $overlapmaxrows = pg_num_rows($overlap);
175     if ($overlapmaxrows > ($recunits) ){
176         for ($rrow = 0; $rrow < $overlapmaxrows ; $rrow++) {
177             $owrowdata = pg_fetch_row($overlap, $rrow);
178             $overlappid[] = $owrowdata[9];
179         }
180     if (in_array($rowdata[9], $overlappid)) {
181         $rclass = "overwraped";
182     }
183     }else{
184     $overlappid = "";
185     }//end if
186
187 //外部チューナー録画
188 $externalinputs = 1; //現状一系統のみ
189 $query = "
190 SELECT
191 foltia_program .tid,
192 stationname,
193 foltia_program .title,
194 foltia_subtitle.countno,
195 foltia_subtitle.subtitle,
196 foltia_subtitle.startdatetime ,
197 foltia_subtitle.lengthmin ,
198 foltia_tvrecord.bitrate  ,
199 foltia_subtitle.startoffset ,
200 foltia_subtitle.pid 
201 FROM foltia_subtitle , foltia_program ,foltia_station ,foltia_tvrecord
202 WHERE foltia_tvrecord.tid = foltia_program.tid AND foltia_tvrecord.stationid = foltia_station .stationid AND foltia_program.tid = foltia_subtitle.tid AND foltia_station.stationid = foltia_subtitle.stationid
203 AND foltia_subtitle.enddatetime > '$rowdata[5]'
204 AND foltia_subtitle.startdatetime < '$endtime' 
205 AND  (foltia_station.stationrecch = '0' OR  foltia_station.stationrecch = '-1' )
206 UNION
207 SELECT
208 foltia_program .tid,
209 stationname,
210 foltia_program .title,
211 foltia_subtitle.countno,
212 foltia_subtitle.subtitle,
213 foltia_subtitle.startdatetime ,
214 foltia_subtitle.lengthmin ,
215 foltia_tvrecord.bitrate  ,
216 foltia_subtitle.startoffset ,
217 foltia_subtitle.pid 
218 FROM foltia_tvrecord
219 LEFT OUTER JOIN foltia_subtitle on (foltia_tvrecord.tid = foltia_subtitle.tid )
220 LEFT OUTER JOIN foltia_program on (foltia_tvrecord.tid = foltia_program.tid )
221 LEFT OUTER JOIN foltia_station on (foltia_subtitle.stationid = foltia_station.stationid )
222 WHERE foltia_tvrecord.stationid = 0 AND
223 foltia_subtitle.enddatetime > '$rowdata[5]' 
224 AND foltia_subtitle.startdatetime < '$endtime' 
225 AND  (foltia_station.stationrecch = '0' OR  foltia_station.stationrecch = '-1' )
226
227     ";
228     $eoverlap = m_query($con, $query, "DBクエリに失敗しました");
229     $eoverlapmaxrows = pg_num_rows($eoverlap);
230     if ($eoverlapmaxrows > ($externalinputs) ){
231         for ($erow = 0; $erow < $eoverlapmaxrows ; $erow++) {
232             $eowrowdata = pg_fetch_row($eoverlap, $erow);
233             $eoverlappid[] = $eowrowdata[9];
234         }
235
236         if (in_array($rowdata[9], $eoverlappid)) {
237             $rclass = "exoverwraped";
238         }
239     }else{
240     $eoverlappid = "";
241     }
242                 echo("<tr class=\"$rclass\">\n");
243                     // TID
244                     print "<td>";
245                     if ($tid == 0 ){
246                     print "$tid";
247                     }else{
248                     print "<a href=\"reserveprogram.php?tid=$tid\">$tid</a>";
249                     }
250                     print "</td>\n";
251                      // 放映局
252                      echo("<td>".htmlspecialchars($rowdata[1])."<br></td>\n");
253                      // タイトル
254                     print "<td>";
255                     if ($tid == 0 ){
256                     print "$title";
257                     }else{
258                     print "<a href=\"http://cal.syoboi.jp/tid/$tid\" target=\"_blank\">$title</a>";
259                     }
260                     print "</td>\n";
261                      // 話数
262                     echo("<td>".htmlspecialchars($rowdata[3])."<br></td>\n");
263                     // サブタイ
264                     if ($pid > 0 ){
265                     print "<td><a href=\"http://cal.syoboi.jp/tid/$tid/time#$pid\" target=\"_blank\">$subtitle<br></td>\n";
266                     }else{
267                     if ($protectmode) {
268                     print "<td>$subtitle<br></td>\n";
269                     }else{
270                     print "<td>$subtitle [<a href=\"delepgp.php?pid=$pid\">予約解除</a>]<br></td>\n";
271                     }
272                     }
273                     // 開始時刻(ズレ)
274                     echo("<td>".htmlspecialchars(foldate2print($rowdata[5]))."<br>(".htmlspecialchars($rowdata[8]).")</td>\n");
275                     // 総尺
276                     echo("<td>".htmlspecialchars($rowdata[6])."<br></td>\n");
277                     
278                     //録画レート
279                     echo("<td>".htmlspecialchars($rowdata[7])."<br></td>\n");
280                 echo("</tr>\n");
281             }
282         ?>
283     </tbody>
284 </table>
285
286
287 <table>
288     <tr><td>エンコーダ数</td><td><?=$recunits ?></td></tr>
289     <tr class="overwraped"><td>チューナー重複</td><td><br /></td></tr>
290     <tr class="exoverwraped"><td>外部入力重複</td><td><br /></td></tr>
291 </table>
292
293
294 <?php
295 } //if ($maxrows == 0) {
296
297
298     $query = "
299 SELECT
300 foltia_program.tid,
301 stationname,
302 foltia_program .title ,
303 foltia_tvrecord.bitrate ,
304 foltia_tvrecord.stationid 
305 FROM  foltia_tvrecord , foltia_program , foltia_station
306 WHERE foltia_tvrecord.tid = foltia_program.tid  AND foltia_tvrecord.stationid = foltia_station .stationid   
307 ORDER BY foltia_program.tid  DESC
308 ";
309     $rs = m_query($con, $query, "DBクエリに失敗しました");
310     $maxrows = pg_num_rows($rs);
311             
312         if ($maxrows == 0) {
313 //なければなにもしない
314             
315         }else{
316         $maxcols = pg_num_fields($rs);
317
318 ?>
319 <p align="left">録画予約番組タイトルを表示します。</p>
320   <table BORDER="0" CELLPADDING="0" CELLSPACING="2" WIDTH="100%">
321     <thead>
322         <tr>
323             <th align="left">予約解除</th>
324             <th align="left">TID</th>
325             <th align="left">放映局</th>
326             <th align="left">タイトル</th>
327             <th align="left">録画リスト</th>
328             <th align="left">画質</th>
329         </tr>
330     </thead>
331
332     <tbody>
333         <?php
334             /* テーブルのデータを出力 */
335             for ($row = 0; $row < $maxrows; $row++) { /* 行に対応 */
336                 /* pg_fetch_row で一行取り出す */
337                 $rowdata = pg_fetch_row($rs, $row);
338
339                 $tid = htmlspecialchars($rowdata[0]);
340                 
341                 if ($tid > 0){
342                 echo("<tr>\n");
343                 //予約解除
344                 if ($protectmode) {
345                     echo("<td>−</td>");               
346                 }else{
347                     echo("<td><a href=\"delreserve.php?tid=$tid&sid=" .
348                      htmlspecialchars($rowdata[4])  . "\">解除</a></td>\n");
349                 }
350                 //TID
351                     echo("<td><a href=\"reserveprogram.php?tid=$tid\">$tid</a></td>\n");
352                      //放映局
353                      echo("<td>".htmlspecialchars($rowdata[1])."<br></td>\n");
354                      //タイトル
355                      echo("<td><a href=\"http://cal.syoboi.jp/tid/$tid\" target=\"_blank\">" .
356                      htmlspecialchars($rowdata[2]) . "</a></td>\n");
357
358                     //MP4
359                     echo("<td><a href=\"showlibc.php?tid=$tid\">mp4</a></td>\n");
360
361                     echo("<td>".htmlspecialchars($rowdata[3])."<br></td>\n");
362     
363                 echo("</tr>\n");
364                 }else{
365                 print "<tr>
366                 <td>−</td><td>0</td>
367                 <td>[全局]<br></td>
368                 <td>EPG録画</td>
369                 <td><a href=\"showlibc.php?tid=0\">mp4</a></td>";
370                 echo("<td>".htmlspecialchars($rowdata[3])."<br></td>\n</tr>");
371                 }//if tid 0
372             }//for
373         }//else
374         ?>
375     </tbody>
376 </table>
377
378
379 </body>
380 </html>
381
Note: リポジトリブラウザについてのヘルプは TracBrowser を参照してください。
track feed