changeset 93:80cc05b420af

fix: $*_CHANNEL_MAPに存在しないチャンネルの番組を取得する際のエラーを修正
author epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
date Tue, 02 Mar 2010 23:21:17 +0900
parents f6b909678e51
children 12ed8ad837fc
files getepg.old.php storeProgram.php
diffstat 2 files changed, 22 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/getepg.old.php	Tue Mar 02 17:42:30 2010 +0900
+++ b/getepg.old.php	Tue Mar 02 23:21:17 2010 +0900
@@ -112,12 +112,15 @@
 		// c潟若帥「
 		$num = DBRecord::countRecords( CHANNEL_TBL , "WHERE channel_disc = '" . $disc ."'" );
 		if( $num == 0 ) {
-			// c潟若帥域鋎
-			$rec = new DBRecord( CHANNEL_TBL );
-			$rec->type = $type;
-			$rec->channel = $map["$disc"];
-			$rec->channel_disc = $disc;
-			$rec->name = $ch->{'display-name'};
+			// channel disc蕋違
+			if( array_key_exists( $disc, $map ) ) {
+				// c潟若帥域鋎
+				$rec = new DBRecord( CHANNEL_TBL );
+				$rec->type = $type;
+				$rec->channel = $map["$disc"];
+				$rec->channel_disc = $disc;
+				$rec->name = $ch->{'display-name'};
+			}
 		}
 		else {
 			// 絖翫c潟贋違
@@ -134,7 +137,9 @@
 	// programme 緇
 	
 	foreach( $xml->programme as $program ) {
-		$channel_disc = $program['channel']; 
+		$channel_disc = $program['channel'];
+		if( ! array_key_exists( $channel_disc, $map ) ) continue;
+		
 		$channel = $map["$channel_disc"];
 		$starttime = str_replace(" +0900", '', $program['start'] );
 		$endtime = str_replace( " +0900", '', $program['stop'] );
--- a/storeProgram.php	Tue Mar 02 17:42:30 2010 +0900
+++ b/storeProgram.php	Tue Mar 02 23:21:17 2010 +0900
@@ -87,12 +87,14 @@
 		// c潟若帥「
 		$num = DBRecord::countRecords( CHANNEL_TBL , "WHERE channel_disc = '" . $disc ."'" );
 		if( $num == 0 ) {
-			// c潟若帥域鋎
-			$rec = new DBRecord( CHANNEL_TBL );
-			$rec->type = $type;
-			$rec->channel = $map["$disc"];
-			$rec->channel_disc = $disc;
-			$rec->name = $ch->{'display-name'};
+			if( array_key_exists( $disc, $map ) ) {
+				// c潟若帥域鋎
+				$rec = new DBRecord( CHANNEL_TBL );
+				$rec->type = $type;
+				$rec->channel = $map["$disc"];
+				$rec->channel_disc = $disc;
+				$rec->name = $ch->{'display-name'};
+			}
 		}
 		else {
 			// 絖翫c潟贋違
@@ -110,6 +112,8 @@
 	
 	foreach( $xml->programme as $program ) {
 		$channel_disc = $program['channel']; 
+		if( ! array_key_exists( $channel_disc, $map ) ) continue;
+		
 		$channel = $map["$channel_disc"];
 		$starttime = str_replace(" +0900", '', $program['start'] );
 		$endtime = str_replace( " +0900", '', $program['stop'] );