if( pcntl_fork() != 0 )
exit;
pcntl_signal(SIGTERM, "handler");
- pcntl_signal(SIGKILL, "handler");
- pcntl_signal(SIGSTOP, "handler");
- pcntl_signal(SIGINT , "handler");
- pcntl_signal(SIGALRM, "handler");
-
fclose(STDIN);
fclose(STDOUT);
$cs2_proc = false;
- $temp_xml_bs = $settings->temp_xml."_bs";
- $temp_xml_cs1 = $settings->temp_xml."_cs1";
- $temp_xml_cs2 = $settings->temp_xml."_cs2";
- $temp_xml_gr = $settings->temp_xml."_gr";
+ $temp_data_bs = $settings->temp_data.".bs";
+ $temp_data_cs1 = $settings->temp_data.".cs1";
+ $temp_data_cs2 = $settings->temp_data.".cs2";
+ $temp_data_gr = $settings->temp_data.".gr";
if( file_exists( $settings->temp_data ) ) @unlink( $settings->temp_data );
if( $settings->bs_tuners != 0 ) {
// 録画重複チェック
$num = DBRecord::countRecords( RESERVE_TBL, "WHERE complete = '0' AND (type = 'BS' OR type = 'CS') AND endtime > now() AND starttime < addtime( now(), '00:03:05')" );
- if($num < $settings->bs_tuners && check_file($temp_xml_bs)) {
- $cmdline = "CHANNEL=".BS_EPG_CHANNEL." DURATION=180 TYPE=BS TUNER=0 MODE=0 OUTPUT=".$settings->temp_data." ".DO_RECORD . " >/dev/null 2>&1";
- exec( $cmdline );
- $cmdline = $settings->epgdump." /BS ".$settings->temp_data." ".$temp_xml_bs;
+ if($num < $settings->bs_tuners && check_file($temp_data_bs)) {
+ $cmdline = "CHANNEL=".BS_EPG_CHANNEL." DURATION=180 TYPE=BS TUNER=0 MODE=0 OUTPUT=".$temp_data_bs." ".DO_RECORD . " >/dev/null 2>&1";
exec( $cmdline );
- $cmdline = INSTALL_PATH."/storeProgram.php BS ".$temp_xml_bs;
+ $cmdline = INSTALL_PATH."/storeProgram.php BS ".$temp_data_bs;
$bs_proc = epgrec_exec( $cmdline );
- if( file_exists( $settings->temp_data ) ) @unlink( $settings->temp_data );
}
// CS
if ($settings->cs_rec_flg != 0) {
$num = DBRecord::countRecords( RESERVE_TBL, "WHERE complete = '0' AND (type = 'BS' OR type = 'CS') AND endtime > now() AND starttime < addtime( now(), '00:03:05')" );
- if($num < $settings->bs_tuners && check_file($temp_xml_cs1)) {
+ if($num < $settings->bs_tuners && check_file($temp_data_cs1)) {
- $cmdline = "CHANNEL=".CS1_EPG_CHANNEL." DURATION=120 TYPE=CS TUNER=0 MODE=0 OUTPUT=".$settings->temp_data." ".DO_RECORD . " >/dev/null 2>&1";
+ $cmdline = "CHANNEL=".CS1_EPG_CHANNEL." DURATION=120 TYPE=CS TUNER=0 MODE=0 OUTPUT=".$temp_data_cs1." ".DO_RECORD . " >/dev/null 2>&1";
exec( $cmdline );
- $cmdline = $settings->epgdump." /CS ".$settings->temp_data." ".$temp_xml_cs1;
- exec( $cmdline );
- $cmdline = INSTALL_PATH."/storeProgram.php CS ".$temp_xml_cs1;
+ $cmdline = INSTALL_PATH."/storeProgram.php CS1 ".$temp_data_cs1;
$cs1_proc = epgrec_exec($cmdline);
- if( file_exists( $settings->temp_data ) ) @unlink( $settings->temp_data );
}
$num = DBRecord::countRecords( RESERVE_TBL, "WHERE complete = '0' AND (type = 'BS' OR type = 'CS') AND endtime > now() AND starttime < addtime( now(), '00:03:05')" );
- if( ($num < $settings->bs_tuners) && check_file($temp_xml_cs2) ) {
- $cmdline = "CHANNEL=".CS2_EPG_CHANNEL." 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." ".$temp_xml_cs2;
+ if( ($num < $settings->bs_tuners) && check_file($temp_data_cs2) ) {
+ $cmdline = "CHANNEL=".CS2_EPG_CHANNEL." DURATION=120 TYPE=CS TUNER=0 MODE=0 OUTPUT=".$temp_data_cs2." ".DO_RECORD . " >/dev/null 2>&1";
exec( $cmdline );
- $cmdline = INSTALL_PATH."/storeProgram.php CS ".$temp_xml_cs2;
+ $cmdline = INSTALL_PATH."/storeProgram.php CS2 ".$temp_data_cs2;
$cs2_proc = epgrec_exec( $cmdline );
- if( file_exists( $settings->temp_data ) ) @unlink( $settings->temp_data );
}
}
}
foreach( $GR_CHANNEL_MAP as $key=>$value ){
// 録画重複チェック
$num = DBRecord::countRecords( RESERVE_TBL, "WHERE complete = '0' AND type = 'GR' AND endtime > now() AND starttime < addtime( now(), '00:01:10')" );
- if($num < $settings->gr_tuners && check_file($temp_xml_gr.$value."")) {
- $cmdline = "CHANNEL=".$value." DURATION=60 TYPE=GR TUNER=0 MODE=0 OUTPUT=".$settings->temp_data." ".DO_RECORD . " >/dev/null 2>&1";
+ if($num < $settings->gr_tuners && check_file($temp_data_gr.$value."")) {
+ $cmdline = "CHANNEL=".$value." DURATION=60 TYPE=GR TUNER=0 MODE=0 OUTPUT=".$temp_data_gr.$value." ".DO_RECORD . " >/dev/null 2>&1";
exec( $cmdline );
- $cmdline = $settings->epgdump." ".$key." ".$settings->temp_data." ".$temp_xml_gr.$value."";
- exec( $cmdline );
- $cmdline = INSTALL_PATH."/storeProgram.php GR ".$temp_xml_gr.$value;
+ $cmdline = INSTALL_PATH."/storeProgram.php GR ".$temp_data_gr.$value." ".$key;
$gr_procs[] = epgrec_exec( $cmdline );
- if( file_exists( $settings->temp_data ) ) @unlink( $settings->temp_data );
}
}
}
doKeywordReservation(); // キーワード予約
if( intval($settings->use_power_reduce) != 0 ) {
- // 起動した理由を調べる
if( file_exists(INSTALL_PATH. "/settings/wakeupvars.xml") ) {
$wakeupvars_text = file_get_contents( INSTALL_PATH. "/settings/wakeupvars.xml" );
$wakeupvars = new SimpleXMLElement($wakeupvars_text);
+
+ // getepg終了時を書込み
+ $wakeupvars->getepg_time = time();
+ // 起動理由を調べる
if( strcasecmp( "getepg", $wakeupvars->reason ) == 0 ) {
// 1時間以内に録画はないか?
$count = DBRecord::countRecords( RESERVE_TBL, " WHERE complete <> '1' AND starttime < addtime( now(), '01:00:00') AND endtime > now()" );
if( $count != 0 ) { // 録画があるなら録画起動にして終了
$wakeupvars->reason = "reserve";
- $wakeupvars->asXML(INSTALL_PATH. "/settings/wakeupvars.xml");
- exit();
}
- exec( $settings->shutdown . " -h +".$settings->wakeup_before );
+ else {
+ exec( $settings->shutdown . " -h +".$settings->wakeup_before );
+ }
}
+ $wakeupvars->asXML(INSTALL_PATH. "/settings/wakeupvars.xml");
}
}
exit();
chdir( $script_path );
include_once( $script_path . '/config.php');
- $type = $argv[1]; // BS CS GR
- $file = $argv[2]; // XMLファイル
+ $type = $argv[1]; // BS CS1 CS2 GR
+ $file = $argv[2]; // TSファイル
+ $key = "";
// プライオリティ低に
pcntl_setpriority(20);
include_once( INSTALL_PATH . '/Keyword.class.php' );
include_once( INSTALL_PATH . '/Settings.class.php' );
include_once( INSTALL_PATH . '/storeProgram.inc.php' );
+ include_once( INSTALL_PATH . "/reclib.php" );
+
$settings = Settings::factory();
- if( file_exists( $file ) ) {
- storeProgram( $type, $file );
- @unlink( $file );
+ $xmlfile = "";
+ $cmdline = $settings->epgdump." ";
+
+ if( $type === "GR" ) {
+ $key = $argv[3]; // key
+ $xmlfile = $settings->temp_xml.$key."";
+ $cmdline .= $key." ".$file." ".$xmlfile;
+ }
+ else if( $type === "CS1" ) {
+ $type = "CS";
+ $xmlfile = $settings->temp_xml."_cs1";
+ $cmdline .= "/CS ".$file." ".$xmlfile;
}
+ else if( $type === "CS2" ) {
+ $type = "CS";
+ $xmlfile = $settings->temp_xml."_cs2";
+ $cmdline .= "/CS ".$file." ".$xmlfile;
+ }
+ else if( $type === "BS" ) {
+ $xmlfile = $settings->temp_xml."_bs";
+ $cmdline .= "/BS ".$file." ".$xmlfile;
+ }
+ else exit();
+
+ exec( $cmdline );
+ if( file_exists( $xmlfile ) ) {
+ storeProgram( $type, $xmlfile );
+ @unlink( $xmlfile );
+ }
+ else {
+ reclog( "storeProgram:: 正常な".$xmlfile."が作成されなかった模様(放送間帯でないなら問題ありません)", EPGREC_WARN );
+ }
+
+ if( file_exists( $file ) ) @unlink( $file );
+
+
/*
garbageClean(); // 不要プログラム削除
doKeywordReservation(); // キーワード予約