changeset 47:a701aaf6d216

add: gen-thumbnail.sh
author Sushi-k <epgrec@park.mda.or.jp>
date Tue, 28 Jul 2009 18:48:32 +0900
parents 3983b003ae40
children 8fbe3913f214
files Reservation.class.php config.php.sample gen-thumbnail.sh install/step1.php
diffstat 4 files changed, 16 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/Reservation.class.php	Tue Jul 28 17:22:55 2009 +0900
+++ b/Reservation.class.php	Tue Jul 28 18:48:32 2009 +0900
@@ -235,6 +235,7 @@
 				$filename = mb_convert_encoding( $filename, FILESYSTEM_ENCODING, "UTF-8" );
 			}
 			$filename .= $RECORD_MODE[$mode]['suffix'];
+			$thumbname = $filename.".jpg";
 			
 			// ファイル名生成終了
 			
@@ -267,6 +268,9 @@
 				          "TYPE"     => $crec->type,
 			              "TUNER"    => $tuner,
 			              "MODE"     => $mode,
+			              "THUMB"    => INSTALL_PATH.$settings->thumbs."/".$thumbname,
+			              "FORMER"   => "".$settings->former_time,
+			              "FFMPEG"   => "".$settings->ffmpeg,
 			);
 			
 			// ATで予約する
@@ -276,9 +280,7 @@
 				fwrite($pipes[0], DO_RECORD . "\n" );
 				fwrite($pipes[0], COMPLETE_CMD." ".$rrec->id."\n" );
 				if( $settings->use_thumbs ) {
-					// サムネール生成
-					$ffmpeg_cmd = $settings->ffmpeg." -i \${OUTPUT} -r 1 -s 160x90 -ss ".($settings->former_time + 2)." -vframes 1 -f image2 ".INSTALL_PATH.$settings->thumbs."/".$filename.".jpg\n";
-					fwrite($pipes[0], $ffmpeg_cmd );
+					fwrite($pipes[0], GEN_THUMBNAIL."\n" );
 				}
 				fclose($pipes[0]);
 				// 標準エラーを取る
--- a/config.php.sample	Tue Jul 28 17:22:55 2009 +0900
+++ b/config.php.sample	Tue Jul 28 18:48:32 2009 +0900
@@ -64,6 +64,7 @@
 define( "PADDING_TIME", 180 );						// 詰め物時間
 define( "DO_RECORD", INSTALL_PATH . "/do-record.sh" );		// レコードスクリプト
 define( "COMPLETE_CMD", INSTALL_PATH . "/recomplete.php" );	// 録画終了コマンド
+define( "GEN_THUMBNAIL", INSTALL_PATH . "/gen-thumbnail.sh" );	// サムネール生成スクリプト
 
 // 全国用BSデジタルチャンネルマップ
 $BS_CHANNEL_MAP = array(
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/gen-thumbnail.sh	Tue Jul 28 18:48:32 2009 +0900
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+# サムネールを取る時間をFORMER_TIME+αだけずらします
+# お好きな時間だけずらしてください
+
+offset=`expr ${FORMER} + 2`
+
+${FFMPEG} -i ${OUTPUT} -r 1 -s 160x90 -ss ${offset} -vframes 1 -f image2 ${THUMB}
--- a/install/step1.php	Tue Jul 28 17:22:55 2009 +0900
+++ b/install/step1.php	Tue Jul 28 18:48:32 2009 +0900
@@ -43,6 +43,7 @@
 	DO_RECORD,
 	COMPLETE_CMD,
 	INSTALL_PATH."/getepg.php",
+	GEN_THUMBNAIL,
 );
 
 echo "<p><b>ディレクトリのパーミッションチェック(777)</b></p>";
@@ -85,4 +86,4 @@
 
 echo '<p><a href="step2.php">以上を確認し次の設定に進む</a></p>';
 
-?>
\ No newline at end of file
+?>