diff storeProgram.php @ 96:b0095925b3da

merged with upstream
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Wed, 03 Mar 2010 00:19:53 +0900
parents d9b9d1d903a1
children f7b6ae03a2a7 3bed74eca373
line wrap: on
line diff
--- a/storeProgram.php	Tue Mar 02 23:20:06 2010 +0900
+++ b/storeProgram.php	Wed Mar 03 00:19:53 2010 +0900
@@ -87,12 +87,14 @@
 		// チャンネルデータを探す
 		$num = DBRecord::countRecords( CHANNEL_TBL , "WHERE channel_disc = '" . $disc ."'" );
 		if( $num == 0 ) {
-			// チャンネルデータがないなら新規作成
-			$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 ) ) {
+				// チャンネルデータがないなら新規作成
+				$rec = new DBRecord( CHANNEL_TBL );
+				$rec->type = $type;
+				$rec->channel = $map["$disc"];
+				$rec->channel_disc = $disc;
+				$rec->name = $ch->{'display-name'};
+			}
 		}
 		else {
 			// 存在した場合も、とりあえずチャンネル名は更新する
@@ -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'] );