root/trunk/install/php/showplaylist.php

リビジョン 114, 7.6 kB (コミッタ: sorshi, コミット時期: 14 年 前)

PostgreSQLで録画一覧(全)にチャンネルスキャン時に出来るようなMPEGファイルがあった場合のエラー処理追加

Line 
1 <?php
2 /*
3  Anime recording system foltia
4  http://www.dcc-jpl.com/soft/foltia/
5
6 showplaylist.php
7
8 目的
9 録画したmpeg2の番組一覧を表示します。
10
11
12 オプション
13 list:
14  省略時、録画順にソートされる。
15  titleのときに、番組順ソートされる。
16  rawのときに、DBに記録されている番組録画情報ではなくディレクトリにあるm2p/m2tファイルを全て表示する。
17
18  DCC-JPL Japan/foltia project
19
20 */
21
22 include("./foltialib.php");
23 $con = m_connect();
24
25 if ($useenvironmentpolicy == 1){
26     if (!isset($_SERVER['PHP_AUTH_USER'])) {
27         header("WWW-Authenticate: Basic realm=\"foltia\"");
28         header("HTTP/1.0 401 Unauthorized");
29         redirectlogin();
30         exit;
31     } else {
32     login($con,$_SERVER['PHP_AUTH_USER'],$_SERVER['PHP_AUTH_PW']);
33     }
34 }//end if login
35
36
37 ?>
38 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
39 <html lang="ja">
40 <head>
41 <meta http-equiv="Content-Type" content="text/html; charset=EUC-JP">
42 <meta http-equiv="Content-Style-Type" content="text/css">
43 <link rel="stylesheet" type="text/css" href="graytable.css">
44 <?php
45
46 // Syabas 判定
47 $useragent = $_SERVER['HTTP_USER_AGENT'];
48
49 //ディスク空き容量によって背景色表示変更
50 warndiskfreearea();
51
52 print "<title>foltia:recorded file list</title>
53 </head>";
54
55 $now = date("YmdHi");   
56 ?>
57 <body BGCOLOR="#ffffff" TEXT="#494949" LINK="#0047ff" VLINK="#000000" ALINK="#c6edff" >
58 <div align="center">
59 <?php
60     printhtmlpageheader();
61 ?>
62   <p align="left"><font color="#494949" size="6">録画一覧表示</font></p>
63   <hr size="4">
64 <p align="left">再生可能番組リストを表示します。<br>
65 <?php
66 if ($demomode){
67 }else{
68     printdiskusage();
69     printtrcnprocesses();
70 }
71 ?>
72 <form name="deletemovie" method="POST" action="./deletemovie.php">
73 <p align="left"><input type="submit" value="項目削除" ></p>
74
75   <table BORDER="0" CELLPADDING="0" CELLSPACING="2" WIDTH="100%">
76     <thead>
77         <tr>
78             <th align="left">削除</th>
79             <th align="left"><A HREF="./showplaylist.php">ファイル名</A></th>
80             <th align="left"><A HREF="./showplaylist.php?list=title">タイトル</A></th>
81             <th align="left">話数</th>
82             <th align="left">サブタイ</th>
83 <?php
84 if (file_exists("./selectcaptureimage.php") ) {
85 print "            <th align=\"left\">キャプ</th>\n";
86 }
87 ?>
88         </tr>
89     </thead>
90
91     <tbody>
92
93
94 <?php
95 $list = getgetform('list');
96
97 //旧仕様
98 if($list == "raw"){
99 exec ("ls -t  $recfolderpath/*.???", $m2pfiles);
100
101
102 foreach($m2pfiles as $pathfName) {
103
104 $fNametmp = split("/",$pathfName);
105 $fName = array_pop($fNametmp);
106 //print "FILENAME:$fName<BR>\n";
107
108 if(($fName == ".") or ($fName == "..") ){ continue; }
109 if ((ereg(".m2.+", $fName))|| (ereg(".aac", $fName))){
110     $filesplit = split("-",$fName);
111
112 if (preg_match("/^\d+$/", $filesplit[0])) {//    print "File is looks like good:preg<br>\n";
113 if ($filesplit[1] == ""){
114 $query = "
115 SELECT
116 foltia_program.tid,foltia_program.title,foltia_subtitle.subtitle 
117 FROM foltia_subtitle , foltia_program   
118 WHERE foltia_program.tid = foltia_subtitle.tid 
119  AND foltia_subtitle.tid = ?
120 ";
121 //$rs = m_query($con, $query, "DBクエリに失敗しました");
122 $rs = sql_query($con, $query, "DBクエリに失敗しました",array($filesplit[0]));
123                 $rall = $rs->fetchAll();
124                 $rowdata = $rall[0];
125 //print" $fName./$rowdata[1]//$rowdata[2]<BR>\n";
126 $title = $rowdata[1];
127 $subtitle = "";
128 $count = "";
129
130 }else{
131
132 $query = "
133 SELECT
134 foltia_program.tid,foltia_program.title,foltia_subtitle.countno,foltia_subtitle.subtitle 
135 FROM foltia_subtitle , foltia_program   
136 WHERE foltia_program.tid = foltia_subtitle.tid 
137  AND foltia_subtitle.tid = ?
138  AND foltia_subtitle.countno = ?
139 ";
140 //$rs = m_query($con, $query, "DBクエリに失敗しました");
141 $rs = sql_query($con, $query, "DBクエリに失敗しました",array($filesplit[0],$filesplit[1]));
142                 $rall = $rs->fetchAll();
143                 $rowdata = $rall[0];
144 //print" $fName./$rowdata[1]/$rowdata[2]/$rowdata[3]<BR>\n";
145 $title = $rowdata[1];
146 $count = $rowdata[2];
147 $subtitle = $rowdata[3];
148 }//if 話数あるかどうか
149
150 $tid = htmlspecialchars($rowdata[0]);
151 $title = htmlspecialchars($title);
152 $count = htmlspecialchars($count);
153 $subtitle = htmlspecialchars($subtitle);
154
155 //--
156 print "
157 <tr>
158 <td><INPUT TYPE='checkbox' NAME='delete[]' VALUE='$fName'><br></td>
159 <td><A HREF=\"$httpmediamappath/$fName\">$fName</A><br></td>
160 <td><a href=\"http://cal.syoboi.jp/tid/$tid\" target=\"_blank\">$title</a></td>
161 <td>$count<br></td>
162 <td>$subtitle<br></td>";
163     if (file_exists("./selectcaptureimage.php") ) {
164 //    $capimgpath = preg_replace("/.m2p/", "", $fName);
165     print "            <td align=\"left\"> N/A </td>\n";
166     }
167
168 print "</tr>\n
169 ";
170 }else{
171     //print "File is looks like BAD:preg<br>\n";
172 }//
173
174 }//ereg
175 }//foreach
176 print "    </tbody>\n</table>\n</FORM>\n</body>\n</html>\n";
177 exit;
178 }elseif ($list== "title"){//新仕様
179 $query = "
180 SELECT
181 foltia_program.tid,
182 foltia_program.title,
183 foltia_subtitle.countno,
184 foltia_subtitle.subtitle  ,
185 foltia_m2pfiles.m2pfilename  ,
186 foltia_subtitle.pid   
187 FROM foltia_subtitle , foltia_program , foltia_m2pfiles
188 WHERE foltia_program.tid = foltia_subtitle.tid 
189  AND foltia_subtitle.m2pfilename = foltia_m2pfiles.m2pfilename
190 ORDER BY foltia_subtitle.tid  DESC , foltia_subtitle.startdatetime  ASC
191
192
193 ";
194 }else{
195 $query = "
196 SELECT
197 foltia_program.tid,
198 foltia_program.title,
199 foltia_subtitle.countno,
200 foltia_subtitle.subtitle  ,
201 foltia_m2pfiles.m2pfilename  ,
202 foltia_subtitle.pid   
203 FROM foltia_subtitle , foltia_program , foltia_m2pfiles
204 WHERE foltia_program.tid = foltia_subtitle.tid 
205  AND foltia_subtitle.m2pfilename = foltia_m2pfiles.m2pfilename
206 ORDER BY foltia_subtitle.startdatetime DESC
207 ";
208 }
209
210 //$rs = m_query($con, $query, "DBクエリに失敗しました");
211 $rs = sql_query($con, $query, "DBクエリに失敗しました");
212 $rowdata = $rs->fetch();
213 if ($rowdata) {
214     do {
215 $tid = htmlspecialchars($rowdata[0]);
216 $title = htmlspecialchars($rowdata[1]);
217 $count = htmlspecialchars($rowdata[2]);
218 $subtitle = htmlspecialchars($rowdata[3]);
219 $fName  = htmlspecialchars($rowdata[4]);
220 $pid  = htmlspecialchars($rowdata[5]);
221 //--
222 print "
223 <tr>
224 <td><INPUT TYPE='checkbox' NAME='delete[]' VALUE='$fName'><br></td>";
225 if (ereg("syabas",$useragent)){
226 print "<td><A HREF=\"./view_syabas.php?pid=$pid\" vod=playlist>$fName</td>";
227 }
228 else{
229 print "<td><A HREF=\"$httpmediamappath/$fName\">$fName</A><br></td>";
230 }
231 if ($tid > 0){
232 print"<td><a href=\"http://cal.syoboi.jp/tid/$tid\" target=\"_blank\">$title</a></td>
233 <td>$count<br></td>
234 <td><a href = \"http://cal.syoboi.jp/tid/$tid/time#$pid\" target=\"_blank\">$subtitle</a><br></td>";
235 }else{
236 print"<td>$title</td>
237 <td>$count<br></td>
238 <td>$subtitle<br></td>";
239 }
240     if (file_exists("./selectcaptureimage.php") ) {
241     $capimgpath = preg_replace("/.m2.+/", "", $fName);
242     print "            <td align=\"left\"><a href=\"./selectcaptureimage.php?pid=$pid\">キャプ</a></td>\n";
243     }
244 print "</tr>\n
245 ";
246     } while ($rowdata = $rs->fetch());
247 }else{
248 print "
249 <tr>
250 <td COLSPAN=\"5\">ファイルがありません</td>
251 </tr>
252 ";
253
254
255 }//end if
256
257 print "</tbody>
258 </table>
259 </FORM>\n";
260
261 //番組ソートの時、未読番組のタイトルだけ表示
262 if ($list== "title"){
263 $query = "
264 SELECT distinct
265 foltia_program.tid,
266 foltia_program.title
267 FROM foltia_subtitle , foltia_program , foltia_m2pfiles
268 WHERE foltia_program.tid = foltia_subtitle.tid 
269  AND foltia_subtitle.m2pfilename = foltia_m2pfiles.m2pfilename
270 ORDER BY foltia_program.tid DESC
271 ";
272
273 //$rs = m_query($con, $query, "DBクエリに失敗しました");
274 $rs = sql_query($con, $query, "DBクエリに失敗しました");
275     $rowdata = $rs->fetch();
276     if ($rowdata) {
277 print "<hr>
278 <p align=\"left\">未読タイトルを表示します。<br>
279   <table BORDER=\"0\" CELLPADDING=\"0\" CELLSPACING=\"2\" WIDTH=\"100%\">
280     <thead>
281         <tr>
282             <th align=\"left\">TID</th>
283             <th align=\"left\">タイトル</th>
284         </tr>
285     </thead>
286     <tbody>
287 ";
288
289         do {
290 $tid = htmlspecialchars($rowdata[0]);
291 $title = htmlspecialchars($rowdata[1]);
292
293 print "<tr><td>$tid</td><td>$title</td></tr>\n";
294
295         } while ($rowdata = $rs->fetch());
296 print "</tbody></table>\n";
297 }//if maxrows
298 }//if title
299
300 ?>
301    
302
303 </body>
304 </html>
305
Note: リポジトリブラウザについてのヘルプは TracBrowser を参照してください。
track feed