OSDN Git Service

fixed: Reservation.class.php
authorSushi-k <epgrec@park.mda.or.jp>
Tue, 23 Feb 2010 10:58:30 +0000 (19:58 +0900)
committerSushi-k <epgrec@park.mda.or.jp>
Tue, 23 Feb 2010 10:58:30 +0000 (19:58 +0900)
modified:   config.php.sample
modified:   index.php
modified:   install/step1.php
modified:   install/step3.php
install/grscan.php

Reservation.class.php
config.php.sample
index.php
install/step1.php
install/step3.php

index b1e83f8..34e886e 100755 (executable)
@@ -231,10 +231,10 @@ class Reservation {
                        $filename = str_replace("%DURATION%","".$duration, $filename );
                        
                        // 文字コード変換
-                       if( defined("FIESYSTEM_ENCODING") ) {
+                       if( defined("FILESYSTEM_ENCODING") ) {
                                $filename = mb_convert_encoding( $filename, FILESYSTEM_ENCODING, "UTF-8" );
                        }
-                       $filename .= $RECORD_MODE[$mode]['suffix'];
+                       $filename .= $RECORD_MODE["$mode"]['suffix'];
                        $thumbname = $filename.".jpg";
                        
                        // サムネール
index 3c64dab..cb9c025 100755 (executable)
@@ -1,5 +1,8 @@
 <?php
 
+// settings/gr_channel.phpが作成された場合、
+// config.php内の$GR_CHANNEL_MAPは無視されます
+
 // 首都圏用地上デジタルチャンネルマップ
 // 識別子 => チャンネル番号
 $GR_CHANNEL_MAP = array(
@@ -54,7 +57,7 @@ $RECORD_MODE = array(
        */
 );
 
-// USE_KUROBON以外の定数は設定不要になりました
+// 以下、USE_KUROBON以外の定数は設定不要になりました
 
 define( "INSTALL_PATH", dirname(__FILE__) );           // インストールパス
 define( "USE_KUROBON", false );                                                // BSチューナーとしてFriio BS/CSを使うならtrue
@@ -66,6 +69,15 @@ define( "DO_RECORD", INSTALL_PATH . "/do-record.sh" );               // レコードスクリ
 define( "COMPLETE_CMD", INSTALL_PATH . "/recomplete.php" );    // 録画終了コマンド
 define( "GEN_THUMBNAIL", INSTALL_PATH . "/gen-thumbnail.sh" ); // サムネール生成スクリプト
 
+
+// 地上デジタルチャンネルテーブルsettings/gr_channel.phpが存在するならそれを
+// 優先する
+if( file_exists( INSTALL_PATH."/settings/gr_channel.php" ) ) {
+       unset($GR_CHANNEL_MAP);
+       include_once( INSTALL_PATH."/settings/gr_channel.php" );
+}
+
+
 // 全国用BSデジタルチャンネルマップ
 $BS_CHANNEL_MAP = array(
         "3001.ontvjapan.com" => "101",
@@ -198,64 +210,66 @@ define( "KEYWORD_TBL", "keywordTbl" );                                            // キーワードテーブル
 // 予約テーブル
 define( "RESERVE_STRUCT", 
        "id integer not null auto_increment primary key,".              // ID
-       "channel_disc varchar(128) default 'none',".                    // channel disc
-       "channel_id integer default '0',".                                              // channel ID
-       "program_id integer default '0',".                                              // Program ID
-       "type varchar(8) default 'GR',".                                                // 種別(GR/BS/CS)
-       "channel varchar(10) default '0',".                                             // チャンネル
-       "title varchar(512) default 'none',".                                   // タイトル
-       "description text default null,".                                               // 説明
-       "category_id integer default '0',".                                             // カテゴリID
-       "starttime datetime default '1970-01-01 00:00:00',".    // 開始時刻
-       "endtime datetime default '1970-01-01 00:00:00',".              // 終了時刻
-       "job integer default '0',".                                                             // job番号
+       "channel_disc varchar(128) not null default 'none',".   // channel disc
+       "channel_id integer not null  default '0',".                    // channel ID
+       "program_id integer not null default '0',".                             // Program ID
+       "type varchar(8) not null default 'GR',".                               // 種別(GR/BS/CS)
+       "channel varchar(10) not null default '0',".                    // チャンネル
+       "title varchar(512) not null default 'none',".                  // タイトル
+       "description varchar(512) not null default ' ',".               // 説明 text->varchar
+       "category_id integer not null default '0',".                    // カテゴリID
+       "starttime datetime not null default '1970-01-01 00:00:00',".   // 開始時刻
+       "endtime datetime not null default '1970-01-01 00:00:00',".             // 終了時刻
+       "job integer not null default '0',".                                    // job番号
        "path blob default null,".                                                              // 録画ファイルパス
-       "complete boolean default '0',".                                                // 完了フラグ
-       "reserve_disc varchar(128) default 'none',".                    // 識別用hash
-       "autorec integer default '0',".                                                 // キーワードID
-       "mode integer default '0'"                                                              //録画モード
+       "complete boolean not null default '0',".                               // 完了フラグ
+       "reserve_disc varchar(128) not null default 'none',".   // 識別用hash
+       "autorec integer not null default '0',".                                // キーワードID
+       "mode integer not null default '0'"                                             //録画モード
 );
 
 
 // 番組表テーブル
 define( "PROGRAM_STRUCT",
        "id integer not null auto_increment primary key,".              // ID
-       "channel_disc varchar(128) default 'none',".                    // channel disc
-       "channel_id integer default '0',".                                              // channel ID
-       "type varchar(8) default 'GR',".                                                // 種別(GR/BS/CS)
-       "channel varchar(10) default '0',".                                             // チャンネル
-       "title varchar(512) default 'none',".                                   // タイトル
-       "description text default null,".                                               // 説明
-       "category_id integer default '0',".                                             // カテゴリID
-       "starttime datetime default '1970-01-01 00:00:00',".    // 開始時刻
-       "endtime datetime default '1970-01-01 00:00:00',".              // 終了時刻
-       "program_disc char(128) default 'none',".                               // 識別用hash
-       "autorec boolean default '1'"                                                   // 自動録画有効無効
+       "channel_disc varchar(128) not null default 'none',".   // channel disc
+       "channel_id integer not null default '0',".                             // channel ID
+       "type varchar(8) not null default 'GR',".                               // 種別(GR/BS/CS)
+       "channel varchar(10) not null default '0',".                    // チャンネル
+       "title varchar(512) not null default 'none',".                  // タイトル
+       "description varchar(512) not null default 'none',".    // 説明 text->varchar
+       "category_id integer not null default '0',".                    // カテゴリID
+       "starttime datetime not null default '1970-01-01 00:00:00',".   // 開始時刻
+       "endtime datetime not null default '1970-01-01 00:00:00',".             // 終了時刻
+       "program_disc varchar(128) not null default 'none',".                   // 識別用hash
+       "autorec boolean not null default '1'"                                  // 自動録画有効無効
 );
 
 
 define( "CHANNEL_STRUCT",
        "id integer not null auto_increment primary key,".              // ID
-       "type varchar(8) default 'GR',".                                                // 種別
-       "channel varchar(10) default '0',".                                             // channel
-       "name varchar(512) default 'none',".                                    // 表示名
-       "channel_disc varchar(128) default 'none'"                              // 識別用hash
+       "type varchar(8) not null default 'GR',".                               // 種別
+       "channel varchar(10) not null default '0',".                    // channel
+       "name varchar(512) not null default 'none',".                   // 表示名
+       "channel_disc varchar(128) not null default 'none',".   // 識別用hash
+       "sid varchar(64) not null default 'hd'"                                 // サービスID用02/23/2010追加
 );
 
 define( "CATEGORY_STRUCT",
        "id integer not null auto_increment primary key,".              // ID
-       "name_jp varchar(512) default 'none',".                                 // 表示名
-       "name_en varchar(512) default 'none',".                                 // 同上
-       "category_disc varchar(128) default 'none'"                             // 識別用hash
+       "name_jp varchar(512) not null default 'none',".                // 表示名
+       "name_en varchar(512) not null default 'none',".                // 同上
+       "category_disc varchar(128) not null default 'none'"    // 識別用hash
 );
 
 
 define( "KEYWORD_STRUCT",
        "id integer not null auto_increment primary key,".              // ID
-       "keyword varchar(512) default '*',".                                    // 表示名
-       "type varchar(8) default '*',".                                                 // 種別
-       "channel_id integer default '0',".                                              // channel ID
-       "category_id integer default '0',".                                             // カテゴリID
-       "use_regexp boolean default '0'"                                                // 正規表現を使用するなら1
+       "keyword varchar(512) not null default '*',".                   // 表示名
+       "type varchar(8) not null default '*',".                                // 種別
+       "channel_id integer not null default '0',".                             // channel ID
+       "category_id integer not null default '0',".                    // カテゴリID
+       "use_regexp boolean not null default '0',".                             // 正規表現を使用するなら1
+       "autorec_mode integer not null defult '0'"                                              // 自動録画のモード02/23/2010追加
 );
-?>
+?>
\ No newline at end of file
index f707eb0..83b806e 100755 (executable)
--- a/index.php
+++ b/index.php
@@ -49,7 +49,13 @@ $last_time = $top_time + 3600 * $program_length;
  else if( $type == "GR" ) $channel_map = $GR_CHANNEL_MAP;
  else if( $type == "CS" ) $channel_map = $CS_CHANNEL_MAP;
  $st = 0;
- $prec = new DBRecord(PROGRAM_TBL);
+ $prec = null;
+ try {
+       $prec = new DBRecord(PROGRAM_TBL);
+ }
+ catch( Exception $e ) {
+       exit('プログラムテーブルが存在しないようです。インストールをやり直してください.');
+ }
  foreach( $channel_map as $channel_disc => $channel ) {
        $prev_end = $top_time;
        try {
@@ -104,7 +110,8 @@ $last_time = $top_time + 3600 * $program_length;
                }
        }
         catch( exception $e ) {
-               exit( $e->getMessage() );
+//             exit( $e->getMessage() );
+//             何もしない
        }
        // 空きを埋める
        if( ($last_time - $prev_end) > 0 ) {
@@ -221,4 +228,4 @@ $last_time = $top_time + 3600 * $program_length;
  
  
  $smarty->display("index.html");
-?>
\ No newline at end of file
+?>
index fc95d9e..a93ff8c 100755 (executable)
@@ -77,6 +77,10 @@ foreach($exec_files as $value ) {
 }
 echo "</div>";
 
+if( !file_exists( "/usr/local/bin/grscan" ) ) {
+
+include_once( INSTALL_PATH."/settings/gr_channel.php" );
+
 echo "<p><b>地上デジタルチャンネルの設定確認</b></p>";
 
 echo "<div>現在、config.phpでは以下のチャンネルの受信が設定されています。受信不可能なチャンネルが混ざっていると番組表が表示できません。</div>";
@@ -87,7 +91,18 @@ foreach( $GR_CHANNEL_MAP as $key => $value ) {
 }
 echo "</ul>";
 
-
 echo '<p><a href="step2.php">以上を確認し次の設定に進む</a></p>';
 
+}
+else {
+
+echo'<p><b>地上デジタルチャンネルの設定</b><p>';
+echo '
+<form method="post" action="grscan.php" >
+<div>地上デジタルチャンネルスキャンを開始します。スキャンにはおよそ10~20分程度はかかります。ケーブルテレビをお使いの方は下のチェックボックスをオンにしてください</div>
+  <div>ケーブルテレビを使用:<input type="checkbox" name="catv" value="1" /></div>
+
+  <input type="submit" value="スキャンを開始する" />
+</form>';
+}
 ?>
index dcb53cf..c6bf276 100755 (executable)
@@ -51,6 +51,7 @@ $smarty->template_dir = "../templates/";
 $smarty->compile_dir = "../templates_c/";
 $smarty->cache_dir = "../cache/";
 
+$smarty->assign( "record_mode", $RECORD_MODE );
 $smarty->assign( "settings", $settings );
 $smarty->assign( "install_path", INSTALL_PATH );
 $smarty->assign( "post_to", "step4.php" );