Mercurial > epgrec.yaz
annotate getepg.php @ 87:36ac7c416bd7
merged with upstream
author | Yoshiki Yazawa <yaz@honeyplanet.jp> |
---|---|
date | Mon, 01 Mar 2010 20:51:36 +0900 |
parents | 605d327bddcc c29d41d0c945 |
children | 663521c2bf06 |
rev | line source |
---|---|
1 | 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' ); | |
37
e5f9aa34d06f
change: modify all script for web base setting
yoneda <epgrec@park.mda.or.jp>
parents:
7
diff
changeset
|
7 include_once( INSTALL_PATH . '/Settings.class.php' ); |
1 | 8 |
85 | 9 // 後方互換性 |
10 if( ! defined( "BS_EPG_CHANNEL" ) ) define( "BS_EPG_CHANNEL", "211" ); | |
11 if( ! defined( "CS1_EPG_CHANNEL" ) ) define( "CS1_EPG_CHANNEL", "CS8" ); | |
12 if( ! defined( "CS2_EPG_CHANNEL" ) ) define( "CS2_EPG_CHANNEL", "CS24" ); | |
13 | |
14 | |
15 function check_file( $file ) { | |
16 // ファイルがないなら無問題 | |
17 if( ! file_exists( $file ) ) return true; | |
18 | |
19 // 1時間以上前のファイルなら削除してやり直す | |
20 if( (time() - filemtime( $file )) > 3600 ) { | |
21 @unlink( $file ); | |
22 return true; | |
23 } | |
24 | |
25 return false; | |
26 } | |
27 | |
37
e5f9aa34d06f
change: modify all script for web base setting
yoneda <epgrec@park.mda.or.jp>
parents:
7
diff
changeset
|
28 $settings = Settings::factory(); |
85 | 29 |
30 $temp_xml_bs = $settings->temp_xml."_bs"; | |
31 $temp_xml_cs1 = $settings->temp_xml."_cs1"; | |
32 $temp_xml_cs2 = $settings->temp_xml."_cs2"; | |
33 $temp_xml_gr = $settings->temp_xml."_gr"; | |
34 | |
37
e5f9aa34d06f
change: modify all script for web base setting
yoneda <epgrec@park.mda.or.jp>
parents:
7
diff
changeset
|
35 if( file_exists( $settings->temp_data ) ) @unlink( $settings->temp_data ); |
84 | 36 |
1 | 37 // BSを処理する |
57 | 38 if( $settings->bs_tuners != 0 ) { |
1 | 39 // 録画重複チェック |
70
1363ac056197
fix: getepg get program information duaring CS/BS recording.
yoneda <yoneda@recorder.localnet.mda.or.jp>
parents:
67
diff
changeset
|
40 $num = DBRecord::countRecords( RESERVE_TBL, "WHERE complete = '0' AND (type = 'BS' OR type = 'CS') AND endtime > now() AND starttime < addtime( now(), '00:03:05')" ); |
87 | 41 if( $num < $settings->bs_tuners ) { //xxx |
42 // if( ($num == 0) && check_file($temp_xml_bs) ) { //orig | |
85 | 43 $cmdline = "CHANNEL=".BS_EPG_CHANNEL." DURATION=180 TYPE=BS TUNER=0 MODE=0 OUTPUT=".$settings->temp_data." ".DO_RECORD . " >/dev/null 2>&1"; |
1 | 44 exec( $cmdline ); |
85 | 45 $cmdline = $settings->epgdump." /BS ".$settings->temp_data." ".$temp_xml_bs; |
1 | 46 exec( $cmdline ); |
86 | 47 $cmdline = INSTALL_PATH."/storeProgram.php BS ".$temp_xml_bs." >/dev/null 2>&1 &"; |
84 | 48 exec( $cmdline ); |
37
e5f9aa34d06f
change: modify all script for web base setting
yoneda <epgrec@park.mda.or.jp>
parents:
7
diff
changeset
|
49 if( file_exists( $settings->temp_data ) ) @unlink( $settings->temp_data ); |
82
330c83ae8c95
fix: CSEPGͽʣåԤäƤʤäΤ
yoneda <yoneda@recorder.localnet.mda.or.jp>
parents:
70
diff
changeset
|
50 } |
67
a2c4665b310c
add: CS support (thanks to dakku)
Sushi-k <epgrec@park.mda.or.jp>
parents:
64
diff
changeset
|
51 |
82
330c83ae8c95
fix: CSEPGͽʣåԤäƤʤäΤ
yoneda <yoneda@recorder.localnet.mda.or.jp>
parents:
70
diff
changeset
|
52 // CS |
330c83ae8c95
fix: CSEPGͽʣåԤäƤʤäΤ
yoneda <yoneda@recorder.localnet.mda.or.jp>
parents:
70
diff
changeset
|
53 if ($settings->cs_rec_flg != 0) { |
330c83ae8c95
fix: CSEPGͽʣåԤäƤʤäΤ
yoneda <yoneda@recorder.localnet.mda.or.jp>
parents:
70
diff
changeset
|
54 $num = DBRecord::countRecords( RESERVE_TBL, "WHERE complete = '0' AND (type = 'BS' OR type = 'CS') AND endtime > now() AND starttime < addtime( now(), '00:03:05')" ); |
85 | 55 if( ($num == 0) && check_file($temp_xml_cs1) ) { |
56 $cmdline = "CHANNEL=".CS1_EPG_CHANNEL." DURATION=120 TYPE=CS TUNER=0 MODE=0 OUTPUT=".$settings->temp_data." ".DO_RECORD . " >/dev/null 2>&1"; | |
67
a2c4665b310c
add: CS support (thanks to dakku)
Sushi-k <epgrec@park.mda.or.jp>
parents:
64
diff
changeset
|
57 exec( $cmdline ); |
85 | 58 $cmdline = $settings->epgdump." /CS ".$settings->temp_data." ".$temp_xml_cs1; |
67
a2c4665b310c
add: CS support (thanks to dakku)
Sushi-k <epgrec@park.mda.or.jp>
parents:
64
diff
changeset
|
59 exec( $cmdline ); |
86 | 60 $cmdline = INSTALL_PATH."/storeProgram.php CS ".$temp_xml_cs1." >/dev/null 2>&1 &"; |
84 | 61 exec( $cmdline ); |
67
a2c4665b310c
add: CS support (thanks to dakku)
Sushi-k <epgrec@park.mda.or.jp>
parents:
64
diff
changeset
|
62 if( file_exists( $settings->temp_data ) ) @unlink( $settings->temp_data ); |
82
330c83ae8c95
fix: CSEPGͽʣåԤäƤʤäΤ
yoneda <yoneda@recorder.localnet.mda.or.jp>
parents:
70
diff
changeset
|
63 } |
330c83ae8c95
fix: CSEPGͽʣåԤäƤʤäΤ
yoneda <yoneda@recorder.localnet.mda.or.jp>
parents:
70
diff
changeset
|
64 $num = DBRecord::countRecords( RESERVE_TBL, "WHERE complete = '0' AND (type = 'BS' OR type = 'CS') AND endtime > now() AND starttime < addtime( now(), '00:03:05')" ); |
85 | 65 if( ($num == 0) && check_file($temp_xml_cs2) ) { |
66 $cmdline = "CHANNEL=".CS2_EPG_CHANNEL." DURATION=120 TYPE=CS TUNER=0 MODE=0 OUTPUT=".$settings->temp_data." ".DO_RECORD . " >/dev/null 2>&1"; | |
67
a2c4665b310c
add: CS support (thanks to dakku)
Sushi-k <epgrec@park.mda.or.jp>
parents:
64
diff
changeset
|
67 exec( $cmdline ); |
85 | 68 $cmdline = $settings->epgdump." /CS ".$settings->temp_data." ".$temp_xml_cs2; |
67
a2c4665b310c
add: CS support (thanks to dakku)
Sushi-k <epgrec@park.mda.or.jp>
parents:
64
diff
changeset
|
69 exec( $cmdline ); |
86 | 70 $cmdline = INSTALL_PATH."/storeProgram.php CS ".$temp_xml_cs2." >/dev/null 2>&1 &"; |
84 | 71 exec( $cmdline ); |
67
a2c4665b310c
add: CS support (thanks to dakku)
Sushi-k <epgrec@park.mda.or.jp>
parents:
64
diff
changeset
|
72 if( file_exists( $settings->temp_data ) ) @unlink( $settings->temp_data ); |
a2c4665b310c
add: CS support (thanks to dakku)
Sushi-k <epgrec@park.mda.or.jp>
parents:
64
diff
changeset
|
73 } |
1 | 74 } |
75 } | |
72
605d327bddcc
- tuner occupation check was too strict
Yoshiki Yazawa <yaz@honeyplanet.jp>
parents:
70
diff
changeset
|
76 |
1 | 77 // 地上波を処理する |
57 | 78 if( $settings->gr_tuners != 0 ) { |
1 | 79 foreach( $GR_CHANNEL_MAP as $key=>$value ){ |
80 // 録画重複チェック | |
37
e5f9aa34d06f
change: modify all script for web base setting
yoneda <epgrec@park.mda.or.jp>
parents:
7
diff
changeset
|
81 $num = DBRecord::countRecords( RESERVE_TBL, "WHERE complete = '0' AND type = 'GR' AND endtime > now() AND starttime < addtime( now(), '00:01:10')" ); |
87 | 82 if( $num < $settings->gr_tuners ) { //xxx |
83 // if( ($num == 0) && check_file($temp_xml_gr.$value."") ) { | |
37
e5f9aa34d06f
change: modify all script for web base setting
yoneda <epgrec@park.mda.or.jp>
parents:
7
diff
changeset
|
84 $cmdline = "CHANNEL=".$value." DURATION=60 TYPE=GR TUNER=0 MODE=0 OUTPUT=".$settings->temp_data." ".DO_RECORD . " >/dev/null 2>&1"; |
1 | 85 exec( $cmdline ); |
85 | 86 $cmdline = $settings->epgdump." ".$key." ".$settings->temp_data." ".$temp_xml_gr.$value.""; |
1 | 87 exec( $cmdline ); |
86 | 88 $cmdline = INSTALL_PATH."/storeProgram.php GR ".$temp_xml_gr.$value." >/dev/null 2>&1 &"; |
84 | 89 exec( $cmdline ); |
90 if( file_exists( $settings->temp_data ) ) @unlink( $settings->temp_data ); | |
1 | 91 } |
92 } | |
93 } | |
94 | |
95 ?> |