122 | | |
---|
| 130 | //重複検出 |
---|
| 131 | //開始時刻 $rowdata[5] |
---|
| 132 | //終了時刻 |
---|
| 133 | $endtime = calcendtime($rowdata[5],$rowdata[6]); |
---|
| 134 | //番組の開始時刻より遅い時刻に終了し、終了時刻より前にはじまる番組があるかどうか |
---|
| 135 | //オンボードチューナー録画 |
---|
| 136 | $query = " |
---|
| 137 | SELECT |
---|
| 138 | foltia_program .tid, |
---|
| 139 | stationname, |
---|
| 140 | foltia_program .title, |
---|
| 141 | foltia_subtitle.countno, |
---|
| 142 | foltia_subtitle.subtitle, |
---|
| 143 | foltia_subtitle.startdatetime , |
---|
| 144 | foltia_subtitle.lengthmin , |
---|
| 145 | foltia_tvrecord.bitrate , |
---|
| 146 | foltia_subtitle.startoffset , |
---|
| 147 | foltia_subtitle.pid |
---|
| 148 | FROM foltia_subtitle , foltia_program ,foltia_station ,foltia_tvrecord |
---|
| 149 | WHERE foltia_tvrecord.tid = foltia_program.tid AND foltia_tvrecord.stationid = foltia_station .stationid AND foltia_program.tid = foltia_subtitle.tid AND foltia_station.stationid = foltia_subtitle.stationid |
---|
| 150 | AND foltia_subtitle.enddatetime >= '$rowdata[5]' |
---|
| 151 | AND foltia_subtitle.startdatetime <= '$endtime' |
---|
| 152 | UNION |
---|
| 153 | SELECT |
---|
| 154 | foltia_program .tid, |
---|
| 155 | stationname, |
---|
| 156 | foltia_program .title, |
---|
| 157 | foltia_subtitle.countno, |
---|
| 158 | foltia_subtitle.subtitle, |
---|
| 159 | foltia_subtitle.startdatetime , |
---|
| 160 | foltia_subtitle.lengthmin , |
---|
| 161 | foltia_tvrecord.bitrate , |
---|
| 162 | foltia_subtitle.startoffset , |
---|
| 163 | foltia_subtitle.pid |
---|
| 164 | FROM foltia_tvrecord |
---|
| 165 | LEFT OUTER JOIN foltia_subtitle on (foltia_tvrecord.tid = foltia_subtitle.tid ) |
---|
| 166 | LEFT OUTER JOIN foltia_program on (foltia_tvrecord.tid = foltia_program.tid ) |
---|
| 167 | LEFT OUTER JOIN foltia_station on (foltia_subtitle.stationid = foltia_station.stationid ) |
---|
| 168 | WHERE foltia_tvrecord.stationid = 0 AND |
---|
| 169 | foltia_subtitle.enddatetime >= '$rowdata[5]' |
---|
| 170 | AND foltia_subtitle.startdatetime <= '$endtime' |
---|
| 171 | "; |
---|
| 172 | $rclass = ""; |
---|
| 173 | $overlap = m_query($con, $query, "DBクエリに失敗しました"); |
---|
| 174 | $overlapmaxrows = pg_num_rows($overlap); |
---|
| 175 | if ($overlapmaxrows > ($recunits) ){ |
---|
| 176 | for ($rrow = 0; $rrow < $overlapmaxrows ; $rrow++) { |
---|
| 177 | $owrowdata = pg_fetch_row($overlap, $rrow); |
---|
| 178 | $overlappid[] = $owrowdata[9]; |
---|
| 179 | } |
---|
| 180 | if (in_array($rowdata[9], $overlappid)) { |
---|
| 181 | $rclass = "overwraped"; |
---|
| 182 | } |
---|
| 183 | }else{ |
---|
| 184 | $overlappid = ""; |
---|
| 185 | }//end if |
---|
| 186 | |
---|
| 187 | //外部チューナー録画 |
---|
| 188 | $externalinputs = 1; //現状一系統のみ |
---|
| 189 | $query = " |
---|
| 190 | SELECT |
---|
| 191 | foltia_program .tid, |
---|
| 192 | stationname, |
---|
| 193 | foltia_program .title, |
---|
| 194 | foltia_subtitle.countno, |
---|
| 195 | foltia_subtitle.subtitle, |
---|
| 196 | foltia_subtitle.startdatetime , |
---|
| 197 | foltia_subtitle.lengthmin , |
---|
| 198 | foltia_tvrecord.bitrate , |
---|
| 199 | foltia_subtitle.startoffset , |
---|
| 200 | foltia_subtitle.pid |
---|
| 201 | FROM foltia_subtitle , foltia_program ,foltia_station ,foltia_tvrecord |
---|
| 202 | WHERE foltia_tvrecord.tid = foltia_program.tid AND foltia_tvrecord.stationid = foltia_station .stationid AND foltia_program.tid = foltia_subtitle.tid AND foltia_station.stationid = foltia_subtitle.stationid |
---|
| 203 | AND foltia_subtitle.enddatetime > '$rowdata[5]' |
---|
| 204 | AND foltia_subtitle.startdatetime < '$endtime' |
---|
| 205 | AND (foltia_station.stationrecch = '0' OR foltia_station.stationrecch = '-1' ) |
---|
| 206 | UNION |
---|
| 207 | SELECT |
---|
| 208 | foltia_program .tid, |
---|
| 209 | stationname, |
---|
| 210 | foltia_program .title, |
---|
| 211 | foltia_subtitle.countno, |
---|
| 212 | foltia_subtitle.subtitle, |
---|
| 213 | foltia_subtitle.startdatetime , |
---|
| 214 | foltia_subtitle.lengthmin , |
---|
| 215 | foltia_tvrecord.bitrate , |
---|
| 216 | foltia_subtitle.startoffset , |
---|
| 217 | foltia_subtitle.pid |
---|
| 218 | FROM foltia_tvrecord |
---|
| 219 | LEFT OUTER JOIN foltia_subtitle on (foltia_tvrecord.tid = foltia_subtitle.tid ) |
---|
| 220 | LEFT OUTER JOIN foltia_program on (foltia_tvrecord.tid = foltia_program.tid ) |
---|
| 221 | LEFT OUTER JOIN foltia_station on (foltia_subtitle.stationid = foltia_station.stationid ) |
---|
| 222 | WHERE foltia_tvrecord.stationid = 0 AND |
---|
| 223 | foltia_subtitle.enddatetime > '$rowdata[5]' |
---|
| 224 | AND foltia_subtitle.startdatetime < '$endtime' |
---|
| 225 | AND (foltia_station.stationrecch = '0' OR foltia_station.stationrecch = '-1' ) |
---|
| 226 | |
---|
| 227 | "; |
---|
| 228 | $eoverlap = m_query($con, $query, "DBクエリに失敗しました"); |
---|
| 229 | $eoverlapmaxrows = pg_num_rows($eoverlap); |
---|
| 230 | if ($eoverlapmaxrows > ($externalinputs) ){ |
---|
| 231 | for ($erow = 0; $erow < $eoverlapmaxrows ; $erow++) { |
---|
| 232 | $eowrowdata = pg_fetch_row($eoverlap, $erow); |
---|
| 233 | $eoverlappid[] = $eowrowdata[9]; |
---|
| 234 | } |
---|
| 235 | |
---|
| 236 | if (in_array($rowdata[9], $eoverlappid)) { |
---|
| 237 | $rclass = "exoverwraped"; |
---|
| 238 | } |
---|
| 239 | }else{ |
---|
| 240 | $eoverlappid = ""; |
---|
| 241 | } |
---|