changeset 67:a2c4665b310c

add: CS support (thanks to dakku)
author Sushi-k <epgrec@park.mda.or.jp>
date Wed, 21 Oct 2009 16:51:24 +0900
parents f8af9716f021
children 25736d81c66d
files Settings.class.php getepg.php index.php programTable.php templates/envSetting.html
diffstat 5 files changed, 51 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/Settings.class.php	Fri Oct 09 19:22:40 2009 +0900
+++ b/Settings.class.php	Wed Oct 21 16:51:24 2009 +0900
@@ -31,6 +31,9 @@
 			
 			if(defined("GR_TUNERS")) $xml->gr_tuners = GR_TUNERS;
 			else $xml->gr_tuners = 1;
+
+			if(defined("CS_REC_FLG")) $xml->cs_rec_flg = CS_REC_FLG;
+			else $xml->cs_rec_flg = 0;
 			
 			if(defined("USE_KUROBON")) $xml->use_kurobon = USE_KUROBON ? 1 : 0;
 			else $xml->use_kurobon = 0;
--- a/getepg.php	Fri Oct 09 19:22:40 2009 +0900
+++ b/getepg.php	Wed Oct 21 16:51:24 2009 +0900
@@ -23,6 +23,25 @@
   		storeProgram( "BS", $settings->temp_xml );
   		if( file_exists( $settings->temp_data ) ) @unlink( $settings->temp_data );
   		if( file_exists( $settings->temp_xml ) ) @unlink( $settings->temp_xml );
+
+		// CS
+		if ($settings->cs_rec_flg != 0) {
+			$cmdline = "CHANNEL=CS8 DURATION=120 TYPE=CS TUNER=0 MODE=0 OUTPUT=".$settings->temp_data." ".DO_RECORD . " >/dev/null 2>&1";
+			exec( $cmdline );
+			$cmdline = $settings->epgdump." /CS ".$settings->temp_data." ".$settings->temp_xml;
+			exec( $cmdline );
+			storeProgram( "CS", $settings->temp_xml );
+			if( file_exists( $settings->temp_data ) ) @unlink( $settings->temp_data );
+			if( file_exists( $settings->temp_xml ) ) @unlink( $settings->temp_xml );
+
+			$cmdline = "CHANNEL=CS24 DURATION=120 TYPE=CS TUNER=0 MODE=0 OUTPUT=".$settings->temp_data." ".DO_RECORD . " >/dev/null 2>&1";
+			exec( $cmdline );
+			$cmdline = $settings->epgdump." /CS ".$settings->temp_data." ".$settings->temp_xml;
+			exec( $cmdline );
+			storeProgram( "CS", $settings->temp_xml );
+			if( file_exists( $settings->temp_data ) ) @unlink( $settings->temp_data );
+			if( file_exists( $settings->temp_xml ) ) @unlink( $settings->temp_xml );
+	  	}
   	}
   }
   
@@ -69,11 +88,12 @@
   exit();
   
   function storeProgram( $type, $xmlfile ) {
-	global $BS_CHANNEL_MAP, $GR_CHANNEL_MAP;
+	global $BS_CHANNEL_MAP, $GR_CHANNEL_MAP, $CS_CHANNEL_MAP;
 	// チャンネルマップファイルの準備
 	$map = array();
 	if( $type == "BS" ) $map = $BS_CHANNEL_MAP;
 	else if( $type == "GR") $map = $GR_CHANNEL_MAP;
+	else if( $type == "CS") $map = $CS_CHANNEL_MAP;
 	
 	// XML parse
   	$xml = @simplexml_load_file( $xmlfile );
--- a/index.php	Fri Oct 09 19:22:40 2009 +0900
+++ b/index.php	Wed Oct 21 16:51:24 2009 +0900
@@ -47,6 +47,7 @@
  $programs = array();
  if( $type == "BS" ) $channel_map = $BS_CHANNEL_MAP;
  else if( $type == "GR" ) $channel_map = $GR_CHANNEL_MAP;
+ else if( $type == "CS" ) $channel_map = $CS_CHANNEL_MAP;
  $st = 0;
  $prec = new DBRecord(PROGRAM_TBL);
  foreach( $channel_map as $channel_disc => $channel ) {
@@ -151,6 +152,14 @@
 	$types[$i]['link'] = $_SERVER['SCRIPT_NAME'] . "?type=BS&length=".$program_length."&time=".date( "YmdH", $top_time);
 	$types[$i]['name'] = "BS";
 	$i++;
+
+	// CS
+	if ($settings->cs_rec_flg != 0) {
+		$types[$i]['selected'] = $type == "CS" ? 'class="selected"' : "";
+		$types[$i]['link'] = $_SERVER['SCRIPT_NAME'] . "?type=CS&length=".$program_length."&time=".date( "YmdH", $top_time);
+		$types[$i]['name'] = "CS";
+		$i++;
+	}
  }
  if( $settings->gr_tuners != 0 ) {
 	$types[$i]['selected'] = $type == "GR" ? 'class="selected"' : "";
--- a/programTable.php	Fri Oct 09 19:22:40 2009 +0900
+++ b/programTable.php	Wed Oct 21 16:51:24 2009 +0900
@@ -110,6 +110,15 @@
 		$arr['value'] = "BS";
 		$arr['selected'] = $type == "BS" ? "selected" : "";
 		array_push( $types, $arr );
+
+		// CS
+		if ($settings->cs_rec_flg != 0) {
+			$arr = array();
+			$arr['name'] = "CS";
+			$arr['value'] = "CS";
+			$arr['selected'] = $type == "CS" ? "selected" : "";
+			array_push( $types, $arr );
+		}
 	}
 	
 	$k_station_name = "";
--- a/templates/envSetting.html	Fri Oct 09 19:22:40 2009 +0900
+++ b/templates/envSetting.html	Wed Oct 21 16:51:24 2009 +0900
@@ -74,6 +74,15 @@
 <input type="text" name="bs_tuners" value="{$settings->bs_tuners}" size="3" class="required digits" />
 </div>
 
+<h3>CS録画の有無</h3>
+<div class="setting">
+<div class="caption">この設定を「行う」にするとCS放送を加味した動作となります。CS放送を使用しない方は「使わない」に設定してください。</div>
+<select name="cs_rec_flg" id="id_cs_rec_flg" >
+  <option value="0" {if $settings->cs_rec_flg == 0} selected {/if}>行わない</option>
+  <option value="1" {if $settings->cs_rec_flg == 1} selected {/if}>行う</option>
+</select>
+</div>
+
 <h2>録画関連設定</h2>