comparison getepg2.php @ 83:f873e3251487

new: EPG取得の並列化テストを追加
author yoneda <yoneda@recorder.localnet.mda.or.jp>
date Sun, 28 Feb 2010 23:58:36 +0900
parents
children
comparison
equal deleted inserted replaced
82:330c83ae8c95 83:f873e3251487
1 #!/usr/bin/php
2 <?php
3 include_once('config.php');
4 include_once( INSTALL_PATH . '/DBRecord.class.php' );
5 include_once( INSTALL_PATH . '/Reservation.class.php' );
6 include_once( INSTALL_PATH . '/Keyword.class.php' );
7 include_once( INSTALL_PATH . '/Settings.class.php' );
8
9 $settings = Settings::factory();
10
11 if( file_exists( $settings->temp_data ) ) @unlink( $settings->temp_data );
12
13 // BS
14 if( $settings->bs_tuners != 0 ) {
15 // 牙脂茲с
16 $num = DBRecord::countRecords( RESERVE_TBL, "WHERE complete = '0' AND (type = 'BS' OR type = 'CS') AND endtime > now() AND starttime < addtime( now(), '00:03:05')" );
17 if( ($num == 0) && !file_exists($settings->temp_xml."_bs") ) {
18 $cmdline = "CHANNEL=211 DURATION=180 TYPE=BS TUNER=0 MODE=0 OUTPUT=".$settings->temp_data." ".DO_RECORD . " >/dev/null 2>&1";
19 exec( $cmdline );
20 $cmdline = $settings->epgdump." /BS ".$settings->temp_data." ".$settings->temp_xml."_bs";
21 exec( $cmdline );
22 $cmdline = INSTALL_PATH."/storeProgram.php BS ".$settings->temp_xml."_bs";
23 exec( $cmdline );
24 if( file_exists( $settings->temp_data ) ) @unlink( $settings->temp_data );
25 }
26
27 // CS
28 if ($settings->cs_rec_flg != 0) {
29 $num = DBRecord::countRecords( RESERVE_TBL, "WHERE complete = '0' AND (type = 'BS' OR type = 'CS') AND endtime > now() AND starttime < addtime( now(), '00:03:05')" );
30 if( ($num == 0) && !file_exists($settings->temp_xml."_cs01") ) {
31 $cmdline = "CHANNEL=CS8 DURATION=120 TYPE=CS TUNER=0 MODE=0 OUTPUT=".$settings->temp_data." ".DO_RECORD . " >/dev/null 2>&1";
32 exec( $cmdline );
33 $cmdline = $settings->epgdump." /CS ".$settings->temp_data." ".$settings->temp_xml."_cs01";
34 exec( $cmdline );
35 $cmdline = INSTALL_PATH."/storeProgram.php CS ".$settings->temp_xml."_cs01";
36 exec( $cmdline );
37 if( file_exists( $settings->temp_data ) ) @unlink( $settings->temp_data );
38 }
39 $num = DBRecord::countRecords( RESERVE_TBL, "WHERE complete = '0' AND (type = 'BS' OR type = 'CS') AND endtime > now() AND starttime < addtime( now(), '00:03:05')" );
40 if( ($num == 0) && !file_exists($settings->temp_xml."_cs02") ) {
41 $cmdline = "CHANNEL=CS24 DURATION=120 TYPE=CS TUNER=0 MODE=0 OUTPUT=".$settings->temp_data." ".DO_RECORD . " >/dev/null 2>&1";
42 exec( $cmdline );
43 $cmdline = $settings->epgdump." /CS ".$settings->temp_data." ".$settings->temp_xml."_cs02";
44 exec( $cmdline );
45 $cmdline = INSTALL_PATH."/storeProgram.php CS ".$settings->temp_xml."_cs02";
46 exec( $cmdline );
47 if( file_exists( $settings->temp_data ) ) @unlink( $settings->temp_data );
48 }
49 }
50 }
51
52 // 遺羈≪
53 if( $settings->gr_tuners != 0 ) {
54 foreach( $GR_CHANNEL_MAP as $key=>$value ){
55 // 牙脂茲с
56 $num = DBRecord::countRecords( RESERVE_TBL, "WHERE complete = '0' AND type = 'GR' AND endtime > now() AND starttime < addtime( now(), '00:01:10')" );
57 if( ($num == 0) && !file_exists($settings->temp_xml."_".$value."") ) {
58 $cmdline = "CHANNEL=".$value." DURATION=60 TYPE=GR TUNER=0 MODE=0 OUTPUT=".$settings->temp_data." ".DO_RECORD . " >/dev/null 2>&1";
59 exec( $cmdline );
60 $cmdline = $settings->epgdump." ".$key." ".$settings->temp_data." ".$settings->temp_xml."_".$value."";
61 exec( $cmdline );
62 $cmdline = INSTALL_PATH."/storeProgram.php GR ".$settings->temp_xml."_".$value."";
63 exec( $cmdline );
64 if( file_exists( $settings->temp_data ) ) @unlink( $settings->temp_data );
65 }
66 }
67 }
68
69 ?>