annotate recorder.php @ 169:e379552d084c

fix: recorder.php:子プロセスを再帰的に停止させるよう変更
author epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
date Sun, 18 Apr 2010 18:06:39 +0900
parents b307e3749e80
children c729a68415eb
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
153
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
1 #!/usr/bin/php
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
2 <?php
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
3 $script_path = dirname( __FILE__ );
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
4 chdir( $script_path );
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
5 include_once( $script_path . '/config.php');
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
6 include_once( INSTALL_PATH . "/DBRecord.class.php" );
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
7 include_once( INSTALL_PATH . "/Settings.class.php" );
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
8 include_once( INSTALL_PATH . "/recLog.inc.php" );
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
9 include_once( INSTALL_PATH . "/reclib.php" );
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
10
166
68f6b36e7c01 mod: デバッグバージョン
Sushi-k <epgrec@park.mda.or.jp>
parents: 163
diff changeset
11 define("DEBUG", true );
68f6b36e7c01 mod: デバッグバージョン
Sushi-k <epgrec@park.mda.or.jp>
parents: 163
diff changeset
12
153
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
13 // 緇剛
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
14
167
b307e3749e80 fix: Warning修正
Sushi-k <epgrec@park.mda.or.jp>
parents: 166
diff changeset
15 if( ! defined( "RECORDER_CMD" ) ) {
153
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
16 define( "RECORDER_CMD", INSTALL_PATH . "/recorder.php" );
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
17 }
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
18
161
84220382fea8 mod: 録画中のキャンセルを可能にした(動作確認、まだ不完全かも)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents: 153
diff changeset
19 $settings = Settings::factory();
84220382fea8 mod: 録画中のキャンセルを可能にした(動作確認、まだ不完全かも)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents: 153
diff changeset
20 $reserve_id = $argv[1];
84220382fea8 mod: 録画中のキャンセルを可能にした(動作確認、まだ不完全かも)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents: 153
diff changeset
21 $msgh_r = null; // 篆∞<祉若吾潟
84220382fea8 mod: 録画中のキャンセルを可能にした(動作確認、まだ不完全かも)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents: 153
diff changeset
22 $msgh_w = null; // 篆∞<祉若吾潟
84220382fea8 mod: 録画中のキャンセルを可能にした(動作確認、まだ不完全かも)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents: 153
diff changeset
23
166
68f6b36e7c01 mod: デバッグバージョン
Sushi-k <epgrec@park.mda.or.jp>
parents: 163
diff changeset
24 $logfile = INSTALL_PATH."/settings/recorder_".$reserve_id.".log";
153
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
25
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
26 // 潟潟違<祉若後篆
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
27
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
28 function epgrec_get_message() {
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
29 global $msgh_r, $reserve_id;
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
30
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
31 $r = msg_receive($msgh_r, (int)$reserve_id , $msgtype, 1024, $message, TRUE, MSG_IPC_NOWAIT | MSG_NOERROR);
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
32 if( $r ) return $message;
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
33
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
34 return null;
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
35 }
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
36
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
37 // <祉若檎篆
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
38
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
39 function epgrec_send_message( $msg ) {
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
40 global $msgh_w, $reserve_id;
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
41
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
42 msg_send( $msgh_w, (int)$reserve_id, $msg );
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
43 sleep(1); // 御篆<緇
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
44 }
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
45
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
46
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
47 function epgrec_exec( $cmd ) {
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
48 $descspec = array(
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
49 0 => array( 'file','/dev/null','r' ),
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
50 1 => array( 'file','/dev/null','w' ),
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
51 2 => array( 'file','/dev/null','w' ),
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
52 );
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
53 $p = proc_open( $cmd, $descspec, $pipes );
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
54 if( is_resource( $p ) ) return $p;
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
55
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
56 return false;
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
57 }
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
58
169
e379552d084c fix: recorder.php:子プロセスを再帰的に停止させるよう変更
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents: 167
diff changeset
59 // 絎祉ID絖祉鴻pid鴻菴
153
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
60 // 鴻鐚
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
61 //
169
e379552d084c fix: recorder.php:子プロセスを再帰的に停止させるよう変更
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents: 167
diff changeset
62 function epgrec_childproc( $ppid )
153
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
63 {
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
64 // ps 絎茵
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
65 $d = array(
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
66 0 => array( 'file','/dev/null','r' ),
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
67 1 => array( 'pipe','w' ),
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
68 2 => array( 'file','/dev/null','w' ),
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
69 );
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
70
166
68f6b36e7c01 mod: デバッグバージョン
Sushi-k <epgrec@park.mda.or.jp>
parents: 163
diff changeset
71 $ps = proc_open( "/bin/ps -o pid,ppid ax" , $d, $pipes );
153
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
72 do {
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
73 $st = proc_get_status( $ps );
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
74 }while( $st['running'] );
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
75
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
76 // 罔羣阪茯
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
77 $cpids = array();
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
78 while( ! feof( $pipes[1] ) ) {
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
79 $line = fgets( $pipes[1] );
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
80 $pids = preg_split( "/[\s]+/", $line );
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
81 if( $pids[1] == $ppid ) {
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
82 array_push( $cpids, $pids[0] );
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
83 }
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
84 }
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
85 fclose( $pipes[1] );
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
86 proc_close( $ps );
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
87
169
e379552d084c fix: recorder.php:子プロセスを再帰的に停止させるよう変更
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents: 167
diff changeset
88 foreach( $cpids as $p ) {
e379552d084c fix: recorder.php:子プロセスを再帰的に停止させるよう変更
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents: 167
diff changeset
89 $ccpids = epgrec_childproc( $p );
e379552d084c fix: recorder.php:子プロセスを再帰的に停止させるよう変更
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents: 167
diff changeset
90 foreach( $ccpids as $ccpid ) {
e379552d084c fix: recorder.php:子プロセスを再帰的に停止させるよう変更
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents: 167
diff changeset
91 array_push( $cpids, $ccpid );
e379552d084c fix: recorder.php:子プロセスを再帰的に停止させるよう変更
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents: 167
diff changeset
92 }
e379552d084c fix: recorder.php:子プロセスを再帰的に停止させるよう変更
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents: 167
diff changeset
93 }
153
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
94 return $cpids;
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
95 }
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
96
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
97 // 絎祉鴻潟絖祉鴻腟篋
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
98
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
99 function epgrec_termproc( $p )
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
100 {
166
68f6b36e7c01 mod: デバッグバージョン
Sushi-k <epgrec@park.mda.or.jp>
parents: 163
diff changeset
101 if( DEBUG ) {
68f6b36e7c01 mod: デバッグバージョン
Sushi-k <epgrec@park.mda.or.jp>
parents: 163
diff changeset
102 global $logfile;
68f6b36e7c01 mod: デバッグバージョン
Sushi-k <epgrec@park.mda.or.jp>
parents: 163
diff changeset
103 system( "ps ax >>".$logfile );
68f6b36e7c01 mod: デバッグバージョン
Sushi-k <epgrec@park.mda.or.jp>
parents: 163
diff changeset
104 system( "echo ------- >>".$logfile );
68f6b36e7c01 mod: デバッグバージョン
Sushi-k <epgrec@park.mda.or.jp>
parents: 163
diff changeset
105 }
169
e379552d084c fix: recorder.php:子プロセスを再帰的に停止させるよう変更
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents: 167
diff changeset
106 $status = proc_get_status( $p );
e379552d084c fix: recorder.php:子プロセスを再帰的に停止させるよう変更
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents: 167
diff changeset
107 $cpids = epgrec_childproc( $status['pid'] );
153
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
108
166
68f6b36e7c01 mod: デバッグバージョン
Sushi-k <epgrec@park.mda.or.jp>
parents: 163
diff changeset
109 if( DEBUG ) {
68f6b36e7c01 mod: デバッグバージョン
Sushi-k <epgrec@park.mda.or.jp>
parents: 163
diff changeset
110 global $logfile;
68f6b36e7c01 mod: デバッグバージョン
Sushi-k <epgrec@park.mda.or.jp>
parents: 163
diff changeset
111
68f6b36e7c01 mod: デバッグバージョン
Sushi-k <epgrec@park.mda.or.jp>
parents: 163
diff changeset
112 foreach( $cpids as $cpid ) {
68f6b36e7c01 mod: デバッグバージョン
Sushi-k <epgrec@park.mda.or.jp>
parents: 163
diff changeset
113 system( "echo ".$cpid." >>".$logfile );
68f6b36e7c01 mod: デバッグバージョン
Sushi-k <epgrec@park.mda.or.jp>
parents: 163
diff changeset
114 }
68f6b36e7c01 mod: デバッグバージョン
Sushi-k <epgrec@park.mda.or.jp>
parents: 163
diff changeset
115 system( "echo ------- >>".$logfile );
68f6b36e7c01 mod: デバッグバージョン
Sushi-k <epgrec@park.mda.or.jp>
parents: 163
diff changeset
116 }
68f6b36e7c01 mod: デバッグバージョン
Sushi-k <epgrec@park.mda.or.jp>
parents: 163
diff changeset
117
169
e379552d084c fix: recorder.php:子プロセスを再帰的に停止させるよう変更
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents: 167
diff changeset
118 // 荀罩≪
153
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
119 @proc_terminate( $p );
169
e379552d084c fix: recorder.php:子プロセスを再帰的に停止させるよう変更
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents: 167
diff changeset
120 usleep(500*1000);
153
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
121 @proc_terminate( $p ); // 2綺
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
122
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
123 foreach( $cpids as $cpid ) {
169
e379552d084c fix: recorder.php:子プロセスを再帰的に停止させるよう変更
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents: 167
diff changeset
124 $ret = posix_kill( $cpid, SIGTERM ); // sigterm
166
68f6b36e7c01 mod: デバッグバージョン
Sushi-k <epgrec@park.mda.or.jp>
parents: 163
diff changeset
125 usleep(100*1000);
68f6b36e7c01 mod: デバッグバージョン
Sushi-k <epgrec@park.mda.or.jp>
parents: 163
diff changeset
126 if( ! $ret ) posix_kill( $cpid, SIGKILL ); // sigkill
153
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
127 }
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
128
166
68f6b36e7c01 mod: デバッグバージョン
Sushi-k <epgrec@park.mda.or.jp>
parents: 163
diff changeset
129 if( DEBUG ) {
68f6b36e7c01 mod: デバッグバージョン
Sushi-k <epgrec@park.mda.or.jp>
parents: 163
diff changeset
130 global $logfile;
68f6b36e7c01 mod: デバッグバージョン
Sushi-k <epgrec@park.mda.or.jp>
parents: 163
diff changeset
131 system( "ps ax >>".$logfile );
68f6b36e7c01 mod: デバッグバージョン
Sushi-k <epgrec@park.mda.or.jp>
parents: 163
diff changeset
132 system( "echo ------- >>".$logfile );
68f6b36e7c01 mod: デバッグバージョン
Sushi-k <epgrec@park.mda.or.jp>
parents: 163
diff changeset
133 }
68f6b36e7c01 mod: デバッグバージョン
Sushi-k <epgrec@park.mda.or.jp>
parents: 163
diff changeset
134
169
e379552d084c fix: recorder.php:子プロセスを再帰的に停止させるよう変更
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents: 167
diff changeset
135 /* 祉鴻違鎡罧翫
166
68f6b36e7c01 mod: デバッグバージョン
Sushi-k <epgrec@park.mda.or.jp>
parents: 163
diff changeset
136 foreach( $cpids as $cpid ) {
68f6b36e7c01 mod: デバッグバージョン
Sushi-k <epgrec@park.mda.or.jp>
parents: 163
diff changeset
137 $ret = posix_kill( $cpid, SIGTERM ); // sigterm
169
e379552d084c fix: recorder.php:子プロセスを再帰的に停止させるよう変更
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents: 167
diff changeset
138 if( $ret ) return false; // 祉鴻絖с
166
68f6b36e7c01 mod: デバッグバージョン
Sushi-k <epgrec@park.mda.or.jp>
parents: 163
diff changeset
139 }
169
e379552d084c fix: recorder.php:子プロセスを再帰的に停止させるよう変更
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents: 167
diff changeset
140 */
153
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
141 return true; // 篆荐若с
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
142 }
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
143
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
144 ////// 膩
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
145
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
146 // <祉若吾潟緇
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
147 $ipc_key = ftok( RECORDER_CMD, "R" );
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
148 $msgh_r = msg_get_queue( $ipc_key );
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
149
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
150 $ipc_key = ftok( RECORDER_CMD, "W" );
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
151 $msgh_w = msg_get_queue( $ipc_key );
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
152
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
153 try{
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
154 $rrec = new DBRecord( RESERVE_TBL, "id" , $reserve_id );
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
155
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
156 // 祉緇
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
157 $starttime = toTimestamp($rrec->starttime);
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
158 $endtime = toTimestamp($rrec->endtime);
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
159
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
160 if( time() > $starttime ) {
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
161 // サ牙私膣
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
162 $rrec->complete = 1; // 腟c
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
163 throw new RecException("recorder:: サ牙私膣絎茵", EPGREC_ERROR );
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
164 }
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
165 reclog("recorder:: 牙ID".$rrec->id .":".$rrec->type.$rrec->channel.$rrec->title."牙祉吾с紮" );
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
166
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
167 // 牙脂紮障у
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
168 while( time() < $starttime ) {
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
169 if( ($message = epgrec_get_message() ) != null ) {
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
170 switch( $message ) {
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
171 case "terminate": // 腟篋腓
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
172 epgrec_send_message("success");
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
173 $rrec->complete = 1; // 腟c
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
174 throw new RecException("recorder:: 牙ID".$rrec->id .":".$rrec->type.$rrec->channel.$rrec->title."牙祉筝" );
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
175 break;
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
176
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
177 case "stat":
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
178 epgrec_send_message("alive");
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
179 break;
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
180
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
181 default:
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
182 break;
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
183 }
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
184 }
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
185 usleep( 50 * 1000 ); // 50腱緇
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
186 }
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
187
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
188 // 牙脂紮
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
189
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
190 $proch = false;
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
191 if( ( $proch = epgrec_exec(DO_RECORD) ) !== false ) {
163
b3095425e613 fix: 録画中にEPGの変更があったときにキャンセルされないよう変更
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents: 161
diff changeset
192 reclog("recorder:: 牙ID".$rrec->id .":".$rrec->type.$rrec->channel.$rrec->title."牙脂紮" );
153
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
193 // 牙糸篋緇
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
194 $rec_cont = true;
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
195 while( $rec_cont ){
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
196 $st = proc_get_status($proch);
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
197 if(! $st['running'] ) $rec_cont = false; // 牙糸篋
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
198
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
199 if( ($message = epgrec_get_message() ) != null ) {
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
200 switch( $message ) {
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
201 case "terminate": // 腟篋腓
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
202 if( epgrec_termproc( $proch ) == false ) {
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
203 epgrec_send_message("error");
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
204 reclog( "牙祉潟潟罩≪с障", EPGREC_WARN );
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
205 }
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
206 else {
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
207 epgrec_send_message("success");
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
208 reclog("recorder:: 牙ID".$rrec->id .":".$rrec->type.$rrec->channel.$rrec->title."牙祉筝" );
161
84220382fea8 mod: 録画中のキャンセルを可能にした(動作確認、まだ不完全かも)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents: 153
diff changeset
209 $rec_cont = false;
153
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
210 }
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
211 break;
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
212
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
213 case "stat":
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
214 epgrec_send_message("alive");
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
215 break;
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
216
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
217 default:
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
218 break;
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
219 }
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
220 }
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
221 sleep(1);
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
222 }
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
223 proc_close( $proch );
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
224 $proch = false;
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
225 }
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
226 else {
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
227 $rrec->complete = 1; // 腟c
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
228 throw new RecException("recorder:: 牙祉潟潟絎茵紊掩", EPGREC_ERROR );
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
229 }
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
230
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
231 // 篋絎腟篋憜吾
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
232 if( time() < $endtime ) {
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
233 $rrec->endtime = toDatetime( time() );
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
234 }
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
235 // 絎篋違腴
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
236 $rrec->complete = '1';
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
237
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
238 // <c緇c鴻腆阪c純
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
239 sleep(15);
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
240 @exec("sync");
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
241
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
242 if( file_exists( INSTALL_PATH .$settings->spool . "/". $rrec->path ) ) {
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
243 // 篋膣絎篋
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
244 reclog( "recorder:: 篋膣ID". $rrec->id .":".$rrec->type.$rrec->channel.$rrec->title."牙紫篋" );
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
245
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
246 // 泣若篏
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
247 if( $settings->use_thumbs == 1 ) {
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
248 $gen_thumbnail = INSTALL_PATH."/gen-thumbnail.sh";
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
249 if( defined("GEN_THUMBNAIL") )
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
250 $gen_thumbnail = GEN_THUMBNAIL;
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
251 @exec($gen_thumbnail);
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
252 }
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
253
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
254 if( $settings->mediatomb_update == 1 ) {
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
255 $dbh = mysql_connect( $settings->db_host, $settings->db_user, $settings->db_pass );
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
256 if( $dbh !== false ) {
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
257 $sqlstr = "use ".$settings->db_name;
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
258 @mysql_query( $sqlstr );
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
259 // ャ
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
260 $sqlstr = "set NAME utf8";
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
261 @mysql_query( $sqlstr );
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
262 $sqlstr = "update mt_cds_object set metadata='dc:description=".mysql_real_escape_string($rrec->description)."&epgrec:id=".$reserve_id."' where dc_title='".$rrec->path."'";
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
263 @mysql_query( $sqlstr );
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
264 $sqlstr = "update mt_cds_object set dc_title='".mysql_real_escape_string($rrec->title)."(".date("Y/m/d").")' where dc_title='".$rrec->path."'";
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
265 @mysql_query( $sqlstr );
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
266 }
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
267 }
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
268 }
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
269 else { // 篋膣紊掩
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
270 reclog( "recomplete:: 篋膣ID". $rrec->id .":".$rrec->type.$rrec->channel.$rrec->title."牙祉紊掩罔≧", EPGREC_ERROR );
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
271 }
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
272 }
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
273 catch( Exception $e ) {
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
274 reclog( "recorder:: ".$e->getMessage(), $e->getLevel() );
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
275 }
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
276
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
277 msg_remove_queue( $msgh_r ); // <祉若吾潟
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
278 msg_remove_queue( $msgh_w ); // <祉若吾潟
4099ae0393eb mod: do-record.shラッパを追加(まだ途中)
epgrec@park.mda.or.jp <yoneda@recorder.localnet.mda.or.jp>
parents:
diff changeset
279 ?>