comparison recomplete.php @ 146:4afd353b4507

merged with upstream
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Tue, 23 Mar 2010 02:37:31 +0900
parents 481e789605e3
children 5b192e94f49d
comparison
equal deleted inserted replaced
141:d1681f891462 146:4afd353b4507
3 $script_path = dirname( __FILE__ ); 3 $script_path = dirname( __FILE__ );
4 chdir( $script_path ); 4 chdir( $script_path );
5 include_once( $script_path . '/config.php'); 5 include_once( $script_path . '/config.php');
6 include_once( INSTALL_PATH . "/DBRecord.class.php" ); 6 include_once( INSTALL_PATH . "/DBRecord.class.php" );
7 include_once( INSTALL_PATH . "/Settings.class.php" ); 7 include_once( INSTALL_PATH . "/Settings.class.php" );
8 include_once( INSTALL_PATH . "/recLog.inc.php" );
8 9
9 $settings = Settings::factory(); 10 $settings = Settings::factory();
10 11
11 $reserve_id = $argv[1]; 12 $reserve_id = $argv[1];
12 13
13 try{ 14 try{
14 $rrec = new DBRecord( RESERVE_TBL, "id" , $reserve_id ); 15 $rrec = new DBRecord( RESERVE_TBL, "id" , $reserve_id );
16 $rrec->complete = '1';
15 17
16 if( file_exists( INSTALL_PATH .$settings->spool . "/". $rrec->path ) ) { 18 if( file_exists( INSTALL_PATH .$settings->spool . "/". $rrec->path ) ) {
17 // 予約完了 19 // 予約完了
18 $rrec->complete = '1'; 20 reclog( "recomplete:: 予約ID". $rrec->id .":".$rrec->type.$rrec->channel.$rrec->title."の録画が完了" );
21
19 if( $settings->mediatomb_update == 1 ) { 22 if( $settings->mediatomb_update == 1 ) {
20 // ちょっと待った方が確実っぽい 23 // ちょっと待った方が確実っぽい
21 @exec("sync"); 24 @exec("sync");
22 sleep(15); 25 sleep(15);
23 $dbh = mysql_connect( $settings->db_host, $settings->db_user, $settings->db_pass ); 26 $dbh = mysql_connect( $settings->db_host, $settings->db_user, $settings->db_pass );
34 } 37 }
35 } 38 }
36 } 39 }
37 else { 40 else {
38 // 予約失敗 41 // 予約失敗
42 reclog( "recomplete:: 予約ID". $rrec->id .":".$rrec->type.$rrec->channel.$rrec->title."の録画に失敗した模様", E_ERROR );
39 $rrec->delete(); 43 $rrec->delete();
40 } 44 }
41 } 45 }
42 catch( exception $e ) { 46 catch( exception $e ) {
47 reclog( "recomplete:: 予約テーブルのアクセスに失敗した模様", E_ERROR );
48 reclog( "recomplete:: ".$e->getMessage()."" , E_ERROR );
43 exit( $e->getMessage() ); 49 exit( $e->getMessage() );
44 } 50 }
45 51
46 ?> 52 ?>