コード例 #1
0
ファイル: storeProgram.php プロジェクト: sushi-k/epgrec
        exit;
    }
    pcntl_signal(SIGTERM, "handler");
}
// デーモン化
daemon();
// プライオリティ低に
pcntl_setpriority(20);
include_once 'config.php';
include_once INSTALL_PATH . '/DBRecord.class.php';
include_once INSTALL_PATH . '/Reservation.class.php';
include_once INSTALL_PATH . '/Keyword.class.php';
include_once INSTALL_PATH . '/Settings.class.php';
$settings = Settings::factory();
if (file_exists($file)) {
    storeProgram($type, $file);
    @unlink($file);
}
// 不要なプログラムの削除
// 8日以上前のプログラムを消す
$arr = array();
$arr = DBRecord::createRecords(PROGRAM_TBL, "WHERE endtime < subdate( now(), 8 )");
foreach ($arr as $val) {
    $val->delete();
}
// 8日以上先のデータがあれば消す
$arr = array();
$arr = DBRecord::createRecords(PROGRAM_TBL, "WHERE starttime  > adddate( now(), 8 )");
foreach ($arr as $val) {
    $val->delete();
}
コード例 #2
0
ファイル: getepg.old.php プロジェクト: sushi-k/epgrec
                @unlink($settings->temp_xml);
            }
        }
    }
}
// 地上波を処理する
if ($settings->gr_tuners != 0) {
    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 == 0) {
            $cmdline = "CHANNEL=" . $value . " DURATION=60 TYPE=GR TUNER=0 MODE=0 OUTPUT=" . $settings->temp_data . " " . DO_RECORD . " >/dev/null 2>&1";
            exec($cmdline);
            $cmdline = $settings->epgdump . " " . $key . " " . $settings->temp_data . " " . $settings->temp_xml;
            exec($cmdline);
            storeProgram("GR", $settings->temp_xml);
            if (file_exists($settings->temp_data)) {
                @unlink($settings->temp_data);
            }
            if (file_exists($settings->temp_xml)) {
                @unlink($settings->temp_xml);
            }
        }
    }
}
// 不要なプログラムの削除
// 8日以上前のプログラムを消す
$arr = array();
$arr = DBRecord::createRecords(PROGRAM_TBL, "WHERE endtime < subdate( now(), 8 )");
foreach ($arr as $val) {
    $val->delete();