チケット #8: foltia-sqlite.diff
ファイル foltia-sqlite.diff, 128.3 kB (登録者: guest, 登録時期: 16 年 前) |
---|
-
foltia/install/mktable.sqlite.txt
old new 1 2 drop table foltia_program ; 3 4 create table foltia_program ( 5 tid integer PRIMARY KEY, 6 title text , 7 startweektype text, 8 starttime text, 9 lengthmin integer, 10 firstlight text, 11 officialuri text , 12 aspect integer , 13 psp integer , 14 transfer text, 15 PSPdirname text 16 ); 17 create unique index foltia_program_tid_index on foltia_program (tid); 18 19 -- REVOKE ALL on "foltia_program" from PUBLIC; 20 -- GRANT UPDATE,SELECT,INSERT on "foltia_program" to "foltia"; 21 22 drop table foltia_subtitle ; 23 24 create table foltia_subtitle ( 25 pid integer PRIMARY KEY, 26 tid integer, 27 stationid integer, 28 countno integer, 29 subtitle text, 30 startdatetime integer, 31 enddatetime integer, 32 startoffset integer, 33 lengthmin integer, 34 m2pfilename text , 35 PSPfilename text , 36 epgaddedby integer , 37 lastupdate timestamp, 38 filestatus integer 39 ); 40 create unique index foltia_subtitle_pid_index on foltia_subtitle (pid); 41 create index foltia_subtitle_tid_index on foltia_subtitle (tid); 42 create index foltia_subtitle_stationid_index on foltia_subtitle (stationid); 43 create index foltia_subtitle_enddatetime_index on foltia_subtitle (enddatetime); 44 create index foltia_subtitle_startdatetime_index on foltia_subtitle (startdatetime); 45 46 -- REVOKE ALL on "foltia_subtitle" from PUBLIC; 47 -- GRANT UPDATE,SELECT,INSERT on "foltia_subtitle" to "foltia"; 48 49 drop table foltia_tvrecord; 50 create table foltia_tvrecord ( 51 tid integer , 52 stationid integer, 53 bitrate integer , 54 digital integer 55 ); 56 create index foltia_tvrecord_tid_index on foltia_tvrecord (tid); 57 58 -- REVOKE ALL on "foltia_tvrecord" from PUBLIC; 59 -- GRANT ALL on "foltia_tvrecord" to "foltia"; 60 61 62 drop table foltia_epg; 63 create table foltia_epg ( 64 epgid integer PRIMARY KEY, 65 startdatetime integer, 66 enddatetime integer, 67 lengthmin integer , 68 ontvchannel text, 69 epgtitle text, 70 epgdesc text, 71 epgcategory text 72 ); 73 create index foltia_epg_startdatetime_index on foltia_epg (startdatetime); 74 create index foltia_epg_enddatetime_index on foltia_epg (enddatetime); 75 create index foltia_epg_ontvchannel_index on foltia_epg (ontvchannel); 76 77 -- REVOKE ALL on "foltia_epg" from PUBLIC; 78 -- GRANT ALL on "foltia_epg" to "foltia"; 79 80 drop table foltia_m2pfiles; 81 create table foltia_m2pfiles ( 82 m2pfilename text 83 ); 84 -- REVOKE ALL on "foltia_m2pfiles" from PUBLIC; 85 -- GRANT ALL on "foltia_m2pfiles" to "foltia"; 86 87 drop table foltia_mp4files; 88 create table foltia_mp4files ( 89 tid integer, 90 mp4filename text 91 ); 92 -- REVOKE ALL on "foltia_mp4files" from PUBLIC; 93 -- GRANT ALL on "foltia_mp4files" to "foltia"; 94 95 drop table foltia_station; 96 CREATE TABLE foltia_station ( 97 stationid integer PRIMARY KEY, 98 stationname text, 99 stationrecch integer, 100 stationcallsign text, 101 stationuri text, 102 tunertype text, 103 tunerch text, 104 device text, 105 ontvcode text, 106 digitalch integer, 107 digitalstationband integer 108 ); 109 -- ADD CONSTRAINT foltia_station_pkey PRIMARY KEY (stationid); 110 -- REVOKE ALL on "foltia_station" from PUBLIC; 111 -- GRANT ALL on "foltia_station" to "foltia"; 112 113 -- 114 -- PostgreSQL database dump 115 -- 116 117 -- SET client_encoding = 'EUC_JP'; 118 -- SET check_function_bodies = false; 119 120 -- SET SESSION AUTHORIZATION 'foltia'; 121 122 -- SET search_path = public, pg_catalog; 123 124 -- 125 -- TOC entry 3 (OID 17158) 126 -- Name: foltia_station; Type: TABLE; Schema: public; Owner: foltia 127 -- 128 129 -- 130 -- TOC entry 4 (OID 17158) 131 -- Name: foltia_station; Type: ACL; Schema: public; Owner: foltia 132 -- 133 134 135 -- SET SESSION AUTHORIZATION 'foltia'; 136 137 -- 138 -- Data for TOC entry 6 (OID 17158) 139 -- Name: foltia_station; Type: TABLE DATA; Schema: public; Owner: foltia 140 -- 141 INSERT INTO foltia_program VALUES (0, 'EPG録画', '', '', NULL, '', '', 3, 1, '', ''); 142 INSERT INTO foltia_tvrecord VALUES (0,0,5,1); 143 144 145 146 INSERT INTO foltia_station VALUES (0, '[全局]', 0, '', '', '', '', '', '',NULL,NULL); 147 INSERT INTO foltia_station VALUES (1, 'NHK総合', 1, 'NHK', '', NULL, NULL, NULL, '0031.ontvjapan.com',27,0); 148 INSERT INTO foltia_station VALUES (3, 'NHK教育', 3, 'ETV', '', NULL, NULL, NULL, '0041.ontvjapan.com',26,0); 149 INSERT INTO foltia_station VALUES (4, '日本テレビ', 4, 'NTV', '', NULL, NULL, NULL, '0004.ontvjapan.com',25,0); 150 INSERT INTO foltia_station VALUES (6, 'TBS', 6, 'TBS', '', NULL, NULL, NULL, '0005.ontvjapan.com',22,0); 151 INSERT INTO foltia_station VALUES (8, 'フジテレビ', 8, 'CX', '', NULL, NULL, NULL, '0006.ontvjapan.com',21,0); 152 INSERT INTO foltia_station VALUES (10, 'テレビ朝日', 10, 'EX', '', NULL, NULL, NULL, '0007.ontvjapan.com',24,0); 153 INSERT INTO foltia_station VALUES (12, 'テレビ東京', 12, 'TX', '', NULL, NULL, NULL, '0008.ontvjapan.com',23,0); 154 INSERT INTO foltia_station VALUES (42, 'tvk', 42, 'TVK', '', '', '', '', '0009.ontvjapan.com',18,0); 155 INSERT INTO foltia_station VALUES (14, 'TOKYO MX', 14, 'MX', '', '', '', '', '0016.ontvjapan.com',20,0); 156 INSERT INTO foltia_station VALUES (46, 'チバテレビ', -10, 'CTC', '', NULL, NULL, NULL, NULL,30,0); 157 INSERT INTO foltia_station VALUES (38, 'テレ玉', -10, 'TVS', '', NULL, NULL, NULL, NULL,32,0); 158 INSERT INTO foltia_station VALUES (418, '放送大学', -10, 'UAIR', '', NULL, NULL, NULL, '0013.ontvjapan.com',28,0); 159 INSERT INTO foltia_station VALUES (101, 'NHK-BS1', 0, 'BS7', '', '', '101', '', '3001.ontvjapan.com',101,1); 160 INSERT INTO foltia_station VALUES (102, 'NHK-BS2', 0, 'BS11', '', '', '102', '', '3002.ontvjapan.com',102,1); 161 INSERT INTO foltia_station VALUES (103, 'NHK-BShi', 0, '', '', '', '103', '', '3003.ontvjapan.com',103,1); 162 INSERT INTO foltia_station VALUES (409, 'BS日テレ', 0, '', '', '', '141', '', '3004.ontvjapan.com',141,1); 163 INSERT INTO foltia_station VALUES (384, 'BS朝日', 0, '', '', '', '151', '', '3005.ontvjapan.com',151,1); 164 INSERT INTO foltia_station VALUES (161, 'BS-i', 0, '', '', '', '161', '', '3006.ontvjapan.com',161,1); 165 INSERT INTO foltia_station VALUES (389, 'BS Japan', 0, '', '', '', '171', '','3007.ontvjapan.com',171,1); 166 INSERT INTO foltia_station VALUES (381, 'BSフジ', 0, '', '', '', '181', '', '3008.ontvjapan.com',181,1); 167 INSERT INTO foltia_station VALUES (191, 'WOWOW', 0, 'BS5', '', '', '191', '', '3009.ontvjapan.com',191,1); 168 INSERT INTO foltia_station VALUES (420, 'WOWOW2', 0, '', '', '', '192', '', '3010.ontvjapan.com',192,1); 169 INSERT INTO foltia_station VALUES (421, 'WOWOW3', 0, '', '', '', '193', '', '3011.ontvjapan.com',193,1); 170 INSERT INTO foltia_station VALUES (468, 'BS11デジタル', 0, '', '', '', '211', '', '',211,1); 171 INSERT INTO foltia_station VALUES (408, 'ファミリー劇場', 0, '', '', '', '751', '', '1015.ontvjapan.com',NULL,NULL); 172 INSERT INTO foltia_station VALUES (397, 'カートゥーンネットワーク', 0, '', '', '', '780', '', '1046.ontvjapan.com',NULL,NULL); 173 INSERT INTO foltia_station VALUES (263, 'アニマックス', 0, '', '', '', '782', '', '1047.ontvjapan.com',NULL,NULL); 174 INSERT INTO foltia_station VALUES (261, 'キッズステーション', 0, '', '', 'c', '781', '', '1045.ontvjapan.com',NULL,NULL); 175 INSERT INTO foltia_station VALUES (449, 'ディスカバリーチャンネル', 0, '', '', '', '796', '', '1062.ontvjapan.com',NULL,NULL); 176 INSERT INTO foltia_station VALUES (448, 'MONDO21', 0, '', '', '', '722', '', '1049.ontvjapan.com',NULL,NULL); 177 INSERT INTO foltia_station VALUES (401, 'チャンネルNECO', 0, '', '', '', '750', '', '1008.ontvjapan.com',NULL,NULL); 178 INSERT INTO foltia_station VALUES (455, '330ch WOWOW', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); 179 INSERT INTO foltia_station VALUES (480, 'TBSラジオ(954)', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); 180 INSERT INTO foltia_station VALUES (477, '北海道文化放送', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); 181 INSERT INTO foltia_station VALUES (463, 'gooアニメ', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); 182 INSERT INTO foltia_station VALUES (461, '@nifty', -10, '', '', '', '', '', '',NULL,NULL); 183 INSERT INTO foltia_station VALUES (466, 'NHKラジオ第一', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); 184 INSERT INTO foltia_station VALUES (474, '日テレプラス', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); 185 INSERT INTO foltia_station VALUES (476, 'ニコニコアニメチャンネル', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); 186 INSERT INTO foltia_station VALUES (451, 'RKB毎日放送', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); 187 INSERT INTO foltia_station VALUES (452, '北海道放送', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); 188 INSERT INTO foltia_station VALUES (454, 'テレビ和歌山', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); 189 INSERT INTO foltia_station VALUES (456, '静岡放送', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); 190 INSERT INTO foltia_station VALUES (457, 'i-revo', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); 191 INSERT INTO foltia_station VALUES (459, '東北放送', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); 192 INSERT INTO foltia_station VALUES (464, 'テレビ山口', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); 193 INSERT INTO foltia_station VALUES (478, '札幌テレビ放送', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); 194 INSERT INTO foltia_station VALUES (395, 'カミングスーンTV', -10, '', '', '', '', '', '',NULL,NULL); 195 INSERT INTO foltia_station VALUES (443, 'スーパーチャンネル', -10, '', '', '', '', '', '',NULL,NULL); 196 INSERT INTO foltia_station VALUES (385, 'TBSチャンネル', 0, '', '', '', '765', '', '',NULL,NULL); 197 INSERT INTO foltia_station VALUES (462, '瀬戸内海放送', -10, '', '', '', '', '', '',NULL,NULL); 198 INSERT INTO foltia_station VALUES (473, 'フジCSHD', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); 199 INSERT INTO foltia_station VALUES (475, 'スカパー181ch', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); 200 INSERT INTO foltia_station VALUES (479, '北海道テレビ放送', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); 201 INSERT INTO foltia_station VALUES (450, 'NHK教育3', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); 202 INSERT INTO foltia_station VALUES (453, 'バンダイチャンネルキッズ', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); 203 INSERT INTO foltia_station VALUES (458, '日テレプラス&サイエンス', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); 204 INSERT INTO foltia_station VALUES (460, 'ビクトリーチャンネル', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); 205 INSERT INTO foltia_station VALUES (472, 'ytv', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); 206 INSERT INTO foltia_station VALUES (422, '東海テレビ', -10, '', '', '', '', '', '',NULL,NULL); 207 INSERT INTO foltia_station VALUES (423, 'ShowTime', -10, '', '', '', '', '', '',NULL,NULL); 208 INSERT INTO foltia_station VALUES (424, 'メ〜テレ', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); 209 INSERT INTO foltia_station VALUES (425, '三重テレビ', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); 210 INSERT INTO foltia_station VALUES (426, '中京テレビ', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); 211 INSERT INTO foltia_station VALUES (293, 'AT-X', -10, '', '', NULL, NULL, NULL, NULL,NULL,NULL); 212 INSERT INTO foltia_station VALUES (295, 'フジ721', -10, '', '', NULL, NULL, NULL, NULL,NULL,NULL); 213 INSERT INTO foltia_station VALUES (380, 'スカパー180ch', -10, '', '', NULL, NULL, NULL, NULL,NULL,NULL); 214 INSERT INTO foltia_station VALUES (427, '岐阜放送', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); 215 INSERT INTO foltia_station VALUES (428, 'テレビ新広島', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); 216 INSERT INTO foltia_station VALUES (383, 'サンテレビ', -10, '', '', NULL, NULL, NULL, NULL,NULL,NULL); 217 INSERT INTO foltia_station VALUES (429, 'CBCテレビ', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); 218 INSERT INTO foltia_station VALUES (386, 'テレ朝チャンネル', -10, '', '', NULL, NULL, NULL, NULL,NULL,NULL); 219 INSERT INTO foltia_station VALUES (390, 'サンテレビジョン', -10, '', '', NULL, NULL, NULL, NULL,NULL,NULL); 220 INSERT INTO foltia_station VALUES (392, 'スカパー183ch', -10, '', '', NULL, NULL, NULL, NULL,NULL,NULL); 221 INSERT INTO foltia_station VALUES (394, 'スカパー160ch', -10, '', '', NULL, NULL, NULL, NULL,NULL,NULL); 222 INSERT INTO foltia_station VALUES (396, 'KBS京都', -10, '', '', NULL, NULL, NULL, NULL,NULL,NULL); 223 INSERT INTO foltia_station VALUES (398, 'テレビ大阪', -10, '', '', NULL, NULL, NULL, NULL,NULL,NULL); 224 INSERT INTO foltia_station VALUES (399, 'ABCテレビ', -10, '', '', NULL, NULL, NULL, NULL,NULL,NULL); 225 INSERT INTO foltia_station VALUES (400, 'なし', -10, '', '', NULL, NULL, NULL, NULL,NULL,NULL); 226 INSERT INTO foltia_station VALUES (402, '関西テレビ', -10, '', '', NULL, NULL, NULL, NULL,NULL,NULL); 227 INSERT INTO foltia_station VALUES (406, 'MBS毎日放送', -10, '', '', NULL, NULL, NULL, NULL,NULL,NULL); 228 INSERT INTO foltia_station VALUES (407, 'animate.tv', -10, '', '', NULL, NULL, NULL, NULL,NULL,NULL); 229 INSERT INTO foltia_station VALUES (410, 'テレビ愛知', -10, '', '', NULL, NULL, NULL, NULL,NULL,NULL); 230 INSERT INTO foltia_station VALUES (411, 'インターネット', -10, '', '', NULL, NULL, NULL, NULL,NULL,NULL); 231 INSERT INTO foltia_station VALUES (413, 'よみうりテレビ', -10, '', '', NULL, NULL, NULL, NULL,NULL,NULL); 232 INSERT INTO foltia_station VALUES (414, 'LFX488', -10, '', '', NULL, NULL, NULL, NULL,NULL,NULL); 233 INSERT INTO foltia_station VALUES (415, 'LFX', -10, '', '', NULL, NULL, NULL, NULL,NULL,NULL); 234 INSERT INTO foltia_station VALUES (416, 'LFX BB', -10, '', '', NULL, NULL, NULL, NULL,NULL,NULL); 235 INSERT INTO foltia_station VALUES (419, 'GyaO', -10, '', '', NULL, NULL, NULL, NULL,NULL,NULL); 236 INSERT INTO foltia_station VALUES (417, 'とちぎテレビ', -10, 'TTV', '', NULL, NULL, NULL, NULL,NULL,NULL); 237 INSERT INTO foltia_station VALUES (412, '群馬テレビ', -10, 'GTV', '', NULL, NULL, NULL, NULL,NULL,NULL); 238 INSERT INTO foltia_station VALUES (430, '奈良テレビ', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); 239 INSERT INTO foltia_station VALUES (431, 'TVQ九州放送', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); 240 INSERT INTO foltia_station VALUES (432, 'テレビ北海道', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); 241 INSERT INTO foltia_station VALUES (433, 'BIGLOBEストリーム', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); 242 INSERT INTO foltia_station VALUES (434, 'テレビせとうち', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); 243 INSERT INTO foltia_station VALUES (435, '中国放送', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); 244 INSERT INTO foltia_station VALUES (436, '文化放送(1134)', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); 245 INSERT INTO foltia_station VALUES (437, '広島ホームテレビ', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); 246 INSERT INTO foltia_station VALUES (438, '広島テレビ', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); 247 INSERT INTO foltia_station VALUES (439, '岡山放送', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); 248 INSERT INTO foltia_station VALUES (440, '山陽放送', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); 249 INSERT INTO foltia_station VALUES (441, 'びわ湖放送', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); 250 INSERT INTO foltia_station VALUES (442, 'NHK-FM', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); 251 INSERT INTO foltia_station VALUES (444, 'バンダイチャンネル', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); 252 INSERT INTO foltia_station VALUES (445, 'フレッツ・スクウェア(NTT東日本)', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); 253 INSERT INTO foltia_station VALUES (446, 'フジ739', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); 254 INSERT INTO foltia_station VALUES (447, 'Yahoo!動画', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); 255 256 257 258 259 -- 260 -- TOC entry 5 (OID 17163) 261 -- Name: foltia_station_pkey; Type: CONSTRAINT; Schema: public; Owner: foltia 262 -- 263 264 -- ALTER TABLE ONLY foltia_station 265 -- ADD CONSTRAINT foltia_station_pkey PRIMARY KEY (stationid); 266 267 drop table foltia_envpolicy; 268 CREATE TABLE foltia_envpolicy ( 269 memberid integer PRIMARY KEY, 270 userclass integer, 271 name text, 272 passwd1 text , 273 adddate timestamp, 274 remotehost text 275 ); 276 -- REVOKE ALL on "foltia_envpolicy" from PUBLIC; 277 -- GRANT ALL on "foltia_envpolicy" to "foltia"; 278 create index foltia_envpolicy_index on foltia_envpolicy (name); 279 insert into foltia_envpolicy values ( '0','0','foltia','foltiapasswd',datetime('now'),''); -
foltia/install/perl/addatq.pl
old new 15 15 16 16 use DBI; 17 17 use DBD::Pg; 18 use DBD::SQLite; 18 19 use Schedule::At; 19 20 use Time::Local; 20 21 21 22 $path = $0; 22 23 $path =~ s/addatq.pl$//i; 23 if ($p wdne "./"){24 if ($path ne "./"){ 24 25 push( @INC, "$path"); 25 26 } 26 27 … … 37 38 } 38 39 39 40 #DB検索(TIDとStationIDからPIDへ) 40 $data_source = sprintf("dbi:%s:dbname=%s;host=%s;port=%d", 41 $DBDriv,$DBName,$DBHost,$DBPort); 42 $dbh = DBI->connect($data_source,$DBUser,$DBPass) ||die $DBI::error;; 41 $dbh = DBI->connect($DSN,$DBUser,$DBPass) ||die $DBI::error;; 43 42 44 43 if ($station == 0){ 45 $DBQuery = "SELECT count(*) FROM foltia_tvrecord WHERE tid = '$tid' "; 44 $sth = $dbh->prepare($stmt{'addatq.1'}); 45 $sth->execute($tid); 46 46 }else{ 47 $DBQuery = "SELECT count(*) FROM foltia_tvrecord WHERE tid = '$tid' AND stationid = '$station' "; 47 $sth = $dbh->prepare($stmt{'addatq.2'}); 48 $sth->execute($tid, $station); 48 49 } 49 $sth = $dbh->prepare($DBQuery);50 $sth->execute();51 50 @titlecount = $sth->fetchrow_array; 52 51 #件数数える 53 52 54 53 #2以上だったら 55 54 if ($titlecount[0] >= 2){ 56 #全曲取りが含まれているか調べる 57 $DBQuery = "SELECT count(*) FROM foltia_tvrecord WHERE tid = '$tid' AND stationid ='0' "; 58 $kth = $dbh->prepare($DBQuery); 59 $kth->execute(); 55 #全局録りが含まれているか調べる 56 $kth = $dbh->prepare($stmt{'addatq.3'}); 57 $kth->execute($tid); 60 58 @reservecounts = $kth->fetchrow_array; 61 59 62 60 if($reservecounts[0] >= 1 ){#含まれていたら 63 61 if($tid == 0){ 64 62 #今回の引き数がSID 0だったら 65 #全局取りだけ予約66 # &writelog("addatq DEBUG; ALL STATION RESERVE. TID=$tid SID=$station $titlecount[0] match:$ DBQuery");63 #全局録りだけ予約 64 # &writelog("addatq DEBUG; ALL STATION RESERVE. TID=$tid SID=$station $titlecount[0] match:$stmt{'addatq.3'}"); 67 65 &addcue; 68 66 }else{ 69 67 #ほかの全局録画addatqが予約入れてくれるからなにもしない 70 # &writelog("addatq DEBUG; SKIP OPERSTION. TID=$tid SID=$station $titlecount[0] match:$ DBQuery");68 # &writelog("addatq DEBUG; SKIP OPERSTION. TID=$tid SID=$station $titlecount[0] match:$stmt{'addatq.3'}"); 71 69 exit; 72 70 }#end if ふくまれていたら 73 71 }#endif 2つ以上 74 72 }elsif($titlecount[0] == 1){ 75 73 &addcue; 76 74 }else{ 77 &writelog("addatq error; reserve impossible . TID=$tid SID=$station $titlecount[0] match:$DBQuery");75 &writelog("addatq error; reserve impossible . TID=$tid SID=$station $titlecount[0] match:$stmt{'addatq.3'}"); 78 76 } 79 77 80 78 #旧処理 81 79 # if ($titlecount[0] == 1 ){ 82 80 # & addcue; 83 81 # }else{ 84 #&writelog("addatq error record TID=$tid SID=$station $titlecount[0] match:$ DBQuery");82 #&writelog("addatq error record TID=$tid SID=$station $titlecount[0] match:$stmt{'addatq.3'}"); 85 83 #} 86 84 87 85 sub addcue{ 88 86 89 87 if ($station == 0){ 90 $DBQuery = "SELECT * FROM foltia_tvrecord WHERE tid = '$tid' "; 88 $sth = $dbh->prepare($stmt{'addatq.addcue.1'}); 89 $sth->execute($tid); 91 90 }else{ 92 $DBQuery = "SELECT * FROM foltia_tvrecord WHERE tid = '$tid' AND stationid = '$station' "; 91 $sth = $dbh->prepare($stmt{'addatq.addcue.2'}); 92 $sth->execute($tid, $station); 93 93 } 94 $sth = $dbh->prepare($DBQuery);95 $sth->execute();96 94 @titlecount= $sth->fetchrow_array; 97 95 $bitrate = $titlecount[2];#ビットレート取得 98 96 99 97 #PID抽出 100 $now = &epoch2foldate(`date +%s`);101 $twodaysafter = &epoch2foldate(`date +%s`+ (60 * 60 * 24 * 2));98 $now = &epoch2foldate(time()); 99 $twodaysafter = &epoch2foldate(time() + (60 * 60 * 24 * 2)); 102 100 #キュー入れは直近2日後まで 103 101 if ($station == 0 ){ 104 $ DBQuery = "105 SELECT * from foltia_subtitle WHERE tid = '$tid' AND startdatetime > '$now' AND startdatetime < '$twodaysafter' ";102 $sth = $dbh->prepare($stmt{'addatq.addcue.3'}); 103 $sth->execute($tid, $now, $twodaysafter); 106 104 }else{ 107 $DBQuery = "108 SELECT * from foltia_subtitle WHERE tid = '$tid' AND stationid = '$station' AND startdatetime > '$now' AND startdatetime < '$twodaysafter' ";109 105 #stationIDからrecch 110 $getrecchquery="SELECT stationid , stationrecch FROM foltia_station where stationid = '$station' "; 111 $stationh = $dbh->prepare($getrecchquery); 112 $stationh->execute(); 106 $stationh = $dbh->prepare($stmt{'addatq.addcue.4'}); 107 $stationh->execute($station); 113 108 @stationl = $stationh->fetchrow_array; 114 109 $recch = $stationl[1]; 115 }116 110 117 $sth = $dbh->prepare($DBQuery); 118 $sth->execute(); 111 $sth = $dbh->prepare($stmt{'addatq.addcue.5'}); 112 $sth->execute($tid, $station, $now, $twodaysafter); 113 } 119 114 120 115 while (($pid , 121 116 $tid , … … 130 125 131 126 if ($station == 0 ){ 132 127 #stationIDからrecch 133 $getrecchquery="SELECT stationid , stationrecch FROM foltia_station where stationid = '$stationid' "; 134 $stationh = $dbh->prepare($getrecchquery); 135 $stationh->execute(); 128 $stationh = $dbh->prepare($stmt{'addatq.addcue.6'}); 129 $stationh->execute($stationid); 136 130 @stationl = $stationh->fetchrow_array; 137 131 $recch = $stationl[1]; 138 132 } -
foltia/install/perl/addpidatq.pl
old new 13 13 14 14 use DBI; 15 15 use DBD::Pg; 16 use DBD::SQLite; 16 17 use Schedule::At; 17 18 use Time::Local; 18 19 19 20 $path = $0; 20 21 $path =~ s/addpidatq.pl$//i; 21 if ($p wdne "./"){22 if ($path ne "./"){ 22 23 push( @INC, "$path"); 23 24 } 24 25 … … 35 36 36 37 37 38 #DB検索(PID) 38 my $data_source = sprintf("dbi:%s:dbname=%s;host=%s;port=%d", 39 $DBDriv,$DBName,$DBHost,$DBPort); 40 $dbh = DBI->connect($data_source,$DBUser,$DBPass) ||die $DBI::error;; 41 42 $DBQuery = "SELECT count(*) FROM foltia_subtitle WHERE pid = '$pid' "; 43 $sth = $dbh->prepare($DBQuery); 44 $sth->execute(); 39 $dbh = DBI->connect($DSN,$DBUser,$DBPass) ||die $DBI::error;; 40 41 $sth = $dbh->prepare($stmt{'addpidatq.1'}); 42 $sth->execute($pid); 45 43 @titlecount= $sth->fetchrow_array; 46 44 47 45 if ($titlecount[0] == 1 ){ 48 49 $DBQuery = "SELECT bitrate,digital FROM foltia_tvrecord , foltia_subtitle WHERE foltia_tvrecord.tid = foltia_subtitle.tid AND pid='$pid' "; 50 $sth = $dbh->prepare($DBQuery); 51 $sth->execute(); 46 $sth = $dbh->prepare($stmt{'addpidatq.2'}); 47 $sth->execute($pid); 52 48 @titlecount= $sth->fetchrow_array; 53 49 $bitrate = $titlecount[0];#ビットレート取得 54 50 if ($titlecount[1] >= 1){ … … 58 54 } 59 55 60 56 #PID抽出 61 $now = &epoch2foldate(`date +%s`);57 $now = &epoch2foldate(time()); 62 58 63 59 #stationIDからrecch 64 $DBQuery = "SELECT stationrecch,digitalch ,digitalstationband ,foltia_station.stationid FROM foltia_station,foltia_subtitle WHERE foltia_subtitle.pid = '$pid' AND foltia_subtitle.stationid = foltia_station.stationid "; 65 66 $stationh = $dbh->prepare($DBQuery); 67 $stationh->execute(); 68 @stationl = $stationh->fetchrow_array; 60 $stationh = $dbh->prepare($stmt{'addpidatq.3'}); 61 $stationh->execute($pid); 62 @stationl = $stationh->fetchrow_array(); 69 63 $recch = $stationl[0]; 70 64 if ($recch eq ""){ 71 &writelog("addpidatq ERROR recch is NULL:$ DBQuery.");65 &writelog("addpidatq ERROR recch is NULL:$stmt{'addpidatq.3'}."); 72 66 exit 1; 73 67 } 74 68 if ($stationl[1] => 1){ … … 81 75 }else{ 82 76 $digitalstationband = 0; 83 77 } 84 $DBQuery = "SELECT * FROM foltia_subtitle WHERE pid='$pid' "; 85 $sth = $dbh->prepare($DBQuery); 86 $sth->execute(); 78 $sth = $dbh->prepare($stmt{'addpidatq.4'}); 79 $sth->execute($pid); 87 80 ($pid , 88 81 $tid , 89 82 $stationid , -
foltia/install/perl/captureimagemaker.pl
old new 13 13 14 14 $path = $0; 15 15 $path =~ s/captureimagemaker.pl$//i; 16 if ($p wdne "./"){16 if ($path ne "./"){ 17 17 push( @INC, "$path"); 18 18 } 19 19 … … 55 55 $date = $filename[2]; 56 56 $date =~ s/[^0-9]//ig; 57 57 if ($date eq "" ){ 58 $date = `date +%Y%m%d` 58 $date = strftime("%Y%m%d", localtime); 59 59 } 60 60 # print "DATE:$date\n"; 61 61 … … 64 64 $time = substr($time, 0, 4); 65 65 $time =~ s/[^0-9]//ig; 66 66 if ($time eq "" ){ 67 $time = `date +%H%M` 67 $time = strftime("%H%M", localtime); 68 68 } 69 69 # print "TIME:$time\n"; 70 70 -
foltia/install/perl/changestbch.pl
old new 25 25 26 26 use DBI; 27 27 use DBD::Pg; 28 use DBD::SQLite; 28 29 29 30 $path = $0; 30 31 $path =~ s/changestbch.pl$//i; 31 if ($p wdne "./"){32 if ($path ne "./"){ 32 33 push( @INC, "$path"); 33 34 } 34 35 require 'foltialib.pl'; … … 53 54 54 55 # pidから局(送出コマンド)調べる 55 56 #DB初期化 56 my $data_source = sprintf("dbi:%s:dbname=%s;host=%s;port=%d", 57 $DBDriv,$DBName,$DBHost,$DBPort); 58 $dbh = DBI->connect($data_source,$DBUser,$DBPass) ||die $DBI::error;; 59 60 $DBQuery = "SELECT foltia_station.tunertype,foltia_station.tunerch ,foltia_station.stationrecch ,foltia_station.stationid FROM foltia_subtitle,foltia_station WHERE foltia_subtitle.stationid = foltia_station.stationid AND foltia_subtitle.pid = '$pid' "; 61 $sth = $dbh->prepare($DBQuery); 62 $sth->execute(); 57 $dbh = DBI->connect($DSN,$DBUser,$DBPass) ||die $DBI::error;; 58 59 $sth = $dbh->prepare($stmt{'changestbch.1'}); 60 $sth->execute($pid); 63 61 @chstatus = $sth->fetchrow_array; 64 62 $tunertype = $chstatus[0]; 65 63 $tunercmd = $chstatus[1]; -
foltia/install/perl/db/Pg.pl
old new 1 2 %main::stmt = ( 3 'addatq.1' => "SELECT count(*) FROM foltia_tvrecord WHERE tid = ?", 4 'addatq.2' => "SELECT count(*) FROM foltia_tvrecord WHERE tid = ? AND stationid = ?", 5 'addatq.3' => "SELECT count(*) FROM foltia_tvrecord WHERE tid = ? AND stationid = '0'", 6 'addatq.addcue.1' => "SELECT * FROM foltia_tvrecord WHERE tid = ?", 7 'addatq.addcue.2' => "SELECT * FROM foltia_tvrecord WHERE tid = ? AND stationid = ?", 8 'addatq.addcue.3' => "SELECT * from foltia_subtitle WHERE tid = ? AND startdatetime > ? AND startdatetime < ?", 9 'addatq.addcue.4' => "SELECT stationid , stationrecch FROM foltia_station where stationid = ?", 10 'addstq.addcue.5' => "SELECT * from foltia_subtitle WHERE tid = ? AND stationid = ? AND startdatetime > ? AND startdatetime < ?", 11 'addatq.addcue.6' => "SELECT stationid , stationrecch FROM foltia_station where stationid = ?", 12 13 'addpidatq.1' => "SELECT count(*) FROM foltia_subtitle WHERE pid = ?", 14 'addpidatq.2' => "SELECT bitrate,digital FROM foltia_tvrecord , foltia_subtitle WHERE foltia_tvrecord.tid = foltia_subtitle.tid AND pid = ?", 15 'addpidatq.3' => "SELECT stationrecch, digitalch, digitalstationband ,foltia_station.stationid FROM foltia_station,foltia_subtitle WHERE foltia_subtitle.pid = ? AND foltia_subtitle.stationid = foltia_station.stationid", 16 'addpidatq.4' => "SELECT * FROM foltia_subtitle WHERE pid = ?", 17 18 'changestbch.1' => "SELECT foltia_station.tunertype, foltia_station.tunerch, foltia_station.stationrecch, foltia_station.stationid FROM foltia_subtitle, foltia_station WHERE foltia_subtitle.stationid = foltia_station.stationid AND foltia_subtitle.pid = ?", 19 20 'envpolicyupdate.1' => "SELECT userclass,name,passwd1 FROM foltia_envpolicy", 21 22 'foltialib.getstationid.1' => "SELECT count(*) FROM foltia_station WHERE stationname = ?", 23 'foltialib.getstationid.2' => "SELECT stationid,stationname FROM foltia_station WHERE stationname = ?", 24 'foltialib.getstationid.3' => "SELECT max(stationid) FROM foltia_station", 25 'foltialib.getstationid.4' => "INSERT INTO foltia_station (stationid, stationname, stationrecch) VALUES (?, ?, ?)", 26 'foltialib.getpidbympegfilename.1' => "SELECT pid FROM foltia_subtitle WHERE m2pfilename = ? LIMIT 1", 27 'foltialib.changefilestatus.1' => "UPDATE foltia_subtitle SET filestatus = ?, lastupdate = now() WHERE pid = ?", 28 'foltialib.getfilestatus.1' => "SELECT filestatus FROM foltia_subtitle WHERE pid = ?", 29 30 'getxml2db.1' => "SELECT count(*) FROM foltia_program WHERE tid = ?", 31 'getxml2db.2' => "INSERT into foltia_program VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)", 32 'getxml2db.3' => "SELECT title FROM foltia_program WHERE tid = ?", 33 'getxml2db.4' => "UPDATE foltia_program SET title = ? where tid = ?", 34 'getxml2db.5' => "SELECT count(*) FROM foltia_subtitle WHERE tid = ? AND pid = ?", 35 'getxml2db.6' => "UPDATE foltia_subtitle SET stationid = ?, countno = ?, subtitle = ?, startdatetime = ?, enddatetime = ?, startoffset = ?, lengthmin = ? WHERE tid = ? AND pid = ?", 36 'getxml2db.7' => "UPDATE foltia_subtitle SET stationid = ?, countno = ?, subtitle = ?, startdatetime = ?, enddatetime = ?, startoffset = ?, lengthmin = ? WHERE tid = ? AND pid = ?", 37 'getxml2db.8' => "INSERT into foltia_subtitle (pid, tid, stationid, countno, subtitle, startdatetime, enddatetime, startoffset, lengthmin) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)", 38 'getxml2db.9' => "INSERT into foltia_subtitle (pid, tid, stationid, countno, subtitle, startdatetime, enddatetime, startoffset, lengthmin) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)", 39 40 'ipodtranscode.1' => "SELECT foltia_subtitle.pid,foltia_subtitle.tid,foltia_subtitle.m2pfilename,filestatus,foltia_program.aspect,foltia_subtitle.countno FROM foltia_subtitle, foltia_program, foltia_m2pfiles WHERE filestatus >= ? AND filestatus < ? AND foltia_program.tid = foltia_subtitle.TID AND foltia_program.PSP = 1 AND foltia_m2pfiles.m2pfilename = foltia_subtitle.m2pfilename ORDER BY enddatetime ASC LIMIT 1", 41 'ipodtranscode.2' => "SELECT title, countno, subtitle FROM foltia_program, foltia_subtitle WHERE foltia_program.tid = foltia_subtitle.tid AND foltia_subtitle.pid = ?", 42 'ipodtranscode.updatemp4file.1' => "UPDATE foltia_subtitle SET PSPfilename = ? WHERE pid = ?", 43 'ipodtranscode.updatemp4file.2' => "INSERT INTO foltia_mp4files VALUES (?, ?)", 44 45 'ipodtranscode.counttranscodefiles.1' => "SELECT count(*) FROM foltia_subtitle, foltia_program, foltia_m2pfiles WHERE filestatus >= ? AND filestatus < ? AND foltia_program.tid = foltia_subtitle.TID AND foltia_program.PSP = 1 AND foltia_m2pfiles.m2pfilename = foltia_subtitle.m2pfilename", 46 47 'mklocalizeddir.1' => "SELECT title FROM foltia_program where tid = ?", 48 49 'recwrap.1' => "UPDATE foltia_subtitle SET m2pfilename = ? WHERE pid = ?", 50 'recwrap.2' => "INSERT into foltia_m2pfiles VALUES (?)", 51 'recwrap.3' => "SELECT psp,aspect,title FROM foltia_program WHERE tid = ?", 52 'recwrap.4' => "SELECT subtitle FROM foltia_subtitle WHERE tid = ? AND countno = ?", 53 'recwrap.5' => "UPDATE foltia_subtitle SET PSPfilename = ? WHERE pid = ?", 54 'recwrap.6' => "INSERT into foltia_mp4files VALUES (?, ?)", 55 'recwrap.7' => "SELECT foltia_subtitle.tid,foltia_subtitle.countno,foltia_subtitle.subtitle,foltia_subtitle.startdatetime ,foltia_subtitle.enddatetime ,foltia_subtitle.lengthmin ,foltia_tvrecord.bitrate , foltia_subtitle.startoffset , foltia_subtitle.pid ,foltia_tvrecord.digital FROM foltia_subtitle ,foltia_tvrecord WHERE foltia_tvrecord.tid = foltia_subtitle.tid AND foltia_tvrecord.tid = ? AND foltia_subtitle.startdatetime = ? AND foltia_tvrecord.digital = 1", 56 57 'schedulecheck.1' => "SELECT count(*) FROM foltia_tvrecord", 58 'schedulecheck.2' => "SELECT tid ,stationid FROM foltia_tvrecord", 59 60 'singletranscode.1' => "SELECT pid FROM foltia_subtitle WHERE m2pfilename = ?", 61 'singletranscode.2' => "SELECT count(*) FROM foltia_subtitle WHERE tid = ? AND countno = ?", 62 'singletranscode.3' => "SELECT count(*) FROM foltia_subtitle WHERE tid = ?", 63 'singletranscode.4' => "SELECT psp,aspect,title FROM foltia_program WHERE tid = ?", 64 'singletranscode.5' => "SELECT subtitle FROM foltia_subtitle WHERE tid = ? AND countno = ?", 65 'singletranscode.6' => "UPDATE foltia_subtitle SET PSPfilename = ? WHERE pid = ?", 66 'singletranscode.7' => "INSERT into foltia_mp4files values (?, ?)", 67 68 'updatem2pfiletable.1' => "DELETE FROM foltia_m2pfiles", 69 'updatem2pfiletable.2' => "INSERT into foltia_m2pfiles values (?)", 70 'updatem2pfiletable.3' => "DELETE FROM foltia_mp4files", 71 'updatem2pfiletable.4' => "INSERT into foltia_mp4files values (?, ?)", 72 73 'xmltv2foltia.chkerase.1' => "DELETE FROM foltia_epg WHERE startdatetime > ? AND ontvchannel = ?", 74 'xmltv2foltia.registdb.1' => "SELECT max(epgid) FROM foltia_epg", 75 'xmltv2foltia.registdb.2' => "INSERT INTO foltia_epg VALUES (?, ?, ?, ?, ?, ?, ?, ?)", 76 77 ); 78 79 1; -
foltia/install/perl/db/SQLite.pl
old new 1 2 require 'db/Pg.pl'; 3 4 $stmt{'foltialib.changefilestatus.1'} = "UPDATE foltia_subtitle SET filestatus = ?, lastupdate = datetime('now', 'localtime') WHERE pid = ?"; 5 6 1; -
foltia/install/perl/deletemovie.pl
old new 16 16 17 17 $path = $0; 18 18 $path =~ s/deletemovie.pl$//i; 19 if ($p wdne "./"){19 if ($path ne "./"){ 20 20 push( @INC, "$path"); 21 21 } 22 22 -
foltia/install/perl/digitaltvrecording.pl
old new 24 24 25 25 $path = $0; 26 26 $path =~ s/digitaltvrecording.pl$//i; 27 if ($p wdne "./"){27 if ($path ne "./"){ 28 28 push( @INC, "$path"); 29 29 } 30 30 … … 111 111 $outputfile = $outputpath.$outputfile ; 112 112 &writelog("digitaltvrecording: DEBUG FILENAME ne null \$outputfile $outputfile "); 113 113 }else{ 114 $outputfile .= `date +%Y%m%d-%H%M --date "1 min "`;114 $outputfile .= strftime("%Y%m%d-%H%M", localtime(time + 60)); 115 115 chomp($outputfile); 116 116 $outputfile .= ".m2t"; 117 117 $outputfilewithoutpath = $outputfile ; -
foltia/install/perl/envpolicyupdate.pl
old new 15 15 16 16 use DBI; 17 17 use DBD::Pg; 18 use DBD::SQLite; 18 19 19 20 $path = $0; 20 21 $path =~ s/envpolicyupdate.pl$//i; 21 if ($p wdne "./"){22 if ($path ne "./"){ 22 23 push( @INC, "$path"); 23 24 } 24 25 … … 32 33 $returnparam = getphpstyleconfig("environmentpolicytoken"); 33 34 eval "$returnparam\n"; 34 35 35 my $data_source = sprintf("dbi:%s:dbname=%s;host=%s;port=%d", 36 $DBDriv,$DBName,$DBHost,$DBPort); 37 $dbh = DBI->connect($data_source,$DBUser,$DBPass) ||die $DBI::error;; 36 $dbh = DBI->connect($DSN,$DBUser,$DBPass) ||die $DBI::error;; 38 37 39 $DBQuery = "SELECT userclass,name,passwd1 FROM foltia_envpolicy "; 40 41 $envph = $dbh->prepare($DBQuery); 38 $envph = $dbh->prepare($stmt{'envpolicyupdate.1'}); 42 39 $envph->execute(); 43 40 44 41 #なければつくる -
foltia/install/perl/folprep.pl
old new 22 22 23 23 $path = $0; 24 24 $path =~ s/folprep.pl$//i; 25 if ($p wdne "./"){25 if ($path ne "./"){ 26 26 push( @INC, "$path"); 27 27 } 28 28 -
foltia/install/perl/foltia_conf1.pl.template
old new 27 27 $phptoolpath = $toolpath ;#php版の初期設定の位置。デフォルトではperlと同じ位置 28 28 29 29 #以下はデフォルトでインストールしてればいじらなくてもいい 30 $main::DBDriv="Pg"; 31 $main::DBHost="localhost"; 32 $main::DBPort="5432"; 33 $main::DBName="foltia"; 30 31 ## for postgresql 32 #$main::DSN="dbi:Pg:dbname=foltia;host=localhost;port=5432"; 33 #require 'db/Pg.pl'; 34 35 ## for sqlite 36 $main::DSN="dbi:SQLite:dbname=/home/foltia/foltia.sqlite"; 37 require 'db/SQLite.pl'; 38 34 39 $main::DBUser="foltia"; 35 40 $main::DBPass=""; 36 41 -
foltia/install/perl/foltialib.pl
old new 3 3 4 4 $path = $0; 5 5 $path =~ s/foltialib.pl$//i; 6 if ($p wdne "./"){6 if ($path ne "./"){ 7 7 push( @INC, "$path"); 8 8 } 9 9 require "foltia_conf1.pl"; … … 12 12 # foltia lib 13 13 use DBI; 14 14 use DBD::Pg; 15 use DBD::SQLite; 16 use POSIX qw(strftime); 15 17 16 17 $DBDriv=$main::DBDriv; 18 $DBHost=$main::DBHost; 19 $DBPort=$main::DBPort; 20 $DBName=$main::DBName; 18 $DSN=$main::DSN; 21 19 $DBUser=$main::DBUser; 22 20 $DBPass=""; 23 21 … … 46 44 #------------------------------ 47 45 sub writelog{ 48 46 my $messages = $_[0]; 49 my $timestump = `date +%Y/%m/%d_%H:%M:%S`;47 my $timestump = strftime("%Y/%m/%d_%H:%M:%S", localtime); 50 48 chomp($timestump); 51 49 if ($debugmode == 1){ 52 50 open (DEBUGLOG , ">>$toolpath/debuglog.txt") || die "Cant write log file.$! \n "; … … 145 143 #戻り値:1 146 144 my $stationname = $_[0] ; 147 145 my $stationid ; 148 my $DBQuery = "SELECT count(*) FROM foltia_station WHERE stationname = '$item{ChName}'";149 146 150 147 my $sth; 151 $sth = $dbh->prepare($DBQuery);152 $sth->execute();148 $sth = $dbh->prepare($stmt{'foltialib.getstationid.1'}); 149 $sth->execute($item{'ChName'}); 153 150 my @stationcount; 154 151 @stationcount= $sth->fetchrow_array; 155 152 156 153 if ($stationcount[0] == 1){ 157 154 #チャンネルID取得 158 $DBQuery = "SELECT stationid,stationname FROM foltia_station WHERE stationname = '$item{ChName}'"; 159 $sth = $dbh->prepare($DBQuery); 160 $sth->execute(); 155 $sth = $dbh->prepare($stmt{'foltialib.getstationid.2'}); 156 $sth->execute($item{'ChName'}); 161 157 @stationinfo= $sth->fetchrow_array; 162 158 #局ID 163 159 $stationid = $stationinfo[0]; … … 165 161 166 162 }elsif($stationcount[0] == 0){ 167 163 #新規登録 168 $DBQuery = "SELECT max(stationid) FROM foltia_station"; 169 $sth = $dbh->prepare($DBQuery); 164 $sth = $dbh->prepare($stmt{'foltialib.getstationid.3'}); 170 165 $sth->execute(); 171 166 @stationinfo= $sth->fetchrow_array; 172 167 my $stationid = $stationinfo[0] ; 173 168 $stationid ++; 174 169 ##$DBQuery = "insert into foltia_station values ('$stationid' ,'$item{ChName}','0','','','','','','')"; 175 170 #新規局追加時は非受信局をデフォルトに 176 $DBQuery = "insert into foltia_station (stationid , stationname ,stationrecch ) values ('$stationid' ,'$item{ChName}','-10')"; 177 178 $sth = $dbh->prepare($DBQuery); 179 $sth->execute(); 171 $sth = $dbh->prepare($stmt{'foltialib.getstationid.4'}); 172 $sth->execute($stationid, $item{'ChName'}, -10); 180 173 #print "Add station;$DBQuery\n"; 181 &writelog("foltialib Add station;$DBQuery");174 &writelog("foltialib Add station;$stmt{'foltialib.getstationid.4'}"); 182 175 }else{ 183 176 184 177 #print "Error getstationid $stationcount[0] stations found. $DBQuery\n"; … … 286 279 return 0 ; 287 280 } 288 281 289 my $DBQuery = "SELECT pid FROM foltia_subtitle WHERE m2pfilename = '$m2pfilename' LIMIT 1 ";290 282 my $sth; 291 $sth = $dbh->prepare($DBQuery);292 $sth->execute();293 #print "$ DBQuery\n";283 $sth = $dbh->prepare($stmt{'foltialib.getpidbympegfilename.1'}); 284 $sth->execute($m2pfilename); 285 #print "$stmt{'foltialib.getpidbympegfilename.1'}\n"; 294 286 my @pidinfo = $sth->fetchrow_array; 295 287 my $pid = $pidinfo[0]; 296 288 … … 311 303 } 312 304 313 305 if ($updatestatus > 0 ){ 314 my $DBQuery = "UPDATE foltia_subtitle SET filestatus = $updatestatus , lastupdate = now() WHERE pid = $pid ";315 306 my $sth; 316 $sth = $dbh->prepare($DBQuery);317 $sth->execute();307 $sth = $dbh->prepare($stmt{'foltialib.changefilestatus.1'}); 308 $sth->execute($updatestatus, $pid); 318 309 return 1; 319 310 }else{ 320 311 &writelog("foltialib changefilestatus ERR Sttus invalid:$updatestatus"); … … 350 341 return 0 ; 351 342 } 352 343 353 my $DBQuery = "SELECT filestatus FROM foltia_subtitle WHERE pid = $pid ";354 344 my $sth; 355 $sth = $dbh->prepare($DBQuery);356 $sth->execute();345 $sth = $dbh->prepare($stmt{'foltialib.getfilestatus.1'}); 346 $sth->execute($pid); 357 347 358 348 my @statusinfo = $sth->fetchrow_array; 359 349 my $status = $statusinfo[0]; -
foltia/install/perl/getxml2db.pl
old new 18 18 use Time::Local; 19 19 use DBI; 20 20 use DBD::Pg; 21 use DBD::SQLite; 21 22 use Digest::MD5 qw(md5_hex); 22 23 23 24 $path = $0; 24 25 $path =~ s/getxml2db.pl$//i; 25 if ($p wdne "./"){26 if ($path ne "./"){ 26 27 push( @INC, "$path"); 27 28 } 28 29 require "foltialib.pl"; … … 47 48 #$uri="http://syobocal.orz.hm/cal_chk.xml"; 48 49 } 49 50 51 $dbh = DBI->connect($DSN,$DBUser,$DBPass) ||die $DBI::error;; 50 52 51 my $data_source = sprintf("dbi:%s:dbname=%s;host=%s;port=%d", 52 $DBDriv,$DBName,$DBHost,$DBPort); 53 54 $dbh = DBI->connect($data_source,$DBUser,$DBPass) ||die $DBI::error;; 55 56 #$dbh->{AutoCommit} = 0; 53 $dbh->{AutoCommit} = 0; 57 54 58 55 # If-Modified-Since使うように変更#2008/11/14 59 56 my $CacheDir = '/tmp/shobocal'; … … 104 101 $programtitlename =~ s/\<\;/</gi; 105 102 $programtitlename =~ s/\>\;/>/gi; 106 103 $programtitlename =~ s/\&\;/\&/gi; 107 $programtitle = $dbh->quote($programtitlename); 104 # $programtitle = $dbh->quote($programtitlename); 105 $programtitle = $programtitlename; 108 106 109 107 Jcode::convert(\$item{ChName},'euc'); 110 108 Jcode::convert(\$item{SubTitle},'euc'); … … 114 112 $programSubTitle =~ s/\<\;/</gi; 115 113 $programSubTitle =~ s/\>\;/>/gi; 116 114 $programSubTitle =~ s/\&\;/\&/gi; 117 $programSubTitle = $dbh->quote($programSubTitle);115 # $programSubTitle = $dbh->quote($programSubTitle); 118 116 119 117 $offsetmin = $item{StOffset}/60; 120 118 $edtime = &syobocaldate2foltiadate($item{EdTime}); … … 126 124 $stationid = &getstationid($item{ChName}); 127 125 #サブタイトル追加------------------------------------------------- 128 126 #番組があるか確認 129 $DBQuery = "SELECT count(*) FROM foltia_program WHERE tid = '$item{TID}'"; 130 $sth = $dbh->prepare($DBQuery); 131 $sth->execute(); 127 $sth = $dbh->prepare($stmt{'getxml2db.1'}); 128 $sth->execute($item{TID}); 132 129 @titlecount= $sth->fetchrow_array; 133 130 134 131 if ($titlecount[0] == 0){ … … 136 133 137 134 #200412012359 138 135 $nomalstarttime = substr($sttime,8,4); 139 $DBQuery = "insert into foltia_program values ($item{TID},$programtitle,'','$nomalstarttime','$length','','','3','1','')";140 # $sth = $dbh->prepare($DBQuery);141 # $sth->execute();142 $oserr = $dbh->do($DBQuery);143 &writelog("getxml2db ADD TV Progtam:$item{TID}:$programtitle");144 145 136 137 $sth = $dbh->prepare($stmt{'getxml2db.2'}); 138 $oserr = $sth->execute($item{TID}, $programtitle, '', $nomalstarttime, $length, '', '', 3, 1, '', ''); 139 &writelog("getxml2db ADD TV Progtam:$item{TID}:$programtitle"); 146 140 }else{ 147 141 #2006/2/26 148 142 #あったら、タイトル確認して 149 $DBQuery = "SELECT title FROM foltia_program WHERE tid = '$item{TID}'"; 150 $sth = $dbh->prepare($DBQuery); 151 $sth->execute(); 143 $sth = $dbh->prepare($stmt{'getxml2db.3'}); 144 $sth->execute($item{TID}); 152 145 @titlearray = $sth->fetchrow_array; 153 146 #更新などされてたらupdate 154 147 #print "$titlearray[0] / $programtitle\n"; 155 148 if ($titlearray[0] ne "$programtitlename" ){ 156 $DBQuery = "UPDATE foltia_program SET title = $programtitle where tid = '$item{TID}' "; 157 # $sth = $dbh->prepare($DBQuery); 158 # $sth->execute(); 159 $oserr = $dbh->do($DBQuery); 149 $sth = $dbh->prepare($stmt{'getxml2db.4'}); 150 $oserr = $sth->execute($programtitle, $item{TID}); 160 151 &writelog("getxml2db UPDATE TV Progtam:$item{TID}:$programtitle"); 161 152 }#end if update 162 153 }# end if TID 163 154 164 155 165 156 #PIDがあるか確認 166 $DBQuery = "SELECT count(*) FROM foltia_subtitle WHERE tid = '$item{TID}' AND pid = '$item{PID}' "; 167 $sth = $dbh->prepare($DBQuery); 168 $sth->execute(); 157 $sth = $dbh->prepare($stmt{'getxml2db.5'}); 158 $sth->execute($item{'TID'}, $item{'PID'}); 169 159 @subticount= $sth->fetchrow_array; 170 160 if ($subticount[0] >= 1){ 171 161 #PIDあったら上書き更新 … … 173 163 # DBD::Pg::st execute failed: ERROR: invalid input syntax for type bigint: "" at /home/foltia/perl/getxml2db.pl line 147. 174 164 #UPDATE foltia_subtitle SET stationid = '42',countno = '8',subtitle = '京都行きます' ,startdatetime = '200503010035' ,enddatetime = '200503010050',startoffset = '0' ,lengthmin = '15' WHERE tid = '550' AND pid = '26000' 175 165 if ($item{Count} == ""){ 176 177 $DBQuery = "UPDATE foltia_subtitle SET 178 stationid = '$stationid', 179 countno = null, 180 subtitle = $programSubTitle , 181 startdatetime = '$recstartdate' , 182 enddatetime = '$recenddate', 183 startoffset = '$offsetmin' , 184 lengthmin = '$length' 185 WHERE tid = '$item{TID}' AND pid = '$item{PID}' "; 186 166 $sth = $dbh->prepare($stmt{'getxml2db.6'}); 167 $oserr = $sth->execute($stationid, undef, $programSubTitle, $recstartdate, $recenddate, $offsetmin, $length, $item{'TID'}, $item{'PID'}); 187 168 }else{ 188 189 $DBQuery = "UPDATE foltia_subtitle SET 190 stationid = '$stationid', 191 countno = '$item{Count}', 192 subtitle = $programSubTitle , 193 startdatetime = '$recstartdate' , 194 enddatetime = '$recenddate', 195 startoffset = '$offsetmin' , 196 lengthmin = '$length' 197 WHERE tid = '$item{TID}' AND pid = '$item{PID}' "; 198 } 199 # $sth = $dbh->prepare($DBQuery); 200 # $sth->execute(); 201 $oserr = $dbh->do($DBQuery); 202 169 $sth = $dbh->prepare($stmt{'getxml2db.7'}); 170 $oserr = $sth->execute($stationid, $item{'Count'}, $programSubTitle, $recstartdate, $recenddate, $offsetmin, $length, $item{'TID'}, $item{'PID'}); 171 } 203 172 }else{ 204 173 #なければ追加 205 174 206 175 #こっちに入る時刻はオフセットされた時刻! 207 176 #そのままキューに入る形で 208 177 if ($item{Count} eq ""){ 209 $DBQuery = "insert into foltia_subtitle values ( '$item{PID}','$item{TID}','$stationid',null,$programSubTitle,'$recstartdate','$recenddate','$offsetmin' ,'$length')"; 178 $sth = $dbh->prepare($stmt{'getxml2db.8'}); 179 $oserr = $sth->execute($item{'PID'}, $item{'TID'}, $stationid, undef, $programSubTitle, $recstartdate, $recenddate, $offsetmin, $length); 210 180 }else{ 211 $DBQuery = "insert into foltia_subtitle values ( '$item{PID}','$item{TID}','$stationid','$item{Count}',$programSubTitle,'$recstartdate','$recenddate','$offsetmin' ,'$length')"; 181 $sth = $dbh->prepare($stmt{'getxml2db.9'}); 182 $oserr = $sth->execute($item{'PID'}, $item{'TID'}, $stationid, $item{'Count'}, $programSubTitle, $recstartdate, $recenddate, $offsetmin, $length); 212 183 } 213 # $sth = $dbh->prepare($DBQuery);214 # $sth->execute();215 $oserr = $dbh->do($DBQuery);216 217 184 } 218 185 219 220 186 #print "$DBQuery\n\n\n"; 221 187 #debug 20050803 222 188 #&writelog("getxml2db $DBQuery"); … … 225 190 }#if 226 191 }#foreach 227 192 228 #$oserr = $dbh->commit;193 $oserr = $dbh->commit; 229 194 ## $dbh->disconnect(); 230 231 -
foltia/install/perl/ipodtranscode.pl
old new 12 12 13 13 use DBI; 14 14 use DBD::Pg; 15 use DBD::SQLite; 15 16 use Jcode; 16 17 17 18 $path = $0; 18 19 $path =~ s/ipodtranscode.pl$//i; 19 if ($p wdne "./"){20 if ($path ne "./"){ 20 21 push( @INC, "$path"); 21 22 } 22 23 require "foltialib.pl"; … … 34 35 } 35 36 36 37 #DB初期化 37 my $data_source = sprintf("dbi:%s:dbname=%s;host=%s;port=%d", 38 $DBDriv,$DBName,$DBHost,$DBPort); 39 $dbh = DBI->connect($data_source,$DBUser,$DBPass) ||die $DBI::error;; 38 $dbh = DBI->connect($DSN,$DBUser,$DBPass) ||die $DBI::error;; 40 39 41 40 # タイトル取得 42 41 #トラコンフラグがたっていてステータス50以上150未満のファイルを古い順にひとつ探す … … 56 55 sleep 30; 57 56 58 57 while ($counttranscodefiles >= 1){ 59 60 $DBQuery = "SELECT foltia_subtitle.pid,foltia_subtitle.tid,foltia_subtitle.m2pfilename,filestatus,foltia_program.aspect ,foltia_subtitle.countno 61 FROM foltia_subtitle, foltia_program, foltia_m2pfiles 62 WHERE filestatus >= $FILESTATUSRECEND AND filestatus < $FILESTATUSTRANSCODECOMPLETE AND foltia_program.tid = foltia_subtitle.TID AND foltia_program.PSP = 1 AND foltia_m2pfiles.m2pfilename = foltia_subtitle.m2pfilename 63 ORDER BY enddatetime ASC 64 LIMIT 1 "; 65 66 $sth = $dbh->prepare($DBQuery); 67 $sth->execute(); 58 $sth = $dbh->prepare($stmt{'ipodtranscode.1'}); 59 $sth->execute($FILESTATUSRECEND, $FILESTATUSTRANSCODECOMPLETE, ); 68 60 @dbparam = $sth->fetchrow_array; 69 61 #print "$dbparam[0],$dbparam[1],$dbparam[2],$dbparam[3],$dbparam[4],$dbparam[5]\n"; 70 62 &writelog("ipodtranscode DEBUG $DBQuery"); … … 85 77 # 実際のトラコン 86 78 # タイトル取得 87 79 if ($pid ne ""){ 88 89 $DBQuery = "SELECT title , countno , subtitle 90 FROM foltia_program, foltia_subtitle 91 WHERE foltia_program.tid = foltia_subtitle.tid 92 AND foltia_subtitle.pid = $pid "; 93 $sth = $dbh->prepare($DBQuery); 94 $sth->execute(); 80 $sth = $dbh->prepare($stmt{'ipodtranscode.2'}); 81 $sth->execute($pid); 95 82 @programtitle = $sth->fetchrow_array; 96 83 $programtitle[0] =~ s/\"/\\"/gi; 97 84 $programtitle[2] =~ s/\"/\\"/gi; … … 388 375 &writelog("ipodtranscode DEBUG mplayer -ss 00:01:20 -vo jpeg:outdir=$pspdirname -ao null -sstep 1 -frames 3 -v 3 $outputfilename"); 389 376 390 377 if (-e "$pspdirname/$thmfilename"){ 391 $timestamp =`date "+%Y%m%d-%H%M%S"`;378 $timestamp = strftime("%Y%m%d-%H%M%S", localtime); 392 379 chomp $timestamp; 393 380 system("convert -crop 160x120+1+3 -resize 165x126\! $pspdirname/00000002.jpg $pspdirname/$thmfilename".$timestamp.".THM"); 394 381 }else{ … … 406 393 407 394 if (-e "${mp4outdir}MAQ${mp4filenamestring}.MP4"){ 408 395 # MP4ファイル名をPIDレコードに書き込み 409 $DBQuery = "UPDATE foltia_subtitle SET PSPfilename = '$mp4filename' WHERE pid = '$pid' "; 410 $sth = $dbh->prepare($DBQuery); 411 $sth->execute(); 412 &writelog("ipodtranscode UPDATEsubtitleDB $DBQuery"); 396 $sth = $dbh->prepare($stmt{'ipodtranscode.updatemp4file.1'}); 397 $sth->execute($mp4filename, $pid); 398 &writelog("ipodtranscode UPDATEsubtitleDB $stmt{'ipodtranscode.updatemp4file.1'}"); 413 399 414 400 # MP4ファイル名をfoltia_mp4files挿入 415 $DBQuery = "insert into foltia_mp4files values ('$tid','$mp4filename') "; 416 $sth = $dbh->prepare($DBQuery); 417 $sth->execute(); 418 &writelog("ipodtranscode UPDATEmp4DB $DBQuery"); 401 $sth = $dbh->prepare($stmt{'ipodtranscode.updatemp4file.2'}); 402 $sth->execute($tid, $mp4filename); 403 &writelog("ipodtranscode UPDATEmp4DB $stmt{'ipodtranscode.updatemp4file.2'}"); 419 404 420 405 &changefilestatus($pid,$FILESTATUSALLCOMPLETE); 421 406 }else{ … … 426 411 }#updatemp4file 427 412 428 413 sub counttranscodefiles(){ 429 my $DBQuery = "SELECT count(*) FROM foltia_subtitle, foltia_program, foltia_m2pfiles 430 WHERE filestatus >= $FILESTATUSRECEND AND filestatus < $FILESTATUSTRANSCODECOMPLETE AND foltia_program.tid = foltia_subtitle.TID AND foltia_program.PSP = 1 AND foltia_m2pfiles.m2pfilename = foltia_subtitle.m2pfilename "; 431 $sth = $dbh->prepare($DBQuery); 432 $sth->execute(); 414 $sth = $dbh->prepare($stmt{'ipodtranscode.counttranscodefiles.1'}); 415 $sth->execute($FILESTATUSRECEND, $FILESTATUSTRANSCODECOMPLETE); 433 416 my @titlecount= $sth->fetchrow_array; 434 417 435 418 return ($titlecount[0]); -
foltia/install/perl/mklocalizeddir.pl
old new 15 15 use Jcode; 16 16 use DBI; 17 17 use DBD::Pg; 18 18 use DBD::SQLite; 19 19 20 20 $path = $0; 21 21 $path =~ s/mklocalizeddir.pl$//i; 22 if ($p wdne "./"){22 if ($path ne "./"){ 23 23 push( @INC, "$path"); 24 24 } 25 25 require "foltialib.pl"; … … 42 42 #.localized用文字列取得 43 43 44 44 #接続 45 my $data_source = sprintf("dbi:%s:dbname=%s;host=%s;port=%d", 46 $DBDriv,$DBName,$DBHost,$DBPort); 47 $dbh = DBI->connect($data_source,$DBUser,$DBPass) ||die $DBI::error;; 45 $dbh = DBI->connect($DSN,$DBUser,$DBPass) ||die $DBI::error;; 48 46 49 47 #検索 50 $DBQuery = "select title from foltia_program where tid=$tid "; 51 $sth = $dbh->prepare($DBQuery); 52 $sth->execute(); 48 $sth = $dbh->prepare($stmt{'mklocalizeddir.1'}); 49 $sth->execute($tid); 53 50 @subticount= $sth->fetchrow_array; 54 51 $title = $subticount[0] ; 55 52 $titleeuc = $title ; -
foltia/install/perl/recwrap.pl
old new 14 14 15 15 use DBI; 16 16 use DBD::Pg; 17 use DBD::SQLite; 17 18 use Schedule::At; 18 19 use Time::Local; 19 20 use Jcode; 20 21 21 22 $path = $0; 22 23 $path =~ s/recwrap.pl$//i; 23 if ($p wdne "./"){24 if ($path ne "./"){ 24 25 push( @INC, "$path"); 25 26 } 26 27 … … 45 46 $digitalch= $ARGV[9] ; 46 47 47 48 #DB初期化 48 my $data_source = sprintf("dbi:%s:dbname=%s;host=%s;port=%d", 49 $DBDriv,$DBName,$DBHost,$DBPort); 50 $dbh = DBI->connect($data_source,$DBUser,$DBPass) ||die $DBI::error;; 49 $dbh = DBI->connect($DSN,$DBUser,$DBPass) ||die $DBI::error;; 51 50 52 51 53 52 if ($usedigital == 1){ … … 56 55 $extension = ".m2p";#MPEG2の拡張子 57 56 } 58 57 59 $outputfile = `date +%Y%m%d-%H%M --date "1 min "`;58 $outputfile = strftime("%Y%m%d-%H%M", localtime(time + 60)); 60 59 chomp($outputfile); 61 60 62 61 if ($tid == 0){ … … 76 75 #デジタルなら 77 76 &writelog("recwrap RECSTART DIGITAL $digitalstationband $digitalch $reclength $stationid 0 $outputfilename $tid $countno friio"); 78 77 #録画 79 $starttime = (`date +%s`);78 $starttime = time(); 80 79 $oserr = system("$toolpath/perl/digitaltvrecording.pl $digitalstationband $digitalch $reclength $stationid 0 $outputfilename $tid $countno friio"); 81 80 $oserr = $oserr / 256; 82 81 … … 118 117 119 118 #録画 120 119 #system("$toolpath/perl/tvrecording.pl $recch $reclength 0 $outputfile $bitrate $tid $countno"); 121 $starttime = (`date +%s`);120 $starttime = time(); 122 121 123 122 $oserr = system("$toolpath/perl/tvrecording.pl $recch $reclength 0 $outputfilename $bitrate $tid $countno"); 124 123 $oserr = $oserr / 256; … … 130 129 }#endif #デジタル優先フラグ 131 130 132 131 #デバイスビジーで即死してないか検出 133 $now = (`date +%s`);132 $now = time(); 134 133 if ($now < $starttime + 100){ #録画プロセス起動してから100秒以内に戻ってきてたら 135 $retrycounter == 0;134 $retrycounter = 0; 136 135 while($now < $starttime + 100){ 137 136 if($retrycounter >= 5){ 138 137 &writelog("recwrap WARNING Giving up recording."); … … 140 139 } 141 140 &writelog("recwrap retry recording $now $starttime"); 142 141 #アナログ録画 143 $starttime = (`date +%s`);142 $starttime = time(); 144 143 if($outputfilename =~ /.m2t$/){ 145 144 $outputfilename =~ s/.m2t$/.m2p/; 146 145 } 147 146 $oserr = system("$toolpath/perl/tvrecording.pl $recch $reclength N $outputfilename $bitrate $tid $countno"); 148 $now = (`date +%s`);147 $now = time(); 149 148 $oserr = $oserr / 256; 150 149 if ($oserr == 1){ 151 150 &writelog("recwrap ABORT recfile exist. in resume process.[$outputfilename] $recch $reclength 0 0 $bitrate $tid $countno $pid"); … … 159 158 160 159 161 160 # m2pファイル名をPIDレコードに書き込み 162 $DBQuery = "UPDATE foltia_subtitle SET m2pfilename = '$outputfilename' WHERE pid = '$pid' "; 163 $sth = $dbh->prepare($DBQuery); 164 $sth->execute(); 165 &writelog("recwrap DEBUG UPDATEDB $DBQuery"); 161 $sth = $dbh->prepare($stmt{'recwrap.1'}); 162 $sth->execute($outputfilename, $pid); 163 &writelog("recwrap DEBUG UPDATEDB $stmt{'recwrap.1'}"); 166 164 &changefilestatus($pid,$FILESTATUSRECEND); 167 165 168 166 # m2pファイル名をPIDレコードに書き込み 169 $DBQuery = "insert into foltia_m2pfiles values ('$outputfilename')"; 170 $sth = $dbh->prepare($DBQuery); 171 $sth->execute(); 172 &writelog("recwrap DEBUG UPDATEDB $DBQuery"); 167 $sth = $dbh->prepare($stmt{'recwrap.2'}); 168 $sth->execute($outputfilename); 169 &writelog("recwrap DEBUG UPDATEDB $stmt{'recwrap.2'}"); 173 170 174 171 # Starlight breaker向けキャプチャ画像作成 175 172 if (-e "$toolpath/perl/captureimagemaker.pl"){ … … 183 180 184 181 # MPEG4 ------------------------------------------------------ 185 182 #MPEG4トラコン必要かどうか 186 $DBQuery = "SELECT psp,aspect,title FROM foltia_program WHERE tid = '$tid' "; 187 $sth = $dbh->prepare($DBQuery); 188 $sth->execute(); 183 $sth = $dbh->prepare($stmt{'recwrap.3'}); 184 $sth->execute($tid); 189 185 @psptrcn= $sth->fetchrow_array; 190 186 if ($psptrcn[0] == 1 ){#トラコン番組 191 187 &writelog("recwrap Launch ipodtranscode.pl"); … … 299 295 #タイムスタンプが最新のMP4ファイル名取得 300 296 my $newestmp4filename = `cd $pspdirname ; ls -t *.MP4 | head -1`; 301 297 if ($newestmp4filename =~ /M4V$tid/){ 302 $nowcountno = $' ;298 $nowcountno = $' ;#' 303 299 $nowcountno++; 304 300 $pspfilnameft = sprintf("%02d",$nowcountno); 305 301 while (-e "$pspdirname/M4V".$pspfilnamehd.$pspfilnameft.".MP4"){ … … 347 343 } 348 344 &writelog("recwrap TRCN WAITING :$trcnprocesses / $cpucores :$outputfilename $loadaverage"); 349 345 sleep 113; 350 sleep ($recch)*5;346 sleep ($recch); //*5; 351 347 } 352 348 } until ($trcnprocesses < $cpucores); 353 349 … … 357 353 system("$toolpath/perl/transcode/vfr4psp.sh $recfolderpath/$outputfilename $pspfilname $pspdirname $psptrcn[1]"); 358 354 &writelog("recwrap TRCNEND vfr4psp.sh $recfolderpath/$outputfilename $pspfilname $pspdirname $psptrcn[1]"); 359 355 #最適化 360 $DBQuery = "SELECT subtitle FROM foltia_subtitle WHERE tid = '$tid' AND countno = '$countno' "; 361 $sth = $dbh->prepare($DBQuery); 362 $sth->execute(); 356 $sth = $dbh->prepare($stmt{'recwrap.4'}); 357 $sth->execute($tid, $countno); 363 358 @programtitle = $sth->fetchrow_array; 364 359 if ( $countno == "0" ){ 365 360 $pspcountno = ""; … … 395 390 &writelog("recwrap THAMI convert -crop 160x120+1+3 -resize 165x126\! $pspdirname/00000002.jpg $pspdirname/M4V$pspdirname.THM "); 396 391 397 392 if (-e "$pspdirname/$thmfilename"){ 398 $timestamp =`date "+%Y%m%d-%H%M%S"`;393 $timestamp = strftime("%Y%m%d-%H%M%S", localtime); 399 394 chomp $timestamp; 400 395 system("convert -crop 160x120+1+3 -resize 165x126\! $pspdirname/00000002.jpg $pspdirname/$thmfilename".$timestamp.".THM"); 401 396 … … 411 406 412 407 413 408 # MP4ファイル名をPIDレコードに書き込み 414 $DBQuery = "UPDATE foltia_subtitle SET PSPfilename = '$mp4filename' WHERE pid = '$pid' "; 415 $sth = $dbh->prepare($DBQuery); 416 $sth->execute(); 417 &writelog("recwrap UPDATEsubtitleDB $DBQuery"); 409 $sth = $dbh->prepare($stmt{'recwrap.5'}); 410 $sth->execute($mp4filename, $pid); 411 &writelog("recwrap UPDATEsubtitleDB $stmt{'recwrap.5'}"); 418 412 419 413 # MP4ファイル名をfoltia_mp4files挿入 420 $DBQuery = "insert into foltia_mp4files values ('$tid','$mp4filename') "; 421 $sth = $dbh->prepare($DBQuery); 422 $sth->execute(); 423 &writelog("recwrap UPDATEmp4DB $DBQuery"); 414 $sth = $dbh->prepare($stmt{'recwrap.6'}); 415 $sth->execute($tid, $mp4filename); 416 &writelog("recwrap UPDATEmp4DB $stmt{'recwrap.6'}"); 424 417 425 418 &changefilestatus($pid,200); 426 419 }#PSPトラコンあり 427 420 428 421 sub continuousrecordingcheck(){ 429 my $now = `date +%s --date "2 min "`;422 my $now = time() + 60 * 2; 430 423 &writelog("recwrap DEBUG continuousrecordingcheck() now $now"); 431 424 my @processes =`ps ax | grep recfriio`; 432 425 … … 473 466 @filenameparts = split(/\./,$starttime); 474 467 $startdatetime = $startdate.$filenameparts[0]; 475 468 #DBから録画中番組のデータ探す 476 $DBQuery = " 477 SELECT foltia_subtitle.tid,foltia_subtitle.countno,foltia_subtitle.subtitle,foltia_subtitle.startdatetime ,foltia_subtitle.enddatetime ,foltia_subtitle.lengthmin ,foltia_tvrecord.bitrate , foltia_subtitle.startoffset , foltia_subtitle.pid ,foltia_tvrecord.digital 478 FROM foltia_subtitle ,foltia_tvrecord 479 WHERE 480 foltia_tvrecord.tid = foltia_subtitle.tid AND 481 foltia_tvrecord.tid = $tid AND 482 foltia_subtitle.startdatetime = $startdatetime AND 483 foltia_tvrecord.digital = 1"; 484 &writelog("recwrap DEBUG continuousrecordingcheck() $DBQuery"); 485 $sth = $dbh->prepare($DBQuery); 469 &writelog("recwrap DEBUG continuousrecordingcheck() $stmt{'recwrap.7'}"); 470 $sth = $dbh->prepare($stmt{'recwrap.7'}); 486 471 &writelog("recwrap DEBUG continuousrecordingcheck() prepare"); 487 $sth->execute();472 $sth->execute($tid, $startdatetime); 488 473 &writelog("recwrap DEBUG continuousrecordingcheck() execute"); 489 474 @recfile = $sth->fetchrow_array; 490 475 &writelog("recwrap DEBUG continuousrecordingcheck() @recfile $recfile[0] $recfile[1] $recfile[2] $recfile[3] $recfile[4] $recfile[5] $recfile[6] $recfile[7] $recfile[8] $recfile[9] "); -
foltia/install/perl/schedulecheck.pl
old new 13 13 14 14 use DBI; 15 15 use DBD::Pg; 16 use DBD::SQLite; 16 17 use Schedule::At; 17 18 use Time::Local; 18 19 19 20 $path = $0; 20 21 $path =~ s/schedulecheck.pl$//i; 21 if ($p wdne "./"){22 if ($path ne "./"){ 22 23 push( @INC, "$path"); 23 24 } 24 25 … … 28 29 system("$toolpath/perl/getxml2db.pl"); 29 30 30 31 #予約番組探し 31 $now = &epoch2foldate( `date +%s`);32 $now = &epoch2foldate(time()); 32 33 $now = &epoch2foldate($now); 33 34 $checkrangetime = $now + 15*60;#15分後まで 34 35 $checkrangetime = &epoch2foldate($checkrangetime); 35 36 36 my $data_source = sprintf("dbi:%s:dbname=%s;host=%s;port=%d", 37 $DBDriv,$DBName,$DBHost,$DBPort); 38 $dbh = DBI->connect($data_source,$DBUser,$DBPass) ||die $DBI::error;; 37 $dbh = DBI->connect($DSN,$DBUser,$DBPass) ||die $DBI::error;; 39 38 40 $DBQuery = "SELECT count(*) FROM foltia_tvrecord "; 41 42 43 $sth = $dbh->prepare($DBQuery); 39 $sth = $dbh->prepare($stmt{'schedulecheck.1'}); 44 40 $sth->execute(); 45 41 @titlecount= $sth->fetchrow_array; 46 42 47 43 if ($titlecount[0] == 0 ){ 48 44 exit; 49 45 }else{ 50 51 $DBQuery = "SELECT tid ,stationid FROM foltia_tvrecord "; 52 $sth = $dbh->prepare($DBQuery); 46 $sth = $dbh->prepare($stmt{'schedulecheck.2'}); 53 47 $sth->execute(); 54 48 while (($tid,$stationid ) = $sth->fetchrow_array()) { 55 49 #キュー再投入 -
foltia/install/perl/singletranscode.pl
old new 27 27 28 28 use DBI; 29 29 use DBD::Pg; 30 use DBD::SQLite; 30 31 use Schedule::At; 31 32 use Time::Local; 32 33 use Jcode; 33 34 34 35 $path = $0; 35 36 $path =~ s/singletranscode.pl$//i; 36 if ($p wdne "./"){37 if ($path ne "./"){ 37 38 push( @INC, "$path"); 38 39 } 39 40 … … 62 63 # -- recwrapからほとんどコピー 63 64 64 65 #PSPトラコン必要かどうか 65 my $data_source = sprintf("dbi:%s:dbname=%s;host=%s;port=%d", 66 67 $DBDriv,$DBName,$DBHost,$DBPort); 68 $dbh = DBI->connect($data_source,$DBUser,$DBPass) ||die $DBI::error;; 66 $dbh = DBI->connect($DSN,$DBUser,$DBPass) ||die $DBI::error;; 69 67 70 68 if ($ARGV[1] != ""){ 71 69 $pid = $ARGV[1] ; 72 70 }else{ 73 $DBQuery = "SELECT pid FROM foltia_subtitle WHERE m2pfilename = '$ARGV[0]' "; 74 $sth = $dbh->prepare($DBQuery); 75 $sth->execute(); 71 $sth = $dbh->prepare($stmt{'singletranscode.1'}); 72 $sth->execute($ARGV[0]); 76 73 @pidarray = $sth->fetchrow_array; 77 74 unless ($pidarray[0] == "" ){ 78 75 $pid = $pidarray[0] … … 85 82 86 83 # 追加部分 87 84 88 $query = "SELECT count(*) FROM foltia_subtitle WHERE tid = '$tid' AND countno = '$countno' "; 89 $sth = $dbh->prepare($query); 90 $sth->execute(); 85 $sth = $dbh->prepare($stmt{'singletranscode.2'}); 86 $sth->execute($tid, $countno); 91 87 @subticount= $sth->fetchrow_array; 92 88 unless ($subticount[0] >= 1){ 93 89 94 $query = "SELECT count(*) FROM foltia_subtitle WHERE tid = '$tid' "; 95 $sth = $dbh->prepare($query); 96 $sth->execute(); 90 $sth = $dbh->prepare($stmt{'singletranscode.3'}); 91 $sth->execute($tid); 97 92 @subticount= $sth->fetchrow_array; 98 93 99 94 unless ($subticount[0] >= 1){ … … 119 114 120 115 # PSP ------------------------------------------------------ 121 116 #PSPトラコン必要かどうか 122 $DBQuery = "SELECT psp,aspect,title FROM foltia_program WHERE tid = '$tid' "; 123 $sth = $dbh->prepare($DBQuery); 124 $sth->execute(); 117 $sth = $dbh->prepare($stmt{'singletranscode.4'}); 118 $sth->execute($tid); 125 119 @psptrcn= $sth->fetchrow_array; 126 120 if ($psptrcn[0] == 1 ){#トラコン番組 127 121 … … 226 219 #タイムスタンプが最新のMP4ファイル名取得 227 220 my $newestmp4filename = `cd $pspdirname ; ls -t *.MP4 | head -1`; 228 221 if ($newestmp4filename =~ /M4V$tid/){ 229 $nowcountno = $' ;222 $nowcountno = $' ;#' 230 223 $nowcountno++; 231 224 $pspfilnameft = sprintf("%02d",$nowcountno); 232 225 while (-e "$pspdirname/M4V".$pspfilnamehd.$pspfilnameft.".MP4"){ … … 260 253 261 254 #最適化 262 255 263 $DBQuery = "SELECT subtitle FROM foltia_subtitle WHERE tid = '$tid' AND countno = '$countno' "; 264 $sth = $dbh->prepare($DBQuery); 265 $sth->execute(); 256 $sth = $dbh->prepare($stmt{'singletranscode.5'}); 257 $sth->execute($tid, $countno); 266 258 @programtitle = $sth->fetchrow_array; 267 259 268 260 if ( $countno == "0" ){ … … 284 276 &writelog("singletranscode THAMI convert -crop 160x120+1+3 -resize 165x126\! $pspdirname/00000002.jpg $pspdirname/M4V$pspdirname.THM "); 285 277 286 278 if (-e "$pspdirname/M4V".$pspfilname.".THM"){ 287 $timestamp =`date "+%Y%m%d-%H%M%S"`;279 $timestamp = strftime("%Y%m%d-%H%M%S", localtime); 288 280 chomp $timestamp; 289 281 system("convert -crop 160x120+1+3 -resize 165x126\! $pspdirname/00000002.jpg $pspdirname/M4V".$pspfilname.".THM.".$timestamp.".THM"); 290 282 … … 296 288 # rm -rf 00000002.jpg 297 289 system("rm -rf $pspdirname/0000000*.jpg "); 298 290 299 300 301 302 291 # MP4ファイル名をPIDレコードに書き込み 303 292 unless ($pid eq ""){ 304 $DBQuery = " 305 UPDATE foltia_subtitle 306 SET PSPfilename = 'M4V$pspfilname.MP4' 307 WHERE pid = '$pid' "; 308 $sth = $dbh->prepare($DBQuery); 309 $sth->execute(); 310 &writelog("singletranscode UPDATEsubtitleDB $DBQuery"); 293 $sth = $dbh->prepare($stmt{'singletranscode.6'}); 294 $sth->execute("M4V$pspfilname.MP4", $pid); 295 &writelog("singletranscode UPDATEsubtitleDB $stmt{'singletranscode.6'}"); 311 296 }else{ 312 297 &writelog("singletranscode PID not found"); 313 298 } 314 299 # MP4ファイル名をfoltia_mp4files挿入 315 $DBQuery = "insert into foltia_mp4files values ('$tid','M4V$pspfilname.MP4') "; 316 $sth = $dbh->prepare($DBQuery); 317 $sth->execute(); 318 &writelog("singletranscode UPDATEmp4DB $DBQuery"); 300 $sth = $dbh->prepare($stmt{'singletranscode.7'}); 301 $sth->execute($tid, "M4V$pspfilname.MP4"); 302 &writelog("singletranscode UPDATEmp4DB $stmt{'singletranscode.7'}"); 319 303 320 304 }#PSPトラコンあり 321 322 -
foltia/install/perl/tvrecording.pl
old new 28 28 29 29 $path = $0; 30 30 $path =~ s/tvrecording.pl$//i; 31 if ($p wdne "./"){31 if ($path ne "./"){ 32 32 push( @INC, "$path"); 33 33 } 34 34 … … 300 300 # if ($ARGV[3] =~ /[0-9]{8}-[0-9]{4}/){ 301 301 # $outputfile .= "$ARGV[3]"; 302 302 # }else{ 303 # $outputfile .= `date +%Y%m%d-%H%M --date "1 min "`;303 # $outputfile .= strftime("%Y%m%d-%H%M", localtime(time + 60)); 304 304 # } 305 305 $outputfile = $ARGV[3]; 306 306 $outputfile = &filenameinjectioncheck($outputfile); 307 307 $outputfilewithoutpath = $outputfile ; 308 308 $outputfile = $outputpath.$outputfile ; 309 309 # $outputfile .= "$ARGV[3]"; 310 # $outputfile .= `date +%Y%m%d-%H%M --date "1 min "`;310 # $outputfile .= strftime("%Y%m%d-%H%M", localtime(time + 60)); 311 311 &writelog("tvrecording: DEBUG ARGV[2] ne null \$outputfile $outputfile "); 312 312 }else{ 313 $outputfile .= `date +%Y%m%d-%H%M --date "1 min "`;313 $outputfile .= strftime("%Y%m%d-%H%M", localtime(time + 60)); 314 314 chomp($outputfile); 315 315 $outputfile .= ".m2p"; 316 316 $outputfilewithoutpath = $outputfile ; -
foltia/install/perl/updatem2pfiletable.pl
old new 15 15 16 16 use DBI; 17 17 use DBD::Pg; 18 use DBD::SQLite; 18 19 19 20 $path = $0; 20 21 $path =~ s/updatem2pfiletable.pl$//i; 21 if ($p wdne "./"){22 if ($path ne "./"){ 22 23 push( @INC, "$path"); 23 24 } 24 25 25 26 require "foltialib.pl"; 26 my $data_source = sprintf("dbi:%s:dbname=%s;host=%s;port=%d", 27 $DBDriv,$DBName,$DBHost,$DBPort); 28 $dbh = DBI->connect($data_source,$DBUser,$DBPass) ||die $DBI::error;; 27 $dbh = DBI->connect($DSN,$DBUser,$DBPass) ||die $DBI::error;; 29 28 30 29 $dbh->{AutoCommit} = 0; 31 30 # ひとまず消す 32 $query = "DELETE FROM foltia_m2pfiles "; 33 $sth = $dbh->prepare($query); 31 $sth = $dbh->prepare($stmt{'updatem2pfiletable.1'}); 34 32 $sth->execute(); 35 33 36 34 while ($file = glob("$recfolderpath/*.m2?")) { 37 35 $file =~ s/$recfolderpath\///; 38 $query = "insert into foltia_m2pfiles values ('$file')";39 $oserr = $dbh->do($query);36 $sth = $dbh->prepare($stmt{'updatem2pfiletable.2'}); 37 $sth->execute($file); 40 38 # print "$file\n"; 41 39 }#while 42 40 $oserr = $dbh->commit; … … 45 43 @mp4filelist = `find ${recfolderpath}/ | grep MP4`;#by foltia dev ticket #5 http://www.dcc-jpl.com/foltia/ticket/5 46 44 47 45 # ひとまず消す 48 $query = "DELETE FROM foltia_mp4files "; 49 $sth = $dbh->prepare($query); 46 $sth = $dbh->prepare($stmt{'updatem2pfiletable.3'}); 50 47 $sth->execute(); 51 48 52 49 … … 57 54 $filetid = $fileline[0]; 58 55 $filetid =~ s/[^0-9]//g; 59 56 if (($filetid ne "" )&& ($fileline[2] ne "" )){ 60 $ query = "insert into foltia_mp4files values ('$filetid','$fileline[2]')";61 $oserr = $ dbh->do($query);57 $sth = $dbh->prepare($stmt{'updatem2pfiletable.4'}); 58 $oserr = $sth->execute($filetid, $fileline[2]); 62 59 #print "$filetid;$fileline[2];$query\n" 63 60 # http://www.atmarkit.co.jp/fnetwork/rensai/sql03/sql1.html 64 61 }#end if -
foltia/install/perl/xmltv2foltia.pl
old new 29 29 use Time::Local; 30 30 use DBI; 31 31 use DBD::Pg; 32 use DBD::SQLite; 32 33 33 34 $path = $0; 34 35 $path =~ s/xmltv2foltia.pl$//i; 35 if ($p wdne "./"){36 if ($path ne "./"){ 36 37 push( @INC, "$path"); 37 38 } 38 39 require "foltialib.pl"; 39 40 40 41 $currentworkdate = "" ; 41 42 $currentworkch = "" ; 42 $today = `date "+%Y%m%d"`;43 $todaytime = `date "+%Y%m%d%H%M"`;43 $today = strftime("%Y%m%d", localtime); 44 $todaytime = strftime("%Y%m%d%H%M", localtime); 44 45 45 46 # DB Connect 46 my $data_source = sprintf("dbi:%s:dbname=%s;host=%s;port=%d", 47 $DBDriv,$DBName,$DBHost,$DBPort); 48 $dbh = DBI->connect($data_source,$DBUser,$DBPass) ||die $DBI::error;; 47 $dbh = DBI->connect($DSN,$DBUser,$DBPass) ||die $DBI::error;; 48 $dbh->{AutoCommit} = 0; 49 49 50 50 while(<>){ 51 51 #print $_; … … 186 186 187 187 }elsif(/<\/programme>/){ 188 188 #登録処理はココで 189 #&writelog("xmltv2foltia DEBUG call chkerase $item{ start},$item{channel}");189 #&writelog("xmltv2foltia DEBUG call chkerase $item{'start'},$item{'channel'}"); 190 190 191 &chkerase($item{start},$item{channel});192 if ($item{subtitle} ne "" ){193 $registdesc = $item{subtitle}." ".$item{desc};191 &chkerase($item{'start'}, $item{'channel'}); 192 if ($item{'subtitle'} ne "" ){ 193 $registdesc = $item{'subtitle'}." ".$item{'desc'}; 194 194 }else{ 195 $registdesc = $item{desc};195 $registdesc = $item{'desc'}; 196 196 } 197 ®istdb($item{start},$item{stop},$item{channel},$item{title},$registdesc ,$item{category});197 ®istdb($item{'start'},$item{'stop'},$item{'channel'},$item{'title'},$registdesc ,$item{'category'}); 198 198 199 199 # print "$item{start} 200 200 #$item{stop} … … 215 215 }# endif 216 216 }# while 217 217 218 $dbh->commit; 219 220 #end 221 ################ 222 218 223 sub chkerase{ 219 224 # xmltvからきた日付とチャンネルをfoltia epgと比較 220 225 my $foltiastarttime = $_[0]; # 14桁 … … 231 236 my $epgstartdatetime = $today * 10000 ; # 200508070000 12桁 232 237 # 新規に入る予定の未来の番組表、全部いったん消す 233 238 # $DBQuery = "DELETE from foltia_epg where startdatetime > $epgstartdatetime AND ontvchannel = '$ontvepgchannel' "; 234 $DBQuery = "DELETE from foltia_epg where startdatetime > $todaytime AND ontvchannel = '$ontvepgchannel' "; 235 $sth = $dbh->prepare($DBQuery); 236 $sth->execute(); 237 &writelog("xmltv2foltia DELETE EPG $epgstartdatetime:$DBQuery"); 239 $sth = $dbh->prepare($stmt{'xmltv2foltia.chkerase.1'}); 240 $sth->execute($todaytime, $ontvepgchannel); 241 &writelog("xmltv2foltia DELETE EPG $epgstartdatetime:$stmt{'xmltv2foltia.chkerase.1'}"); 238 242 #$currentworkdate = "$today"; 239 243 $currentworkch = $ontvepgchannel ; 240 244 }else{ … … 260 265 261 266 if($foltiastarttime > $todaytime){ 262 267 263 my $DBQuery = "SELECT max(epgid) FROM foltia_epg "; 264 $sth = $dbh->prepare($DBQuery); 268 $sth = $dbh->prepare($stmt{'xmltv2foltia.registdb.1'}); 265 269 $sth->execute(); 266 270 @currentepgid = $sth->fetchrow_array; 267 271 … … 273 277 } 274 278 #&writelog("xmltv2foltia DEBUG $currentepgid[0] / $newepgid"); 275 279 my $lengthmin = &calclength($foltiastarttime , $foltiaendtime); 276 $newepgid = $dbh->quote($newepgid ); 277 $foltiastarttime = $dbh->quote($foltiastarttime); 278 $foltiaendtime = $dbh->quote($foltiaendtime ); 279 $lengthmin = $dbh->quote($lengthmin ); 280 $channel = $dbh->quote($channel ); 281 $title = $dbh->quote($title); 282 $desc = $dbh->quote($desc); 283 $category = $dbh->quote($category); 284 285 $DBQuery = "insert into foltia_epg values ($newepgid,$foltiastarttime,$foltiaendtime,$lengthmin,$channel,$title,$desc,$category)"; 286 # $DBQuery = $dbh->quote($DBQuery); 287 $sth = $dbh->prepare($DBQuery); 288 $sth->execute(); 289 280 # $newepgid = $dbh->quote($newepgid ); 281 # $foltiastarttime = $dbh->quote($foltiastarttime); 282 # $foltiaendtime = $dbh->quote($foltiaendtime ); 283 # $lengthmin = $dbh->quote($lengthmin ); 284 # $channel = $dbh->quote($channel ); 285 # $title = $dbh->quote($title); 286 # $desc = $dbh->quote($desc); 287 # $category = $dbh->quote($category); 288 289 $sth = $dbh->prepare($stmt{'xmltv2foltia.registdb.2'}); 290 $sth->execute($newepgid, $foltiastarttime, $foltiaendtime, $lengthmin, $channel, $title, $desc, $category) || 291 warn "error: $newepgid, $foltiastarttime, $foltiaendtime, $lengthmin, $channel, $title, $desc, $category\n"; 290 292 291 293 # &writelog("xmltv2foltia DEBUG $DBQuery"); 292 294 -
foltia/install/php/accountregist.php
old new 57 57 //すでにそのユーザが存在しているかどうか確認 58 58 if ($username != ""){ 59 59 $query = " 60 SELECT memberid ,userclass,name,passwd160 SELECT count(memberid) 61 61 FROM foltia_envpolicy 62 62 WHERE foltia_envpolicy.name = '$username' 63 63 "; 64 64 $isaccountexist = m_query($con, $query, "DBクエリに失敗しました"); 65 $isaccountexistncount = pg_num_rows($isaccountexist);65 $isaccountexistncount = $isaccountexist->fetchColumn(0); 66 66 67 67 if ($isaccountexistncount == 0){ 68 68 //valid … … 84 84 FROM foltia_envpolicy 85 85 "; 86 86 $rs = m_query($con, $query, "DBクエリに失敗しました"); 87 $max rows = pg_num_rows($rs);88 if ($max rows == 0){89 $nextcno = 1;87 $maxid = $rs->fetchColumn(0); 88 if ($maxid) { 89 $nextcno = $maxid + 1; 90 90 }else{ 91 $rowdata = pg_fetch_row($rs, 0); 92 $nextcno = $rowdata[0]; 93 $nextcno++ ; 91 $nextcno = 1; 94 92 } 95 93 96 94 //登録 -
foltia/install/php/delepgp.php
old new 73 73 "; 74 74 75 75 $rs = m_query($con, $query, "DBクエリに失敗しました"); 76 $maxrows = pg_num_rows($rs); 77 78 if ($maxrows == 0) { 76 $rowdata = $rs->fetch(); 77 if (! $rowdate) { 79 78 die_exit("登録番組がありません<BR>"); 80 79 } 81 $rowdata = pg_fetch_row($rs, 0);82 80 83 81 $pid = htmlspecialchars($rowdata[0]); 84 82 $stationid = htmlspecialchars($rowdata[1]); -
foltia/install/php/deletemovie.php
old new 90 86 AND foltia_subtitle.tid = $filesplit[0] 91 87 "; 92 88 $rs = m_query($con, $query, "DBクエリに失敗しました"); 93 $rowdata = pg_fetch_row($rs, $row); 89 $rall = $rs->fetchAll(); 90 $rowdata = $rall[$row]; 94 91 //print" $fName./$rowdata[1]//$rowdata[2]<BR>\n"; 95 92 $title = $rowdata[1]; 96 93 $subtitle = ""; … … 106 102 AND foltia_subtitle.countno = $filesplit[1] 107 103 "; 108 104 $rs = m_query($con, $query, "DBクエリに失敗しました"); 109 $rowdata = pg_fetch_row($rs, $row); 105 $rall = $rs->fetchAll(); 106 $rowdata = $rall[$row]; 110 107 //print" $fName./$rowdata[1]/$rowdata[2]/$rowdata[3]<BR>\n"; 111 108 $title = $rowdata[1]; 112 109 $count = $rowdata[2]; -
foltia/install/php/delreserve.php
old new 43 43 44 44 <?php 45 45 46 47 $tid = getgetnumform(tid); 46 $tid = getgetnumform("tid"); 48 47 if ($tid == "") { 49 48 die_exit("番組がありません<BR>"); 50 49 } 51 $sid = getgetnumform(sid);50 $sid = getgetnumform("sid"); 52 51 if ($sid == "") { 53 52 die_exit("局がありません<BR>"); 54 53 } … … 72 71 WHERE foltia_tvrecord.tid = foltia_program.tid AND foltia_tvrecord.stationid = foltia_station .stationid AND foltia_tvrecord.tid = $tid AND foltia_tvrecord.stationid = $sid "; 73 72 74 73 $rs = m_query($con, $query, "DBクエリに失敗しました"); 75 $maxrows = pg_num_rows($rs); 76 77 if ($maxrows == 0) { 74 $rowdata = $rs->fetch(); 75 if (! $rowdate) { 78 76 die_exit("登録番組がありません<BR>"); 79 77 } 80 $rowdata = pg_fetch_row($rs, 0);81 78 82 79 $tid = htmlspecialchars($rowdata[0]); 83 80 $stationname = htmlspecialchars($rowdata[1]); … … 167 164 ORDER BY foltia_subtitle.startdatetime ASC 168 165 "; 169 166 $rs = m_query($con, $query, "DBクエリに失敗しました"); 170 $maxrows = pg_num_rows($rs); 171 172 if ($maxrows == 0) { 167 $rowdata = $rs->fetch(); 168 if (! $rowdata) { 173 169 echo("放映予定はありません<BR>"); 174 } 175 else{ 176 $maxcols = pg_num_fields($rs); 170 }else{ 171 $maxcols = $rs->columnCount(); 177 172 ?> 178 173 <table BORDER="0" CELLPADDING="0" CELLSPACING="2" WIDTH="100%" BGCOLOR="#bcf1be"> 179 174 <thead> … … 191 186 <tbody> 192 187 <?php 193 188 /* テーブルのデータを出力 */ 194 for ($row = 0; $row < $maxrows; $row++) { /* 行に対応 */189 do { 195 190 echo("<tr>\n"); 196 /* pg_fetch_row で一行取り出す */197 $rowdata = pg_fetch_row($rs, $row);198 199 191 for ($col = 0; $col < $maxcols; $col++) { /* 列に対応 */ 200 192 echo("<td>".htmlspecialchars($rowdata[$col])."<br></td>\n"); 201 193 } 202 194 echo("</tr>\n"); 203 }195 } while ($row = $rs->fetch()); 204 196 }//end if 205 197 ?> 206 198 </tbody> -
foltia/install/php/folcast.php
old new 50 50 51 51 $query = " 52 52 SELECT foltia_program.tid,foltia_program.title, 53 foltia_subtitle.countno , foltia_subtitle.subtitle , foltia_subtitle.startdatetime, foltia_subtitle.pspfilename,foltia_subtitle.lengthmin,foltia_subtitle.enddatetime FROM foltia_subtitle , foltia_program WHERE \"pspfilename\" ~~'M%%' AND foltia_program.tid = foltia_subtitle.tid AND foltia_program.tid = $tid53 foltia_subtitle.countno , foltia_subtitle.subtitle , foltia_subtitle.startdatetime, foltia_subtitle.pspfilename,foltia_subtitle.lengthmin,foltia_subtitle.enddatetime FROM foltia_subtitle , foltia_program WHERE \"pspfilename\" LIKE 'M%%' AND foltia_program.tid = foltia_subtitle.tid AND foltia_program.tid = $tid 54 54 ORDER BY \"enddatetime\" DESC 55 55 offset 0 limit $max 56 56 "; … … 61 61 WHERE foltia_program.tid = $tid 62 62 "; 63 63 $titlers = m_query($con, $query, "DBクエリに失敗しました"); 64 $rowdata = pg_fetch_row($titlers, 0);64 $rowdata = $titlers->fetch(); 65 65 $rsstitle = $rowdata[1]; 66 66 }else{ 67 67 68 68 $query = " 69 69 SELECT foltia_program.tid,foltia_program.title, 70 foltia_subtitle.countno , foltia_subtitle.subtitle , foltia_subtitle.startdatetime, foltia_subtitle.pspfilename,foltia_subtitle.lengthmin,foltia_subtitle.enddatetime FROM foltia_subtitle , foltia_program WHERE \"pspfilename\" ~~'M%%' AND foltia_program.tid = foltia_subtitle.tid ORDER BY \"enddatetime\" DESC70 foltia_subtitle.countno , foltia_subtitle.subtitle , foltia_subtitle.startdatetime, foltia_subtitle.pspfilename,foltia_subtitle.lengthmin,foltia_subtitle.enddatetime FROM foltia_subtitle , foltia_program WHERE \"pspfilename\" LIKE 'M%%' AND foltia_program.tid = foltia_subtitle.tid ORDER BY \"enddatetime\" DESC 71 71 offset 0 limit $max 72 72 "; 73 73 $rsstitle = "新規録画"; … … 96 96 print $header; 97 97 98 98 $rs = m_query($con, $query, "DBクエリに失敗しました"); 99 $maxrows = pg_num_rows($rs);99 $rowdata = $rs->fetch(); 100 100 101 if ( $maxrows == 0) {101 if (! $rowdata) { 102 102 //die_exit("No items"); 103 103 }else{ 104 105 for ($row = 0; $row < $maxrows; $row++) { 106 $rowdata = pg_fetch_row($rs, $row); 107 104 do { 108 105 //$title = mb_convert_encoding($rowdata[1],"UTF-8", "EUC-JP"); 109 106 $tid = $rowdata[0]; 110 107 $title = $rowdata[1]; … … 162 159 $item = mb_convert_encoding($item,"UTF-8", "EUC-JP"); 163 160 print $item ; 164 161 165 }//for 162 } while ($rowdata = $rs->fetch()); //do 166 163 167 164 }//if 168 165 ?> -
foltia/install/php/foltia_config2.php.template
old new 26 26 $usedigital = 1;//Friioなどでデジタル録画をするか 1:する 0:しない 27 27 28 28 // データベース接続設定 29 define("DATABASE_NAME", "foltia"); 30 define("DBHOST", "localhost"); 31 define("USER_NAME" , "foltia" ); 32 define("USER_PASSWORD", "passwd" ); 29 // define("DSN", "pgsql:host=localhost dbname=foltia user=foltia password= "); 30 define("DSN", "sqlite:/home/foltia/foltia.sqlite"); 33 31 34 32 // $mylocalip = "192.168.0.177" ; //動いている機械のIPアドレス 35 33 -
foltia/install/php/foltialib.php
old new 94 94 } 95 95 96 96 /* LIKE 用の文字列のエスケープ */ 97 /* unused 97 98 function escape_like($sql, $quote = TRUE) { 98 99 return ($quote ? "'" : "") . 99 100 str_replace(array("\\\\", "%" , "_" ), … … 101 102 pg_escape_string($sql)) . 102 103 ($quote ? "'" : ""); 103 104 } 105 */ 104 106 105 107 /* SQL 文字列のエスケープ */ 106 108 function escape_string($sql, $quote = FALSE) { … … 109 111 } 110 112 return ($quote ? "'" : "") . 111 113 pg_escape_string($sql) . 114 //sqlite_escape_string($sql) . 112 115 ($quote ? "'" : ""); 113 116 } 114 117 … … 125 128 126 129 /* PostgreSQL サーバに接続 */ 127 130 function m_connect() { 128 /* $con = @pg_connect("host=".DBHOST ." dbname=".DATABASE_NAME . 129 " user=".USER_NAME . 130 " password=".USER_PASSWORD); 131 */ 132 $con = @pg_pconnect("host=".DBHOST ." dbname=".DATABASE_NAME . 133 " user=".USER_NAME . 134 " password=".USER_PASSWORD); 135 136 137 if (!$con) { 138 die_exit("データベースに接続出来ませんでした。"); 131 try { 132 $dbh = new PDO(DSN); 133 $dbh->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); 134 return($dbh); 135 } catch (PDOException $e) { 136 die_exit($e->getMessage() . ": データベースに接続出来ませんでした。"); 139 137 } 140 138 /* データベースと、PHP の内部文字コードが違う場合 */ 141 return($con);142 139 } 143 140 144 141 /* データベースとの接続を切り離す */ 145 function m_close($con) {146 return @pg_close($con);142 function m_close($dbh) { 143 return null; 147 144 } 148 145 149 146 /* SQL 文を実行 */ 150 function m_query($con, $query, $errmessage) { 151 $rtn = @pg_query($con, $query); 152 if (!$rtn) { 147 function m_query($dbh, $query, $errmessage) { 148 try { 149 $rtn = $dbh->query($query); 150 return($rtn); 151 } catch (PDOException $e) { 153 152 /* エラーメッセージに SQL 文を出すのはセキュリティ上良くない!! */ 154 153 $msg = $errmessage . "<br>\n" . 155 @pg_last_error($con) . "<br>\n" . 154 $e->getMessage() . "<br>\n" . 155 var_export($e->errorInfo, true) . "<br>\n" . 156 156 "<small><code>" . htmlspecialchars($query) . 157 157 "</code></small>\n"; 158 $rtn = @pg_query($con, "rollback");//04.4.8 159 m_close($con);158 // $dbh->rollBack(); 159 $dbh = null; 160 160 die_exit($msg); 161 161 } 162 return($rtn);163 162 } 164 163 165 164 /* select した結果をテーブルで表示 */ 166 165 function m_showtable($rs) { 167 166 /* 検索件数 */ 168 $maxrows = pg_num_rows($rs);167 $maxrows = 0; 169 168 170 if ($maxrows == 0) { 169 $rowdata = $rs->fetch(); 170 if (! $rowdata) { 171 171 echo("<p class=\"msg\">データが存在しません</p>\n"); 172 172 return 0; 173 173 } 174 174 175 175 /* フィールド数 */ 176 $maxcols = pg_num_fields($rs);176 $maxcols = $rs->columnCount(); 177 177 ?> 178 178 <table class="list" summary="データ検索結果を表示" border="1"> 179 179 <thead> … … 182 182 /* テーブルのヘッダーを出力 */ 183 183 for ($col = 1; $col < $maxcols; $col++) { 184 184 /* pg_field_name() はフィールド名を返す */ 185 $f_name = htmlspecialchars(pg_field_name($rs, $col)); 185 $meta = $rs->getColumnMeta($col); 186 $f_name = htmlspecialchars($meta["name"]); 186 187 echo("<th abbr=\"$f_name\">$f_name</th>\n"); 187 188 } 188 189 ?> … … 191 192 <tbody> 192 193 <?php 193 194 /* テーブルのデータを出力 */ 194 for ($row = 0; $row < $maxrows; $row++) { /* 行に対応 */ 195 do { 196 $maxrows++; 197 195 198 echo("<tr>\n"); 196 /* pg_fetch_row で一行取り出す */197 $rowdata = pg_fetch_row($rs, $row);198 199 /* 1列目にリンクを張る */ 199 200 echo("<td><a href=\"edit.php?q_code=" . 200 201 urlencode($rowdata[0]) . "\">" . … … 203 204 echo("<td>".htmlspecialchars($rowdata[$col])."<br></td>\n"); 204 205 } 205 206 echo("</tr>\n"); 206 }207 } while ($rowdata = $rs->fetch()); 207 208 ?> 208 209 </tbody> 209 210 </table> … … 212 213 } 213 214 214 215 /* 指定したコードのデータを表示 */ 215 function m_viewdata($con, $code) {216 function m_viewdata($dbh, $code) { 216 217 /* コードに該当するデータを検索 */ 218 /* 217 219 $query = " 218 220 select p.code 219 221 ,p.name … … 224 226 ,to_char(p.editdate, 'YYYY/MM/DD HH24:MI:SS') as editdate 225 227 from inet_profile p left join inet_job s on p.job = s.code 226 228 where p.code = $code"; 227 $rs = m_query($con, $query, "個人情報の取得に失敗しました。"); 228 if (pg_num_rows($rs) == 0) { 229 */ 230 $query = " 231 select p.code 232 ,p.name 233 ,p.email 234 ,p.pseudonym 235 ,s.name as job 236 ,p.profile 237 ,datetime(p.editdate) as editdate 238 from inet_profile p left join inet_job s on p.job = s.code 239 where p.code = $code"; 240 $rs = m_query($dbh, $query, "個人情報の取得に失敗しました。"); 241 $rowdata = $rs->fetch(); 242 if (! $rowdata) { 229 243 echo("<p class=\"msg\">データが存在しません</p>\n"); 230 244 return FALSE; 231 245 } 232 246 233 247 /* フィールド数 */ 234 $maxcols = pg_num_fields($rs); 235 /* 先頭行 */ 236 $rowdata = pg_fetch_row($rs, 0); 248 $maxcols = $rs->columnCount(); 237 249 ?> 238 250 <table class="view" summary="データベース上のデータを表示" border="1"> 239 251 <tr> 240 <td class="name"><?= htmlspecialchars(pg_field_name($rs, 1)) ?></td> 252 <?php $meta = $rs->getColumnMeta(1); ?> 253 <td class="name"><?= htmlspecialchars($meta["name"]) ?></td> 241 254 <td><a href="edit.php?q_code=<?= $rowdata[0] ?>" 242 255 ><?= htmlspecialchars($rowdata[1]) ?></a></td> 243 256 </tr> 244 <?php for ($col = 2; $col < $maxcols; $col++) { ?> 257 <?php for ($col = 2; $col < $maxcols; $col++) { 258 $meta = $rs->getColumnMeta($col); ?> 245 259 <tr> 246 <td class="name"><?= htmlspecialchars(pg_field_name($rs, $col)) ?></td>260 <td class="name"><?= htmlspecialchars($meta["name"]) ?></td> 247 261 <td><?= htmlspecialchars($rowdata[$col]) ?></td> 248 262 </tr> 249 263 <?php } ?> 250 264 </table> 251 265 <?php 252 266 /* クエリーを解放 */ 253 pg_free_result($rs); 254 267 $rs = null; 255 268 return TRUE; 256 269 } 257 270 … … 293 306 ORDER BY foltia_epg.startdatetime ASC 294 307 "; 295 308 $rs = m_query($con, $query, "DBクエリに失敗しました"); 296 $ maxrows = pg_num_rows($rs);297 if ($maxrows == 0) {309 $rowdata = $rs->fetch(); 310 if (! $rowdata) { 298 311 print("番組データがありません<BR>"); 299 312 }else{ 300 313 print "<table width=\"100%\" border=\"0\">\n"; 301 314 //print "<ul><!-- ($maxrows) $query -->\n"; 302 315 303 for ($row = 0; $row < $maxrows; $row++) { 304 305 $rowdata = pg_fetch_row($rs, $row); 306 316 do { 307 317 $printstarttime = substr($rowdata[0],8,2) . ":" . substr($rowdata[0],10,2); 308 318 $tdclass = "t".substr($rowdata[0],8,2) . substr($rowdata[0],10,2); 309 319 $title = htmlspecialchars($rowdata[3]); … … 322 332 $printstarttime <A HREF=\"./reserveepg.php?epgid=$epgid\">$title</A> $desc($rowdata[0] - $rowdata[1]) 323 333 </li>\n"; 324 334 */ 325 }//for 335 } while ($rowdata = $rs->fetch());//do 326 336 //print "</ul>\n"; 327 337 print "</table>\n"; 328 338 … … 556 566 WHERE foltia_envpolicy.name = '$name' 557 567 "; 558 568 $useraccount = m_query($con, $query, "DBクエリに失敗しました"); 559 $useraccountrows = pg_num_rows($useraccount); 569 $rowdata = $useraccount->fetch(); 570 if (! $rowdata) { 571 header("HTTP/1.0 401 Unauthorized"); 572 redirectlogin(); 573 } 560 574 561 if ($useraccountrows == 1 ){562 $rowdata = pg_fetch_row($useraccount, 0);563 575 $memberid = $rowdata[0]; 564 576 $userclass = $rowdata[1]; 565 577 $username = $rowdata[2]; 566 578 $dbpasswd = $rowdata[3]; 567 }else{ 579 580 $rowdata = $useraccount->fetch(); 581 if ($rowdata) { 568 582 header("HTTP/1.0 401 Unauthorized"); 569 //print "<!-- DEBUG DB record error ($useraccountrows)-->";570 583 redirectlogin(); 571 }//end if 572 584 } 573 585 574 586 // passwdをdbから取りだし 575 587 if ($userclass == 0){ … … 626 638 WHERE foltia_envpolicy.name = '$username' 627 639 "; 628 640 $useraccount = m_query($con, $query, "DBクエリに失敗しました"); 629 $useraccountrows = pg_num_rows($useraccount); 641 $rowdata = $useraccount->fetch(); 642 if (! $rowdata) { 643 return (99); 644 } 630 645 631 if ($useraccountrows == 1 ){ 632 $rowdata = pg_fetch_row($useraccount, 0); 633 //$userclass = $rowdata[1]; 634 return ($rowdata[1]); 635 }else{ 636 return (99);//エラー 637 }//end if 646 $userclass = $rowdata[1]; 647 648 $rowdata = $useraccount->fetch(); 649 if ($rowdata) { 650 return (99); 651 } 652 653 return ($userclass); 638 654 639 655 }else{ 640 656 return (0);//環境ポリシー使わないときはつねに特権モード … … 654 670 WHERE foltia_envpolicy.name = '$username' 655 671 "; 656 672 $useraccount = m_query($con, $query, "DBクエリに失敗しました"); 657 $useraccountrows = pg_num_rows($useraccount); 658 659 if ($useraccountrows == 1 ){ 660 $rowdata = pg_fetch_row($useraccount, 0); 661 //$userclass = $rowdata[1]; 662 return ($rowdata[0]); 663 }else{ 673 $rowdata = $useraccount->fetch(); 674 if (! $rowdata) { 664 675 return (-1);//エラー 665 }//end if 676 } 677 678 $memberid = $rowdata[0]; 679 680 $rowdata = $useraccount->fetch(); 681 if ($rowdata) { 682 return (-1); 683 } 684 685 return ($memberid); 666 686 667 687 }else{ 668 688 return (0);//環境ポリシー使わないときはつねに特権モード … … 681 701 WHERE foltia_envpolicy.memberid = '$memberid' 682 702 "; 683 703 $useraccount = m_query($con, $query, "DBクエリに失敗しました"); 684 $useraccountrows = pg_num_rows($useraccount); 685 686 if ($useraccountrows == 1 ){ 687 $rowdata = pg_fetch_row($useraccount, 0); 688 return ($rowdata[2]); 689 }else{ 704 $rowdata = $useraccount->fetch(); 705 if (! $rowdata) { 690 706 return ("");//エラー 691 }//end if707 } 692 708 693 }else{ 709 $name = $rowdata[2]; 710 711 $rowdata = $useraccount->fetch(); 712 if ($rowdata) { 694 713 return (""); 695 }//end if 714 } 696 715 716 return ($name); 697 717 718 }else{ 719 return (""); 720 }//end if 698 721 699 722 }//end function getmemberid2name 700 723 -
foltia/install/php/graytable.css
old new 1 body * {margin:0px;padding:0px;border:0px;}1 // body * {margin:0px;padding:0px;border:0px;} 2 2 3 3 body { 4 4 color: #555; -
foltia/install/php/index.php
old new 71 71 LIMIT 1000 72 72 "; 73 73 $reservedrssametid = m_query($con, $query, "DBクエリに失敗しました"); 74 $reservedmaxrowssameid = pg_num_rows($reservedrssametid); 75 76 if ($reservedmaxrowssameid > 0 ){ 77 for ($rrow = 0; $rrow < $reservedmaxrowssameid ; $rrow++) { 78 $rowdata = pg_fetch_row($reservedrssametid, $rrow); 74 $rowdata = $reservedrssametid->fetch(); 75 if ($rowdata) { 76 do { 79 77 $reservedpidsametid[] = $rowdata[7]; 80 } 78 } while ($rowdata = $reservedrssametid->fetch()); 79 81 80 $rowdata = ""; 82 $rrow = "";83 81 }else{ 84 $reservedpidsametid = "";82 $reservedpidsametid = array(); 85 83 }//end if 84 $reservedrssametid->closeCursor(); 86 85 87 86 //録画番組検索 88 87 $query = " 89 88 SELECT 90 foltia_program .tid, 91 stationname, 92 foltia_program .title, 93 foltia_subtitle.countno, 94 foltia_subtitle.subtitle, 95 foltia_subtitle.startdatetime , 96 foltia_subtitle.lengthmin , 97 foltia_tvrecord.bitrate , 98 foltia_subtitle.pid 89 foltia_program.tid, stationname, foltia_program.title, 90 foltia_subtitle.countno, foltia_subtitle.subtitle, 91 foltia_subtitle.startdatetime as x, foltia_subtitle.lengthmin, 92 foltia_tvrecord.bitrate, foltia_subtitle.pid 99 93 FROM foltia_subtitle , foltia_program ,foltia_station ,foltia_tvrecord 100 94 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 101 95 AND foltia_subtitle.enddatetime >= '$now' 102 96 UNION 103 97 SELECT 104 foltia_program .tid, 105 stationname, 106 foltia_program .title, 107 foltia_subtitle.countno, 108 foltia_subtitle.subtitle, 109 foltia_subtitle.startdatetime , 110 foltia_subtitle.lengthmin , 111 foltia_tvrecord.bitrate , 112 foltia_subtitle.pid 98 foltia_program.tid, stationname, foltia_program.title, 99 foltia_subtitle.countno, foltia_subtitle.subtitle, 100 foltia_subtitle.startdatetime, foltia_subtitle.lengthmin, 101 foltia_tvrecord.bitrate, foltia_subtitle.pid 113 102 FROM foltia_tvrecord 114 103 LEFT OUTER JOIN foltia_subtitle on (foltia_tvrecord.tid = foltia_subtitle.tid ) 115 104 LEFT OUTER JOIN foltia_program on (foltia_tvrecord.tid = foltia_program.tid ) 116 105 LEFT OUTER JOIN foltia_station on (foltia_subtitle.stationid = foltia_station.stationid ) 117 106 WHERE foltia_tvrecord.stationid = 0 AND 118 foltia_subtitle.enddatetime >= '$now' ORDER BY \"startdatetime\" ASC 107 foltia_subtitle.enddatetime >= '$now' ORDER BY x ASC 119 108 LIMIT 1000 120 109 "; 121 110 122 111 $reservedrs = m_query($con, $query, "DBクエリに失敗しました"); 123 $reservedmaxrows = pg_num_rows($reservedrs); 124 125 if ($reservedmaxrows > 0 ){ 126 for ($rrow = 0; $rrow < $reservedmaxrows ; $rrow++) { 127 $rowdata = pg_fetch_row($reservedrs, $rrow); 112 $rowdata = $reservedrs->fetch(); 113 if ($rowdata) { 114 do { 128 115 $reservedpid[] = $rowdata[8]; 129 } 116 } while ($rowdata = $reservedrs->fetch()); 130 117 }else{ 131 $reservedpid = "";118 $reservedpid = array(); 132 119 }//end if 133 120 134 121 $mode = getgetform(mode); … … 137 124 //新番組表示モード 138 125 $query = " 139 126 SELECT 140 foltia_program .tid, 141 stationname, 142 foltia_program .title, 143 foltia_subtitle.countno, 144 foltia_subtitle.subtitle, 145 foltia_subtitle.startdatetime , 146 foltia_subtitle.lengthmin , 147 foltia_subtitle.pid , 148 foltia_subtitle.startoffset 127 foltia_program.tid, stationname, foltia_program.title, 128 foltia_subtitle.countno, foltia_subtitle.subtitle, 129 foltia_subtitle.startdatetime, foltia_subtitle.lengthmin, 130 foltia_subtitle.pid, foltia_subtitle.startoffset 149 131 FROM foltia_subtitle , foltia_program ,foltia_station 150 132 WHERE foltia_program.tid = foltia_subtitle.tid AND foltia_station.stationid = foltia_subtitle.stationid 151 133 AND foltia_subtitle.enddatetime >= '$now' AND foltia_subtitle.countno = '1' 152 134 ORDER BY foltia_subtitle.startdatetime ASC 153 135 LIMIT 1000 154 136 "; 155 $rs = m_query($con, $query, "DBクエリに失敗しました");156 $maxrows = pg_num_rows($rs);157 158 159 137 }else{ 160 138 $query = " 161 139 SELECT 162 foltia_program .tid, 163 stationname, 164 foltia_program .title, 165 foltia_subtitle.countno, 166 foltia_subtitle.subtitle, 167 foltia_subtitle.startdatetime , 168 foltia_subtitle.lengthmin , 169 foltia_subtitle.pid , 170 foltia_subtitle.startoffset 140 foltia_program.tid, stationname, foltia_program.title, 141 foltia_subtitle.countno, foltia_subtitle.subtitle, 142 foltia_subtitle.startdatetime, foltia_subtitle.lengthmin, 143 foltia_subtitle.pid, foltia_subtitle.startoffset 171 144 FROM foltia_subtitle , foltia_program ,foltia_station 172 145 WHERE foltia_program.tid = foltia_subtitle.tid AND foltia_station.stationid = foltia_subtitle.stationid 173 146 AND foltia_subtitle.enddatetime >= '$now' 174 147 ORDER BY foltia_subtitle.startdatetime ASC 175 148 LIMIT 1000 176 149 "; 177 $rs = m_query($con, $query, "DBクエリに失敗しました");178 $maxrows = pg_num_rows($rs);179 180 150 }//end if 181 151 182 if ($maxrows == 0) { 152 $rs = m_query($con, $query, "DBクエリに失敗しました"); 153 $rowdata = $rs->fetch(); 154 if (! $rowdata) { 183 155 header("Status: 404 Not Found",TRUE,404); 184 156 printtitle(); 185 157 print "<body BGCOLOR=\"#ffffff\" TEXT=\"#494949\" LINK=\"#0047ff\" VLINK=\"#000000\" ALINK=\"#c6edff\" > … … 210 182 211 183 <? 212 184 /* フィールド数 */ 213 $maxcols = pg_num_fields($rs);185 $maxcols = $rs->columnCount(); 214 186 ?> 215 187 <table BORDER="0" CELLPADDING="0" CELLSPACING="2" WIDTH="100%"> 216 188 <thead> … … 229 201 <tbody> 230 202 <?php 231 203 /* テーブルのデータを出力 */ 232 for ($row = 0; $row < $maxrows; $row++) { /* 行に対応 */ 233 /* pg_fetch_row で一行取り出す */ 234 $rowdata = pg_fetch_row($rs, $row); 235 204 do { 236 205 //他局で同一番組録画済みなら色変え 237 206 if (in_array($rowdata[7], $reservedpidsametid)) { 238 207 $rclass = "reservedtitle"; … … 282 251 echo("<td>".htmlspecialchars($rowdata[6])."<br></td>\n"); 283 252 284 253 echo("</tr>\n"); 285 } 254 } while ($rowdata = $rs->fetch()); 286 255 ?> 287 256 </tbody> 288 257 </table> -
foltia/install/php/listreserve.php
old new 61 61 } 62 62 $query = " 63 63 SELECT 64 foltia_program .tid, 65 stationname, 66 foltia_program .title, 67 foltia_subtitle.countno, 68 foltia_subtitle.subtitle, 69 foltia_subtitle.startdatetime , 70 foltia_subtitle.lengthmin , 71 foltia_tvrecord.bitrate , 72 foltia_subtitle.startoffset , 73 foltia_subtitle.pid , 74 foltia_subtitle.epgaddedby , 64 foltia_program.tid, stationname, foltia_program.title, 65 foltia_subtitle.countno, foltia_subtitle.subtitle, 66 foltia_subtitle.startdatetime as x, foltia_subtitle.lengthmin, 67 foltia_tvrecord.bitrate, foltia_subtitle.startoffset, 68 foltia_subtitle.pid, foltia_subtitle.epgaddedby, 75 69 foltia_tvrecord.digital 76 70 FROM foltia_subtitle , foltia_program ,foltia_station ,foltia_tvrecord 77 71 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 78 72 AND foltia_subtitle.enddatetime >= '$now' 79 73 UNION 80 74 SELECT 81 foltia_program .tid, 82 stationname, 83 foltia_program .title, 84 foltia_subtitle.countno, 85 foltia_subtitle.subtitle, 86 foltia_subtitle.startdatetime , 87 foltia_subtitle.lengthmin , 88 foltia_tvrecord.bitrate , 89 foltia_subtitle.startoffset , 90 foltia_subtitle.pid , 91 foltia_subtitle.epgaddedby , 75 foltia_program.tid, stationname, foltia_program.title, 76 foltia_subtitle.countno, foltia_subtitle.subtitle, 77 foltia_subtitle.startdatetime, foltia_subtitle.lengthmin, 78 foltia_tvrecord.bitrate, foltia_subtitle.startoffset, 79 foltia_subtitle.pid, foltia_subtitle.epgaddedby, 92 80 foltia_tvrecord.digital 93 81 FROM foltia_tvrecord 94 82 LEFT OUTER JOIN foltia_subtitle on (foltia_tvrecord.tid = foltia_subtitle.tid ) 95 83 LEFT OUTER JOIN foltia_program on (foltia_tvrecord.tid = foltia_program.tid ) 96 84 LEFT OUTER JOIN foltia_station on (foltia_subtitle.stationid = foltia_station.stationid ) 97 85 WHERE foltia_tvrecord.stationid = 0 AND 98 foltia_subtitle.enddatetime >= '$now' ORDER BY \"startdatetime\"ASC86 foltia_subtitle.enddatetime >= '$now' ORDER BY x ASC 99 87 "; 100 88 101 89 $rs = m_query($con, $query, "DBクエリに失敗しました"); 102 $maxrows = pg_num_rows($rs);103 104 90 105 91 //チューナー数 106 92 if (getgetnumform(r) != ""){ … … 121 107 <p align="left">録画予約番組放映予定と予約番組名を表示します。</p> 122 108 123 109 <? 124 if ($maxrows == 0) { 110 $rowdata = $rs->fetch(); 111 if (! $rowdata) { 125 112 print "番組データがありません<BR>\n"; 126 113 }else{ 127 128 129 114 /* フィールド数 */ 130 $maxcols = pg_num_fields($rs);115 $maxcols = $rs->columnCount(); 131 116 ?> 132 117 <table BORDER="0" CELLPADDING="0" CELLSPACING="2" WIDTH="100%"> 133 118 <thead> … … 148 133 <tbody> 149 134 <?php 150 135 /* テーブルのデータを出力 */ 151 for ($row = 0; $row < $maxrows; $row++) { /* 行に対応 */136 do { 152 137 echo("<tr>\n"); 153 /* pg_fetch_row で一行取り出す */ 154 $rowdata = pg_fetch_row($rs, $row); 138 155 139 $pid = htmlspecialchars($rowdata[9]); 156 140 157 141 $tid = htmlspecialchars($rowdata[0]); … … 167 151 //オンボードチューナー録画 168 152 $query = " 169 153 SELECT 170 foltia_program .tid, 171 stationname, 172 foltia_program .title, 173 foltia_subtitle.countno, 174 foltia_subtitle.subtitle, 175 foltia_subtitle.startdatetime , 176 foltia_subtitle.lengthmin , 177 foltia_tvrecord.bitrate , 178 foltia_subtitle.startoffset , 179 foltia_subtitle.pid , 180 foltia_tvrecord.digital 154 foltia_program.tid, stationname, foltia_program.title, 155 foltia_subtitle.countno, foltia_subtitle.subtitle, 156 foltia_subtitle.startdatetime, foltia_subtitle.lengthmin, 157 foltia_tvrecord.bitrate, foltia_subtitle.startoffset, 158 foltia_subtitle.pid, foltia_tvrecord.digital 181 159 FROM foltia_subtitle , foltia_program ,foltia_station ,foltia_tvrecord 182 160 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 183 161 AND foltia_subtitle.enddatetime > '$rowdata[5]' 184 162 AND foltia_subtitle.startdatetime < '$endtime' 185 163 UNION 186 164 SELECT 187 foltia_program .tid, 188 stationname, 189 foltia_program .title, 190 foltia_subtitle.countno, 191 foltia_subtitle.subtitle, 192 foltia_subtitle.startdatetime , 193 foltia_subtitle.lengthmin , 194 foltia_tvrecord.bitrate , 195 foltia_subtitle.startoffset , 196 foltia_subtitle.pid , 197 foltia_tvrecord.digital 165 foltia_program.tid, stationname, foltia_program.title, 166 foltia_subtitle.countno, foltia_subtitle.subtitle, 167 foltia_subtitle.startdatetime, foltia_subtitle.lengthmin, 168 foltia_tvrecord.bitrate, foltia_subtitle.startoffset, 169 foltia_subtitle.pid, foltia_tvrecord.digital 198 170 FROM foltia_tvrecord 199 171 LEFT OUTER JOIN foltia_subtitle on (foltia_tvrecord.tid = foltia_subtitle.tid ) 200 172 LEFT OUTER JOIN foltia_program on (foltia_tvrecord.tid = foltia_program.tid ) … … 205 177 "; 206 178 $rclass = ""; 207 179 $overlap = m_query($con, $query, "DBクエリに失敗しました"); 208 $overlapmaxrows = pg_num_rows($overlap); 180 $owrowall = $overlap->fetchAll(); 181 $overlapmaxrows = count($owrowall); 209 182 if ($overlapmaxrows > ($recunits) ){ 210 183 211 184 $owtimeline = array(); 212 185 213 186 for ($rrow = 0; $rrow < $overlapmaxrows ; $rrow++) { 214 $owrowdata = pg_fetch_array($overlap, $rrow);187 $owrowdata = $owrowall[$rrow]; 215 188 $owtimeline[ $owrowdata['startdatetime'] ] = $owtimeline[ $owrowdata['startdatetime'] ] +1; 216 189 217 190 $owrend = calcendtime( $owrowdata['startdatetime'], $owrowdata['lengthmin'] ); … … 236 209 $externalinputs = 1; //現状一系統のみ 237 210 $query = " 238 211 SELECT 239 foltia_program .tid, 240 stationname, 241 foltia_program .title, 242 foltia_subtitle.countno, 243 foltia_subtitle.subtitle, 244 foltia_subtitle.startdatetime , 245 foltia_subtitle.lengthmin , 246 foltia_tvrecord.bitrate , 247 foltia_subtitle.startoffset , 248 foltia_subtitle.pid , 249 foltia_tvrecord.digital 212 foltia_program.tid, stationname, foltia_program.title, 213 foltia_subtitle.countno, foltia_subtitle.subtitle, 214 foltia_subtitle.startdatetime, foltia_subtitle.lengthmin, 215 foltia_tvrecord.bitrate, foltia_subtitle.startoffset, 216 foltia_subtitle.pid, foltia_tvrecord.digital 250 217 FROM foltia_subtitle , foltia_program ,foltia_station ,foltia_tvrecord 251 218 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 252 219 AND foltia_subtitle.enddatetime > '$rowdata[5]' … … 254 221 AND (foltia_station.stationrecch = '0' OR foltia_station.stationrecch = '-1' ) 255 222 UNION 256 223 SELECT 257 foltia_program .tid, 258 stationname, 259 foltia_program .title, 260 foltia_subtitle.countno, 261 foltia_subtitle.subtitle, 262 foltia_subtitle.startdatetime , 263 foltia_subtitle.lengthmin , 264 foltia_tvrecord.bitrate , 265 foltia_subtitle.startoffset , 266 foltia_subtitle.pid , 267 foltia_tvrecord.digital 224 foltia_program.tid, stationname, foltia_program.title, 225 foltia_subtitle.countno, foltia_subtitle.subtitle, 226 foltia_subtitle.startdatetime, foltia_subtitle.lengthmin, 227 foltia_tvrecord.bitrate, foltia_subtitle.startoffset, 228 foltia_subtitle.pid, foltia_tvrecord.digital 268 229 FROM foltia_tvrecord 269 230 LEFT OUTER JOIN foltia_subtitle on (foltia_tvrecord.tid = foltia_subtitle.tid ) 270 231 LEFT OUTER JOIN foltia_program on (foltia_tvrecord.tid = foltia_program.tid ) … … 273 234 foltia_subtitle.enddatetime > '$rowdata[5]' 274 235 AND foltia_subtitle.startdatetime < '$endtime' 275 236 AND (foltia_station.stationrecch = '0' OR foltia_station.stationrecch = '-1' ) 276 277 237 "; 278 238 $eoverlap = m_query($con, $query, "DBクエリに失敗しました"); 279 $eoverlapmaxrows = pg_num_rows($eoverlap); 239 $eowrowall = $eoverlap->fetchAll(); 240 $eoverlapmaxrows = count($eowrowall); 280 241 if ($eoverlapmaxrows > ($externalinputs) ){ 281 242 282 243 $eowtimeline = array(); 283 244 284 245 for ($erow = 0; $erow < $eoverlapmaxrows ; $erow++) { 285 $eowrowdata = pg_fetch_array($eoverlap, $erow);246 $eowrowdata = $eowrowall[$erow]; 286 247 $eowtimeline[ $eowrowdata['startdatetime'] ] = $eowtimeline[ $eowrowdata['startdatetime'] ] +1; 287 248 288 249 $eowrend = calcendtime( $eowrowdata['startdatetime'], $eowrowdata['lengthmin'] ); … … 358 319 } 359 320 echo("<br></td>\n"); 360 321 echo("</tr>\n"); 361 }322 } while ($rowdata = $rs->fetch()); 362 323 ?> 363 324 </tbody> 364 325 </table> … … 373 334 374 335 375 336 <?php 376 } //if ($maxrows == 0) { 377 378 337 } //if ($maxrows == 0) 379 338 $query = " 380 339 SELECT 381 foltia_program.tid, 382 stationname, 383 foltia_program .title , 384 foltia_tvrecord.bitrate , 385 foltia_tvrecord.stationid , 340 foltia_program.tid, stationname, foltia_program.title, 341 foltia_tvrecord.bitrate, foltia_tvrecord.stationid, 386 342 foltia_tvrecord.digital 387 343 FROM foltia_tvrecord , foltia_program , foltia_station 388 344 WHERE foltia_tvrecord.tid = foltia_program.tid AND foltia_tvrecord.stationid = foltia_station .stationid 389 345 ORDER BY foltia_program.tid DESC 390 346 "; 391 347 $rs = m_query($con, $query, "DBクエリに失敗しました"); 392 $maxrows = pg_num_rows($rs); 393 394 if ($maxrows == 0) { 348 $rowdata = $rs->fetch(); 349 if (! $rowdata) { 395 350 //なければなにもしない 396 351 397 352 }else{ 398 $maxcols = pg_num_fields($rs);353 $maxcols = $rs->columnCount(); 399 354 400 355 ?> 401 356 <p align="left">録画予約番組タイトルを表示します。</p> … … 416 371 <tbody> 417 372 <?php 418 373 /* テーブルのデータを出力 */ 419 for ($row = 0; $row < $maxrows; $row++) { /* 行に対応 */ 420 /* pg_fetch_row で一行取り出す */ 421 $rowdata = pg_fetch_row($rs, $row); 422 374 do { 423 375 $tid = htmlspecialchars($rowdata[0]); 424 376 425 377 if ($tid > 0){ … … 467 419 } 468 420 echo("\n</tr>"); 469 421 }//if tid 0 470 }//for422 } while ($rowdata = $rs->fetch()); 471 423 }//else 472 424 ?> 473 425 </tbody> -
foltia/install/php/m.php
old new 98 98 FROM foltia_station 99 99 WHERE stationid = $recstid"; 100 100 $stationvalid = m_query($con, $query, "DBクエリに失敗しました"); 101 $stationcount = pg_num_rows($stationvalid); 102 103 if ($stationcount == 1){ 104 $recstationname = pg_fetch_row($stationvalid, 0); 105 //valid 106 }else{ 101 $recstationname = $stationvalid->fetch(); 102 if (! $recstationname) { 107 103 $errflag = 3; 108 104 $errmsg = "放送局設定が異常です。"; 109 105 } … … 128 124 //min pidを探す 129 125 $query = "SELECT min(pid) FROM foltia_subtitle "; 130 126 $rs = m_query($con, $query, "DBクエリに失敗しました"); 131 $maxrows = pg_num_rows($rs);132 if ($maxrows == 0){127 $rowdata = $rs->fetch(); 128 if (! $rowdata) { 133 129 $insertpid = -1 ; 134 130 }else{ 135 $rowdata = pg_fetch_row($rs, 0);136 131 $insertpid = $rowdata[0]; 137 132 $insertpid-- ; 138 133 } 139 134 // next 話数を探す 140 135 $query = "SELECT max(countno) FROM foltia_subtitle WHERE tid = 0"; 141 136 $rs = m_query($con, $query, "DBクエリに失敗しました"); 142 $maxrows = pg_num_rows($rs);143 if ($maxrows == 0){137 $rowdata = $rs->fetch(); 138 if (! $rowdata) { 144 139 $nextcno = 1 ; 145 140 }else{ 146 $rowdata = pg_fetch_row($rs, 0);147 141 $nextcno = $rowdata[0]; 148 142 $nextcno++ ; 149 143 } … … 214 208 <p>録画局: 215 209 <?php 216 210 $query = " 217 SELECT stationid ,stationname,stationrecch ,digitalch211 SELECT stationid as x, stationname, stationrecch, digitalch 218 212 FROM foltia_station 219 213 WHERE stationrecch > 0 220 214 UNION 221 215 SELECT DISTINCT stationid,stationname,stationrecch ,digitalch 222 216 FROM foltia_station 223 217 WHERE digitalch > 0 224 ORDER BY \"stationid\"ASC";218 ORDER BY x ASC"; 225 219 226 $stations = m_query($con, $query, "DBクエリに失敗しました"); 227 $stationcount = pg_num_rows($stations); 228 229 if ($stationcount > 0 ){ 230 for ($row = 0; $row < $stationcount ; $row++) { 231 $rowdata = pg_fetch_row($stations, $row); 220 $stationcount = $stations->rowCount(); 221 $rowdata = $stations->fetch(); 222 if ($rowdata) { 223 do { 232 224 if ($recstid == $rowdata[0]){ 233 225 print " <input name=\"recstid\" type=\"radio\" value=\"$rowdata[0]\" checked /> $rowdata[1] ($rowdata[2]ch) \n"; 234 226 }else{ 235 227 print " <input name=\"recstid\" type=\"radio\" value=\"$rowdata[0]\" /> $rowdata[1] ($rowdata[2]ch) \n"; 236 228 } 237 }229 } while ($rowdata = $stations->fetch()); 238 230 }else{ 239 231 print "放送局データベースが正しくセットアップされていません。録画可能局がありません"; 240 232 } … … 246 238 ORDER BY \"stationid\" ASC"; 247 239 248 240 $stations = m_query($con, $query, "DBクエリに失敗しました"); 249 $stationcount = pg_num_rows($stations); 250 251 if ($stationcount > 0 ){ 252 for ($row = 0; $row < $stationcount ; $row++) { 253 $rowdata = pg_fetch_row($stations, $row); 241 $rowdata = $stations->fetch(); 242 if ($rowdata) { 243 do { 254 244 if ($rowdata[0] != 0){ 255 245 if ($recstid == $rowdata[0]){ 256 246 print " <input name=\"recstid\" type=\"radio\" value=\"$rowdata[0]\" checked /> $rowdata[1] \n"; … … 259 249 } 260 250 261 251 } 262 } 252 } while ($rowdata = $stations->fetch()); 263 253 } 264 254 /* 265 255 print "<p>デジタル録画を優先:"; -
foltia/install/php/reservecomp.php
old new 68 65 //タイトル取得 69 66 $query = "select title from foltia_program where tid='$tid'"; 70 67 $rs = m_query($con, $query, "DBクエリに失敗しました"); 71 $maxrows = pg_num_rows($rs); 72 73 if ($maxrows == 0) { 68 $rowdata = $rs->fetch(); 69 if (! $rowdata) { 74 70 $title = "(未登録)"; 75 71 }else{ 76 $rowdata = pg_fetch_row($rs, 0);77 72 $title = htmlspecialchars($rowdata[0]); 78 73 } 79 74 … … 129 124 130 125 } 131 126 $rs = m_query($con, $query, "DBクエリに失敗しました"); 132 $maxrows = pg_num_rows($rs); 133 134 if ($maxrows == 0) { 127 $rowdata = $rs->fetch(); 128 if (! $rowdata) { 135 129 echo("放映予定はいまのところありません<BR>"); 136 130 } 137 131 else{ 138 $maxcols = pg_num_fields($rs);132 $maxcols = $rs->columnCount(); 139 133 ?> 140 134 <table BORDER="0" CELLPADDING="0" CELLSPACING="2" WIDTH="100%" BGCOLOR="#bcf1be"> 141 135 <thead> … … 154 148 <tbody> 155 149 <?php 156 150 /* テーブルのデータを出力 */ 157 for ($row = 0; $row < $maxrows; $row++) { /* 行に対応 */ 151 do { 158 152 echo("<tr>\n"); 159 /* pg_fetch_row で一行取り出す */160 $rowdata = pg_fetch_row($rs, $row);161 162 153 for ($col = 0; $col < $maxcols; $col++) { /* 列に対応 */ 163 154 echo("<td>".htmlspecialchars($rowdata[$col])."<br></td>\n"); 164 155 } 165 156 echo("</tr>\n"); 166 } 157 } while ($rowdata = $rs->fetch()); 167 158 }//end if 168 159 ?> 169 160 </tbody> … … 176 167 //foltia_tvrecord 書き込み 177 168 //既存が予約あって、新着が全局予約だったら 178 169 if ($station ==0){ 179 $query = "180 SELECT181 *182 FROM foltia_tvrecord183 WHERE tid = '$tid'184 ";185 $rs = m_query($con, $query, "DBクエリに失敗しました");186 $maxrows = pg_num_rows($rs);187 if ($maxrows > 0){188 170 //既存局を消す 189 171 $query = "DELETE 190 172 FROM foltia_tvrecord 191 173 WHERE tid = '$tid' 192 174 "; 193 175 $rs = m_query($con, $query, "DBクエリに失敗しました"); 194 }195 176 }//endif 196 177 197 178 $query = " 198 179 SELECT 199 *180 count(*) 200 181 FROM foltia_tvrecord 201 182 WHERE tid = '$tid' AND stationid = '$station' 202 183 "; 203 184 $rs = m_query($con, $query, "DBクエリに失敗しました"); 204 $maxrows = pg_num_rows($rs); 205 185 $maxrows = $rs->fetchColumn(0); 206 186 if ($maxrows == 0) { //新規追加 207 187 $query = "INSERT INTO foltia_tvrecord values ('$tid','$station','$bitrate','$usedigital')"; 208 188 $rs = m_query($con, $query, "DB書き込みに失敗しました"); -
foltia/install/php/reserveepg.php
old new 58 56 WHERE epgid='$epgid' AND foltia_station.ontvcode = foltia_epg.ontvchannel 59 57 ";//4812 60 58 $rs = m_query($con, $query, "DBクエリに失敗しました"); 61 $maxrows = pg_num_rows($rs); 62 63 if ($maxrows == 0) { 59 $rowdata = $rs->fetch(); 60 if (! $rowdata) { 64 61 die_exit("登録番組がありません<BR>"); 65 62 } 66 $rowdata = pg_fetch_row($rs, 0); 63 67 64 //$title = htmlspecialchars($rowdata[0]); 68 65 ?> 69 66 <body BGCOLOR="#ffffff" TEXT="#494949" LINK="#0047ff" VLINK="#000000" ALINK="#c6edff" > … … 135 132 //重複確認 136 133 $query = " 137 134 SELECT 138 foltia_program .title, 139 foltia_program .tid, 140 stationname, 141 foltia_station.stationid , 142 foltia_subtitle.countno, 143 foltia_subtitle.subtitle, 144 foltia_subtitle.startdatetime , 145 foltia_subtitle.lengthmin , 146 foltia_tvrecord.bitrate , 147 foltia_subtitle.startoffset , 148 foltia_subtitle.pid 135 foltia_program.title, foltia_program.tid, stationname, 136 foltia_station.stationid, foltia_subtitle.countno, 137 foltia_subtitle.subtitle, foltia_subtitle.startdatetime, 138 foltia_subtitle.lengthmin, foltia_tvrecord.bitrate, 139 foltia_subtitle.startoffset, foltia_subtitle.pid 149 140 FROM foltia_subtitle , foltia_program ,foltia_station ,foltia_tvrecord 150 141 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 151 142 AND foltia_subtitle.startdatetime ='$startfoltime' … … 153 144 AND foltia_station.stationid = '$stationid' 154 145 UNION 155 146 SELECT 156 foltia_program .title, 157 foltia_program .tid, 158 stationname, 159 foltia_station.stationid , 160 foltia_subtitle.countno, 161 foltia_subtitle.subtitle, 162 foltia_subtitle.startdatetime , 163 foltia_subtitle.lengthmin , 164 foltia_tvrecord.bitrate , 165 foltia_subtitle.startoffset , 166 foltia_subtitle.pid 147 foltia_program.title, foltia_program.tid, stationname, 148 foltia_station.stationid, foltia_subtitle.countno, 149 foltia_subtitle.subtitle, foltia_subtitle.startdatetime, 150 foltia_subtitle.lengthmin, foltia_tvrecord.bitrate, 151 foltia_subtitle.startoffset, foltia_subtitle.pid 167 152 FROM foltia_tvrecord 168 153 LEFT OUTER JOIN foltia_subtitle on (foltia_tvrecord.tid = foltia_subtitle.tid ) 169 154 LEFT OUTER JOIN foltia_program on (foltia_tvrecord.tid = foltia_program.tid ) … … 174 159 AND foltia_station.stationid = '$stationid' 175 160 "; 176 161 177 178 179 $rs = m_query($con, $query, "DBクエリに失敗しました");180 $maxrows = pg_num_rows($rs);181 182 162 //print "<!--$query \n $maxrows\n -->"; 183 163 184 164 print "<form name=\"recordingsetting\" method=\"POST\" action=\"reserveepgcomp.php\">\n"; 185 165 186 if ($maxrows == 0) { 166 $rs = m_query($con, $query, "DBクエリに失敗しました"); 167 $chkoverwrap = $rs->fetch(); 168 if (! $chkoverwrap) { 187 169 //重複なし 188 170 print "<input type=\"submit\" value=\"予約\" ><br>\n"; 189 171 }else{ 190 $chkoverwrap = pg_fetch_row($rs, 0);191 172 $prereservedtitle = htmlspecialchars($chkoverwrap[0]); 192 173 $tid = htmlspecialchars($chkoverwrap[1]); 193 174 $pid = htmlspecialchars($chkoverwrap[2]); -
foltia/install/php/reserveepgcomp.php
old new 72 69 //min pidを探す 73 70 $query = "SELECT min(pid) FROM foltia_subtitle "; 74 71 $rs = m_query($con, $query, "DBクエリに失敗しました"); 75 $ maxrows = pg_num_rows($rs);76 if ( $maxrows == 0){72 $rowdata = $rs->fetch(); 73 if (! $rowdata) { 77 74 $insertpid = -1 ; 78 75 }else{ 79 $rowdata = pg_fetch_row($rs, 0);80 81 76 $insertpid = $rowdata[0]; 82 77 if ($insertpid > 0){ 83 78 $insertpid = -1; … … 88 83 // next 話数を探す 89 84 $query = "SELECT max(countno) FROM foltia_subtitle WHERE tid = 0"; 90 85 $rs = m_query($con, $query, "DBクエリに失敗しました"); 91 $ maxrows = pg_num_rows($rs);92 if ( $maxrows == 0){86 $rowdata = $rs->fetch(); 87 if (! $rowdata) { 93 88 $nextcno = 1 ; 94 89 }else{ 95 $rowdata = pg_fetch_row($rs, 0);96 90 $nextcno = $rowdata[0]; 97 91 $nextcno++ ; 98 92 } -
foltia/install/php/reserveprogram.php
old new 54 52 //タイトル取得 55 53 $query = "select title from foltia_program where tid='$tid'"; 56 54 $rs = m_query($con, $query, "DBクエリに失敗しました"); 57 $maxrows = pg_num_rows($rs); 58 59 if ($maxrows == 0) { 55 $rowdata = $rs->fetch(); 56 if (! $rowdata) { 60 57 die_exit("登録番組がありません<BR>"); 61 58 } 62 $rowdata = pg_fetch_row($rs, 0); 59 63 60 $title = htmlspecialchars($rowdata[0]); 64 61 ?> 65 62 <body BGCOLOR="#ffffff" TEXT="#494949" LINK="#0047ff" VLINK="#000000" ALINK="#c6edff" > … … 104 101 "; 105 102 106 103 $rs = m_query($con, $query, "DBクエリに失敗しました"); 107 $maxrows = pg_num_rows($rs); 108 109 if ($maxrows == 0) { 104 $rowdata = $rs->fetch(); 105 if (! $rowdata) { 110 106 echo("放映局情報がまだはいってません<BR>"); 111 107 } 112 108 else{ 113 $maxcols = pg_num_fields($rs);109 $maxcols = $rs->columnCount(); 114 110 115 111 echo("<select name=\"station\">\n"); 116 112 /* テーブルのデータを出力 */ 117 for ($row = 0; $row < $maxrows; $row++) { /* 行に対応 */ 118 /* pg_fetch_row で一行取り出す */ 119 $rowdata = pg_fetch_row($rs, $row); 113 do { 120 114 echo("<option value=\""); 121 115 echo(htmlspecialchars($rowdata[0])); 122 116 echo("\">"); 123 117 echo(htmlspecialchars($rowdata[1])); 124 118 echo("</option>\n"); 125 }//for119 } while ($rowdata = $rs->fetch()); 126 120 echo("<option value=\"0\">全局</option>\n</select>\n"); 127 121 }//endif 128 122 ?> … … 185 179 ORDER BY foltia_subtitle.startdatetime ASC 186 180 "; 187 181 $rs = m_query($con, $query, "DBクエリに失敗しました"); 188 $maxrows = pg_num_rows($rs); 189 190 if ($maxrows == 0) { 182 $rowdata = $rs->fetch(); 183 if (! $rowdata) { 191 184 echo("放映予定はありません<BR>"); 192 185 } 193 186 else{ 194 $maxcols = pg_num_fields($rs);187 $maxcols = $rs->columnCount(); 195 188 ?> 196 189 <table BORDER="0" CELLPADDING="0" CELLSPACING="2" WIDTH="100%" BGCOLOR="#bcf1be"> 197 190 <thead> … … 209 202 <tbody> 210 203 <?php 211 204 /* テーブルのデータを出力 */ 212 for ($row = 0; $row < $maxrows; $row++) { /* 行に対応 */ 205 do { 213 206 echo("<tr>\n"); 214 /* pg_fetch_row で一行取り出す */215 $rowdata = pg_fetch_row($rs, $row);216 217 207 for ($col = 0; $col < $maxcols; $col++) { /* 列に対応 */ 218 208 if ($col == 3){ 219 209 echo("<td>".htmlspecialchars(foldate2print($rowdata[$col]))."<br></td>\n"); … … 222 212 } 223 213 } 224 214 echo("</tr>\n"); 225 } 215 } while ($rowdata = $rs->fetch()); 226 216 }//end if 227 217 ?> 228 218 </tbody> -
foltia/install/php/selectcaptureimage.php
old new 77 75 78 76 "; 79 77 $rs = m_query($con, $query, "DBクエリに失敗しました"); 80 $row s = pg_num_rows($rs);81 if ( $rows == 0){78 $rowdata = $rs->fetch(); 79 if (! $rowdata) { 82 80 print " <p align=\"left\"><font color=\"#494949\" size=\"6\">キャプチャ画像</font></p> 83 81 <hr size=\"4\"> 84 82 <p align=\"left\"> … … 86 84 "; 87 85 88 86 }else{ 89 $rowdata = pg_fetch_row($rs, 0);90 91 87 print " <p align=\"left\"><font color=\"#494949\" size=\"6\">キャプチャ画像</font></p> 92 88 <hr size=\"4\"> 93 89 <p align=\"left\">"; -
foltia/install/php/showlib.php
old new 84 84 "; 85 85 86 86 $rs = m_query($con, $query, "DBクエリに失敗しました"); 87 88 $maxrows = pg_num_rows($rs); 89 90 if ($maxrows > 0 ){ 87 $rowdata = $rs->fetch(); 88 if ($rowdata) { 91 89 if(ereg("iPhone",$useragent)){ 92 90 print "<ul id=\"home\" title=\"録画ライブラリ表示\" selected=\"true\">"; 93 91 }else{ … … 104 102 <tbody> 105 103 "; 106 104 } 107 for ($row = 0; $row < $maxrows; $row++) { 108 $rowdata = pg_fetch_row($rs, $row); 105 do { 109 106 $title = $rowdata[1]; 110 107 $counts = $rowdata[2]; 111 108 $tid = htmlspecialchars($rowdata[0]); … … 124 121 </tr>\n 125 122 "; 126 123 } 127 }//for 124 } while ($rowdata = $rs->fetch()); 128 125 129 126 if(ereg("iPhone",$useragent)){ 130 127 print "</ul>\n</body>\n</html>\n"; … … 159 155 WHERE foltia_program.tid = $filesplit[0] 160 156 "; 161 157 $rs = m_query($con, $query, "DBクエリに失敗しました"); 162 $rowdata = pg_fetch_row($rs, $row);158 $rowdata = $rs->fetch(); 163 159 //print" $fName./$rowdata[1]/$rowdata[2]/$rowdata[3]<BR>\n"; 164 160 $title = $rowdata[1]; 165 161 -
foltia/install/php/showlibc.php
old new 70 70 WHERE foltia_program.tid = $tid 71 71 "; 72 72 $rs = m_query($con, $query, "DBクエリに失敗しました"); 73 $ maxrows = pg_num_rows($rs);74 if ( $maxrows == 0 ){73 $rowdata = $rs->fetch(); 74 if (! $rowdata) { 75 75 $syobocaldb = `curl "http://cal.syoboi.jp/db?Command=TitleLookup&TID=$tid" | head -2 `; 76 76 $syobocaldb = mb_convert_encoding($syobocaldb, "EUC-JP", "UTF-8"); 77 77 $syobocaldb = preg_match("/<Title>.*<\/Title>/", $syobocaldb,$title); … … 79 79 $title = strip_tags($title); 80 80 $title = htmlspecialchars($title) ; 81 81 }else{ 82 $rowdata = pg_fetch_row($rs, 0);83 82 $title = $rowdata[0]; 84 83 $title = htmlspecialchars($title) ; 85 84 } … … 148 146 149 147 $rs = ""; 150 148 $rs = m_query($con, $query, "DBクエリに失敗しました"); 151 $ maxrows = pg_num_rows($rs);152 if ($ maxrows > 0 ){149 $rowdata = $rs->fetch(); 150 if ($rowdata) { 153 151 if(ereg("iPhone",$useragent)){ 154 152 print "<ul id=\"home\" title=\"$title\" selected=\"true\">"; 155 153 }else{ … … 158 156 <tbody> 159 157 "; 160 158 } 161 for ($row = 0; $row < $maxrows; $row++) { 162 $rowdata = pg_fetch_row($rs, $row); 163 159 do { 164 160 $title = $rowdata[1]; 165 161 166 162 if ($rowdata[2]== "" ){ … … 194 190 $onairdate = "$day $time"; 195 191 } 196 192 //Starlight Breaker向け拡張 197 //$debug_pg_num_rows = pg_num_rows ($rs);193 //$debug_pg_num_rows = $rs ->rowCount(); 198 194 $caplink = ""; 199 195 200 if (($sbpluginexist == 1) && (pg_num_rows ($rs ) > 0)){196 if ($sbpluginexist == 1) { 201 197 //$capimgpath = htmlspecialchars(preg_replace("/.m2p/", "", $rowdata[5])); 202 198 $capimgpath = htmlspecialchars(preg_replace("/.m2./", "", $rowdata[5])); 203 199 … … 243 239 244 240 }//endif iPhone 245 241 246 }//for 242 } while ($rowdata = $rs->fetch()); 247 243 }else{ 248 244 print "録画ファイルがありません<br>\n"; 249 245 }//if -
foltia/install/php/showplaylist.php
old new 117 113 AND foltia_subtitle.tid = $filesplit[0] 118 114 "; 119 115 $rs = m_query($con, $query, "DBクエリに失敗しました"); 120 $rowdata = pg_fetch_row($rs, $row); 116 $rall = $rs->fetchAll(); 117 $rowdata = $rall[$row]; 121 118 //print" $fName./$rowdata[1]//$rowdata[2]<BR>\n"; 122 119 $title = $rowdata[1]; 123 120 $subtitle = ""; … … 133 129 AND foltia_subtitle.countno = $filesplit[1] 134 130 "; 135 131 $rs = m_query($con, $query, "DBクエリに失敗しました"); 136 $rowdata = pg_fetch_row($rs, $row); 132 $rall = $rs->fetchAll(); 133 $rowdata = $rall[$row]; 137 134 //print" $fName./$rowdata[1]/$rowdata[2]/$rowdata[3]<BR>\n"; 138 135 $title = $rowdata[1]; 139 136 $count = $rowdata[2]; … … 197 193 } 198 194 199 195 $rs = m_query($con, $query, "DBクエリに失敗しました"); 200 $maxrows = pg_num_rows($rs); 201 202 if ($maxrows > 0){ 203 for ($row = 0; $row < $maxrows; $row++) { 204 $rowdata = pg_fetch_row($rs, $row); 205 196 $rowdata = $rs->fetch(); 197 if ($rowdata) { 198 do { 206 199 $tid = htmlspecialchars($rowdata[0]); 207 200 $title = htmlspecialchars($rowdata[1]); 208 201 $count = htmlspecialchars($rowdata[2]); … … 234 227 } 235 228 print "</tr>\n 236 229 "; 237 }//for 230 } while ($rowdata = $rs->fetch()); 238 231 }else{ 239 232 print " 240 233 <tr> … … 262 254 "; 263 255 264 256 $rs = m_query($con, $query, "DBクエリに失敗しました"); 265 $maxrows = pg_num_rows($rs); 266 267 268 if ($maxrows > 0){ 257 $rowdata = $rs->fetch(); 258 if ($rowdata) { 269 259 print "<hr> 270 260 <p align=\"left\">未読タイトルを表示します。<br> 271 261 <table BORDER=\"0\" CELLPADDING=\"0\" CELLSPACING=\"2\" WIDTH=\"100%\"> … … 278 268 <tbody> 279 269 "; 280 270 281 for ($row = 0; $row < $maxrows; $row++) { 282 $rowdata = pg_fetch_row($rs, $row); 283 271 do { 284 272 $tid = htmlspecialchars($rowdata[0]); 285 273 $title = htmlspecialchars($rowdata[1]); 286 274 … … 284 272 $tid = htmlspecialchars($rowdata[0]); 285 273 $title = htmlspecialchars($rowdata[1]); 286 274 287 288 275 print "<tr><td>$tid</td><td>$title</td></tr>\n"; 289 276 290 }//for 277 } while ($rowdata = $rs->fetch()); 291 278 print "</tbody></table>\n"; 292 279 }//if maxrows 293 280 }//if title -
foltia/install/php/titlelist.php
old new 51 51 ORDER BY foltia_program.tid DESC 52 52 "; 53 53 $rs = m_query($con, $query, "DBクエリに失敗しました"); 54 $maxrows = pg_num_rows($rs); 55 56 if ($maxrows == 0) { 54 $rowdata = $rs->fetch(); 55 if (! $rowdata) { 57 56 die_exit("番組データがありません<BR>"); 58 59 57 } 60 61 58 ?> 62 59 63 60 <body BGCOLOR="#ffffff" TEXT="#494949" LINK="#0047ff" VLINK="#000000" ALINK="#c6edff" > … … 71 68 72 69 <? 73 70 /* フィールド数 */ 74 $maxcols = pg_num_fields($rs);71 $maxcols = $rs->columnCount(); 75 72 ?> 76 73 <table BORDER="0" CELLPADDING="0" CELLSPACING="2" WIDTH="100%"> 77 74 <thead> … … 85 82 <tbody> 86 83 <?php 87 84 /* テーブルのデータを出力 */ 88 for ($row = 0; $row < $maxrows; $row++) { /* 行に対応 */ 85 do { 89 86 echo("<tr>\n"); 90 /* pg_fetch_row で一行取り出す */ 91 $rowdata = pg_fetch_row($rs, $row); 87 92 88 //TID 93 89 echo("<td><a href=\"reserveprogram.php?tid=" . 94 90 htmlspecialchars($rowdata[0]) . "\">" . … … 99 95 htmlspecialchars($rowdata[1]) . "</a></td>\n"); 100 96 print "<td><A HREF = \"showlibc.php?tid=".htmlspecialchars($rowdata[0])."\">mp4</A></td>\n"; 101 97 echo("</tr>\n"); 102 } 98 } while ($rowdata = $rs->fetch()); 103 99 ?> 104 100 </tbody> 105 101 </table> -
foltia/install/php/view_syabas.php
old new 59 57 60 58 "; 61 59 $rs = m_query($con, $query, "DBクエリに失敗しました"); 62 63 $rows = pg_num_rows($rs); 64 if ($rows == 0){ 60 $rowdata = $rs->fetch(); 61 if (! $rowdata) { 65 62 print ""; 66 63 exit; 67 64 }else{ 68 $rowdata = pg_fetch_row($rs, 0);69 70 65 $title = $rowdata[2]; 71 66 $episode = $rowdata[3]; 72 67 $subtitle = $rowdata[4]; -
foltia/install/php/viewepg.php
old new 90 88 // $page = 1 ~ 91 89 $maxdisplay = 8; 92 90 93 $query = "SELECT stationid, stationname, stationrecch, ontvcode FROM foltia_station WHERE \"ontvcode\" ~~ '%ontvjapan%' 94 "; 91 $query = "SELECT count(*) FROM foltia_station WHERE \"ontvcode\" LIKE '%ontvjapan%'"; 95 92 $rs = m_query($con, $query, "DBクエリに失敗しました"); 96 $maxrows = pg_num_rows($rs); 97 93 $maxrows = $rs->fetchColumn(0); 98 94 if ($maxrows > $maxdisplay){ 99 95 $pages = ceil($maxrows / $maxdisplay) ; 100 96 } … … 137 131 //・局リスト 138 132 $query = "SELECT stationid, stationname, stationrecch, ontvcode 139 133 FROM foltia_station 140 WHERE \"ontvcode\" ~~'%ontvjapan%'134 WHERE \"ontvcode\" LIKE '%ontvjapan%' 141 135 ORDER BY stationid ASC , stationrecch 142 OFFSET $offset LIMIT $maxdisplay 136 LIMIT $maxdisplay OFFSET $offset 143 137 "; 138 144 139 $slistrs = m_query($con, $query, "DBクエリに失敗しました"); 145 $stations = pg_num_rows($slistrs); 146 for ($i=0 ; $i < $stations ; $i++){ 147 $rowdata = pg_fetch_row($slistrs, $i); 148 $stationhash[$i] = $rowdata[3] ; 140 while ($rowdata = $slistrs->fetch()) { 141 $stationhash[] = $rowdata[3]; 142 $snames[] = $rowdata[1]; // headder 149 143 } 150 144 151 145 //・時間と全順番のハッシュ作る … … 157 151 WHERE foltia_epg.ontvchannel in ( 158 152 SELECT ontvcode 159 153 FROM foltia_station 160 WHERE \"ontvcode\" ~~'%ontvjapan%'154 WHERE \"ontvcode\" LIKE '%ontvjapan%' 161 155 ORDER BY stationid ASC , stationrecch 162 OFFSET $offset LIMIT $maxdisplay156 LIMIT $maxdisplay OFFSET $offset 163 157 ) 164 158 AND startdatetime >= $start 165 159 AND startdatetime < $epgend … … 169 163 170 164 //print "$query<br>\n"; 171 165 172 $ colmnums = pg_num_rows($rs);173 if ( $colmnums == 0){166 $rowdata = $rs->fetch(); 167 if (! $rowdata) { 174 168 //番組データがない 175 169 $colmnums = 2; 176 170 }else{ 177 for ($i=0 ; $i < $colmnums ; $i++){ 178 $rowdata = pg_fetch_row($rs, $i); 179 $timetablehash["$rowdata[0]"] = ($i + 1); 171 $colmnums = 0; 172 do { 173 $colmnums++; 174 $timetablehash[$rowdata[0]] = $colmnums; 180 175 // print "$rowdata[0]:$i+1 <br>\n"; 181 } 176 } while ($rowdata = $rs->fetch()); 182 177 } 183 178 //print "colmnums $colmnums <br>\n"; 184 179 185 180 //・局ごとに縦に配列入れていく 186 for ($j=0 ; $j < $stations ; $j++){ 187 $rowdata = pg_fetch_row($slistrs, $j); 188 $stationname = $rowdata[3]; 189 181 foreach ($stationhash as $stationname) { 190 182 $epgstart = $start ; 191 183 $epgend = calcendtime($start , (8*60)); 192 184 $query = " … … 197 189 startdatetime < $epgend 198 190 ORDER BY foltia_epg.startdatetime ASC 199 191 "; 200 $statiodh = m_query($con, $query, "DBクエリに失敗しました");201 $maxrowsstation = pg_num_rows($statiodh);202 203 //print "maxrowsstation $maxrowsstation stationname $stationname<br>\n";204 192 205 if ($maxrowsstation == 0) { 193 $statiodh = m_query($con, $query, "DBクエリに失敗しました"); 194 $stationrowdata = $statiodh->fetch(); 195 if (! $stationrowdata) { 206 196 //print("番組データがありません<BR>"); 207 197 $item[0]["$stationname"] = ">番組データがありません"; 208 198 }else{ 209 210 for ($srow = 0; $srow < $maxrowsstation ; $srow++) { 211 212 $stationrowdata = pg_fetch_row($statiodh, $srow); 213 199 do { 214 200 $printstarttime = substr($stationrowdata[0],8,2) . ":" . substr($stationrowdata[0],10,2); 215 201 $tdclass = "t".substr($stationrowdata[0],8,2) . substr($stationrowdata[0],10,2); 216 202 $title = $stationrowdata[3]; … … 234 220 $item["$number"]["$stationname"] = " id=\"$epgcategory\" onClick=\"location = './reserveepg.php?epgid=$epgid'\"><span id=\"epgstarttime\">$printstarttime</span> <A HREF=\"./reserveepg.php?epgid=$epgid\"><span id=\"epgtitle\">$title</span></A> <span id=\"epgdesc\">$desc</span></span>"; 235 221 }//if 236 222 237 }//for 223 } while ($stationrowdata = $statiodh->fetch()); 238 224 }//if 239 225 240 226 //・局ごとに間隔決定 … … 290 276 print "<table>\n<tr>"; 291 277 292 278 //ヘッダ 293 for ($i=0;$i<$stations;$i++){ 294 $rowdata = pg_fetch_row($slistrs, $i); 295 print "<th>".htmlspecialchars($rowdata[1])."</th>" ; 279 foreach ($snames as $s) { 280 print "<th>".htmlspecialchars($s)."</th>" ; 296 281 } 297 282 //本体 298 283 for ($l = 0 ;$l < $colmnums; $l++){ 299 284 print "<tr>"; 300 for ($m = 0 ; $m < $stations ; $m++ ){ 301 $stationname = $stationhash[$m]; 285 foreach ($stationhash as $stationname) { 302 286 print_r($item[$l]["$stationname"]); 303 287 } 304 288 print "</tr>\n";