Mercurial > epgrec.yaz
comparison getepg.php @ 152:784e3c82926e
mod: yazucchiさんのパッチ取り込み
author | epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp> |
---|---|
date | Sun, 28 Mar 2010 22:13:52 +0900 |
parents | 481e789605e3 |
children | 190a3c46611d |
comparison
equal
deleted
inserted
replaced
149:5b192e94f49d | 152:784e3c82926e |
---|---|
12 | 12 |
13 // 緇剛 | 13 // 緇剛 |
14 if( ! defined( "BS_EPG_CHANNEL" ) ) define( "BS_EPG_CHANNEL", "211" ); | 14 if( ! defined( "BS_EPG_CHANNEL" ) ) define( "BS_EPG_CHANNEL", "211" ); |
15 if( ! defined( "CS1_EPG_CHANNEL" ) ) define( "CS1_EPG_CHANNEL", "CS8" ); | 15 if( ! defined( "CS1_EPG_CHANNEL" ) ) define( "CS1_EPG_CHANNEL", "CS8" ); |
16 if( ! defined( "CS2_EPG_CHANNEL" ) ) define( "CS2_EPG_CHANNEL", "CS24" ); | 16 if( ! defined( "CS2_EPG_CHANNEL" ) ) define( "CS2_EPG_CHANNEL", "CS24" ); |
17 | 17 |
18 function check_file( $file ) { | 18 function check_file( $file ) { |
19 // <ゃ≦馹 | 19 // <ゃ≦馹 |
20 if( ! file_exists( $file ) ) return true; | 20 if( ! file_exists( $file ) ) return true; |
21 | 21 |
22 // 1篁ヤ<ゃゃ眼 | 22 // 1篁ヤ<ゃゃ眼 |
23 if( (time() - filemtime( $file )) > 3600 ) { | 23 if( (time() - filemtime( $file )) > 3600 ) { |
24 @unlink( $file ); | 24 @unlink( $file ); |
25 return true; | 25 return true; |
26 } | 26 } |
27 | 27 |
28 return false; | 28 return false; |
29 } | 29 } |
30 | 30 |
31 // 筝純桁慎羞宴顄帥鴻 | 31 // 筝純桁慎羞宴顄帥鴻 |
32 $use_para = false; | 32 $use_para = false; |
33 $use_para = (function_exists( "pcntl_fork" ) && function_exists( "posix_setsid" ) && function_exists( "pcntl_signal" ) && function_exists("pcntl_setpriority")); | 33 $use_para = (function_exists( "pcntl_fork" ) && function_exists( "posix_setsid" ) && function_exists( "pcntl_signal" ) && function_exists("pcntl_setpriority")); |
34 if( ! $use_para ) { | 34 if( ! $use_para ) { |
35 reclog("getepg:: 筝絎茵茵PHP医с" ); | 35 reclog("getepg:: 筝絎茵茵PHP医с" ); |
37 else { | 37 else { |
38 reclog("getepg:: 筝絎茵篏睡障" ); | 38 reclog("getepg:: 筝絎茵篏睡障" ); |
39 } | 39 } |
40 | 40 |
41 $settings = Settings::factory(); | 41 $settings = Settings::factory(); |
42 | 42 |
43 $temp_xml_bs = $settings->temp_xml."_bs"; | 43 $temp_xml_bs = $settings->temp_xml."_bs"; |
44 $temp_xml_cs1 = $settings->temp_xml."_cs1"; | 44 $temp_xml_cs1 = $settings->temp_xml."_cs1"; |
45 $temp_xml_cs2 = $settings->temp_xml."_cs2"; | 45 $temp_xml_cs2 = $settings->temp_xml."_cs2"; |
46 $temp_xml_gr = $settings->temp_xml."_gr"; | 46 $temp_xml_gr = $settings->temp_xml."_gr"; |
47 | 47 |
48 if( file_exists( $settings->temp_data ) ) @unlink( $settings->temp_data ); | 48 if( file_exists( $settings->temp_data ) ) @unlink( $settings->temp_data ); |
49 | 49 |
50 // BS | 50 // BS |
51 if( $settings->bs_tuners != 0 ) { | 51 if( $settings->bs_tuners != 0 ) { |
52 // 牙脂茲с | 52 // 牙脂茲с |
53 $num = DBRecord::countRecords( RESERVE_TBL, "WHERE complete = '0' AND (type = 'BS' OR type = 'CS') AND endtime > now() AND starttime < addtime( now(), '00:03:05')" ); | 53 $num = DBRecord::countRecords( RESERVE_TBL, "WHERE complete = '0' AND (type = 'BS' OR type = 'CS') AND endtime > now() AND starttime < addtime( now(), '00:03:05')" ); |
54 if( ($num == 0) && check_file($temp_xml_bs) ) { | 54 if($num < $settings->bs_tuners && check_file($temp_xml_bs)) { |
55 $cmdline = "CHANNEL=".BS_EPG_CHANNEL." DURATION=180 TYPE=BS TUNER=0 MODE=0 OUTPUT=".$settings->temp_data." ".DO_RECORD . " >/dev/null 2>&1"; | 55 $cmdline = "CHANNEL=".BS_EPG_CHANNEL." DURATION=180 TYPE=BS TUNER=0 MODE=0 OUTPUT=".$settings->temp_data." ".DO_RECORD . " >/dev/null 2>&1"; |
56 exec( $cmdline ); | 56 exec( $cmdline ); |
57 $cmdline = $settings->epgdump." /BS ".$settings->temp_data." ".$temp_xml_bs; | 57 $cmdline = $settings->epgdump." /BS ".$settings->temp_data." ".$temp_xml_bs; |
58 exec( $cmdline ); | 58 exec( $cmdline ); |
59 if( $use_para ) { | 59 if( $use_para ) { |
68 } | 68 } |
69 | 69 |
70 // CS | 70 // CS |
71 if ($settings->cs_rec_flg != 0) { | 71 if ($settings->cs_rec_flg != 0) { |
72 $num = DBRecord::countRecords( RESERVE_TBL, "WHERE complete = '0' AND (type = 'BS' OR type = 'CS') AND endtime > now() AND starttime < addtime( now(), '00:03:05')" ); | 72 $num = DBRecord::countRecords( RESERVE_TBL, "WHERE complete = '0' AND (type = 'BS' OR type = 'CS') AND endtime > now() AND starttime < addtime( now(), '00:03:05')" ); |
73 if( ($num == 0) && check_file($temp_xml_cs1) ) { | 73 if($num < $settings->bs_tuners && check_file($temp_xml_cs1)) { |
74 | |
74 $cmdline = "CHANNEL=".CS1_EPG_CHANNEL." DURATION=120 TYPE=CS TUNER=0 MODE=0 OUTPUT=".$settings->temp_data." ".DO_RECORD . " >/dev/null 2>&1"; | 75 $cmdline = "CHANNEL=".CS1_EPG_CHANNEL." DURATION=120 TYPE=CS TUNER=0 MODE=0 OUTPUT=".$settings->temp_data." ".DO_RECORD . " >/dev/null 2>&1"; |
75 exec( $cmdline ); | 76 exec( $cmdline ); |
76 $cmdline = $settings->epgdump." /CS ".$settings->temp_data." ".$temp_xml_cs1; | 77 $cmdline = $settings->epgdump." /CS ".$settings->temp_data." ".$temp_xml_cs1; |
77 exec( $cmdline ); | 78 exec( $cmdline ); |
78 if( $use_para ) { | 79 if( $use_para ) { |
84 if( file_exists( $temp_xml_cs1 ) ) @unlink( $temp_xml_cs1 ); | 85 if( file_exists( $temp_xml_cs1 ) ) @unlink( $temp_xml_cs1 ); |
85 } | 86 } |
86 if( file_exists( $settings->temp_data ) ) @unlink( $settings->temp_data ); | 87 if( file_exists( $settings->temp_data ) ) @unlink( $settings->temp_data ); |
87 } | 88 } |
88 $num = DBRecord::countRecords( RESERVE_TBL, "WHERE complete = '0' AND (type = 'BS' OR type = 'CS') AND endtime > now() AND starttime < addtime( now(), '00:03:05')" ); | 89 $num = DBRecord::countRecords( RESERVE_TBL, "WHERE complete = '0' AND (type = 'BS' OR type = 'CS') AND endtime > now() AND starttime < addtime( now(), '00:03:05')" ); |
89 if( ($num == 0) && check_file($temp_xml_cs2) ) { | 90 if( ($num < $settings->bs_tuners) && check_file($temp_xml_cs2) ) { |
90 $cmdline = "CHANNEL=".CS2_EPG_CHANNEL." DURATION=120 TYPE=CS TUNER=0 MODE=0 OUTPUT=".$settings->temp_data." ".DO_RECORD . " >/dev/null 2>&1"; | 91 $cmdline = "CHANNEL=".CS2_EPG_CHANNEL." DURATION=120 TYPE=CS TUNER=0 MODE=0 OUTPUT=".$settings->temp_data." ".DO_RECORD . " >/dev/null 2>&1"; |
91 exec( $cmdline ); | 92 exec( $cmdline ); |
92 $cmdline = $settings->epgdump." /CS ".$settings->temp_data." ".$temp_xml_cs2; | 93 $cmdline = $settings->epgdump." /CS ".$settings->temp_data." ".$temp_xml_cs2; |
93 exec( $cmdline ); | 94 exec( $cmdline ); |
94 if( $use_para ) { | 95 if( $use_para ) { |
101 } | 102 } |
102 if( file_exists( $settings->temp_data ) ) @unlink( $settings->temp_data ); | 103 if( file_exists( $settings->temp_data ) ) @unlink( $settings->temp_data ); |
103 } | 104 } |
104 } | 105 } |
105 } | 106 } |
106 | 107 |
107 // 遺羈≪ | 108 // 遺羈≪ |
108 if( $settings->gr_tuners != 0 ) { | 109 if( $settings->gr_tuners != 0 ) { |
109 foreach( $GR_CHANNEL_MAP as $key=>$value ){ | 110 foreach( $GR_CHANNEL_MAP as $key=>$value ){ |
110 // 牙脂茲с | 111 // 牙脂茲с |
111 $num = DBRecord::countRecords( RESERVE_TBL, "WHERE complete = '0' AND type = 'GR' AND endtime > now() AND starttime < addtime( now(), '00:01:10')" ); | 112 $num = DBRecord::countRecords( RESERVE_TBL, "WHERE complete = '0' AND type = 'GR' AND endtime > now() AND starttime < addtime( now(), '00:01:10')" ); |
112 if( ($num == 0) && check_file($temp_xml_gr.$value."") ) { | 113 if($num < $settings->gr_tuners && check_file($temp_xml_gr.$value."")) { |
113 $cmdline = "CHANNEL=".$value." DURATION=60 TYPE=GR TUNER=0 MODE=0 OUTPUT=".$settings->temp_data." ".DO_RECORD . " >/dev/null 2>&1"; | 114 $cmdline = "CHANNEL=".$value." DURATION=60 TYPE=GR TUNER=0 MODE=0 OUTPUT=".$settings->temp_data." ".DO_RECORD . " >/dev/null 2>&1"; |
114 exec( $cmdline ); | 115 exec( $cmdline ); |
115 $cmdline = $settings->epgdump." ".$key." ".$settings->temp_data." ".$temp_xml_gr.$value.""; | 116 $cmdline = $settings->epgdump." ".$key." ".$settings->temp_data." ".$temp_xml_gr.$value.""; |
116 exec( $cmdline ); | 117 exec( $cmdline ); |
117 if( $use_para ) { | 118 if( $use_para ) { |
126 } | 127 } |
127 } | 128 } |
128 } | 129 } |
129 // 筝х | 130 // 筝х |
130 if( $use_para ) exit(); | 131 if( $use_para ) exit(); |
131 | 132 |
132 garbageClean(); // 筝荀違 | 133 garbageClean(); // 筝荀違 |
133 doKeywordReservation(); // 若若篋膣 | 134 doKeywordReservation(); // 若若篋膣 |
134 exit(); | 135 exit(); |
135 ?> | 136 ?> |