changeset 96:b0095925b3da

merged with upstream
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Wed, 03 Mar 2010 00:19:53 +0900
parents e2c37cc736db (current diff) d9b9d1d903a1 (diff)
children ee348c378f2d
files
diffstat 2 files changed, 22 insertions(+), 13 deletions(-) [+]
line wrap: on
line diff
--- a/getepg.old.php	Tue Mar 02 23:20:06 2010 +0900
+++ b/getepg.old.php	Wed Mar 03 00:19:53 2010 +0900
@@ -112,12 +112,15 @@
 		// チャンネルデータを探す
 		$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'};
+			// channel discがないようなら飛ばす
+			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 {
 			// 存在した場合も、とりあえずチャンネル名は更新する
@@ -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 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'] );