Skip to content

Instantly share code, notes, and snippets.

@nvsofts
Created October 19, 2012 15:53
Show Gist options
  • Save nvsofts/3918980 to your computer and use it in GitHub Desktop.
Save nvsofts/3918980 to your computer and use it in GitHub Desktop.
epgrec UNAのリアルタイム視聴の不具合等を修正するパッチ
--- watch.php.old 2012-09-30 00:06:50.000000000 +0900
+++ watch.php 2012-10-20 00:45:32.184187304 +0900
@@ -77,18 +77,25 @@
$tuner_stop = TRUE;
if( $tuner_stop ){
// 非httpサーバ化対応録画コマンド終了 or リアルタイム視聴終了
- $real_view = (int)trim( file_get_contents( REALVIEW_PID ) );
- if( posix_kill( $real_view, 9 ) ){ // 録画コマンド停止 cvlcは自動終了
- do{
- posix_kill( $real_view, 0 );
- }while( posix_get_last_error() != ESRCH );
- unlink( REALVIEW_PID );
- }else{
- $errno = posix_get_last_error();
- echo posix_strerror( $errno )."\n";
- while( !sem_release( $rv_sem ) );
- shm_detach( $shm_id );
- exit( 0 );
+ $real_view = (int)trim( @file_get_contents( REALVIEW_PID ) );
+ if ($real_view != 0) {
+ if( posix_kill( $real_view, 9 ) ){ // 録画コマンド停止 cvlcは自動終了
+ do{
+ posix_kill( $real_view, 0 );
+ }while( posix_get_last_error() != ESRCH );
+ unlink( REALVIEW_PID );
+ }else{
+ $errno = posix_get_last_error();
+ $errmes = posix_strerror( $errno );
+ if ($errmes == 'No such process') {
+ unlink( REALVIEW_PID );
+ echo "pid file deleted\n";
+ }
+ echo $errmes."\n";
+ while( !sem_release( $rv_sem ) );
+ shm_detach( $shm_id );
+ exit( 0 );
+ }
}
if( $now_type === $type )
sleep( (int)$settings->rec_switch_time );
@@ -230,10 +237,10 @@
echo "<ENTRY>";
echo "<TITLE>".$channel.":".$sid.' '.$_GET['name']."</TITLE>";
$now_type = $type==='GR' ? 'GR' : 'BS';
-if( ( $slc_tuner<TUNER_UNIT1 && USE_RECPT1 ) || ( $slc_tuner>=TUNER_UNIT1 && $OTHER_TUNERS_CHARA["$now_type"][$slc_tuner-TUNER_UNIT1]['httpS'] ) )
+//if( ( $slc_tuner<TUNER_UNIT1 && USE_RECPT1 ) || ( $slc_tuner>=TUNER_UNIT1 && $OTHER_TUNERS_CHARA["$now_type"][$slc_tuner-TUNER_UNIT1]['httpS'] ) )
echo "<REF HREF=\"http://".$_SERVER['SERVER_NAME'].':'.REALVIEW_HTTP_PORT.'/'.$channel."/".$sid."\" />";
-else
- echo "<REF HREF=\"http://".$_SERVER['SERVER_NAME'].':'.REALVIEW_HTTP_PORT."/\" />";
+//else
+// echo "<REF HREF=\"http://".$_SERVER['SERVER_NAME'].':'.REALVIEW_HTTP_PORT."/\" />";
echo "</ENTRY>";
echo "</ASX>";
exit( 1 );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment