# HG changeset patch # User Sushi-k # Date 1267010539 -32400 # Node ID cb7da56c4198e1ef908fd12b139652ccbc6c8f22 # Parent 69e0dabc765ac2f244d21738664eeb858797000d modified: Keyword.class.php modified: config.php.sample modified: index.php modified: install/step1.php modified: keywordTable.php modified: programTable.php modified: simpleReservation.php modified: templates/index.html modified: templates/keywordTable.html modified: templates/programTable.html diff -r 69e0dabc765a -r cb7da56c4198 Keyword.class.php --- a/Keyword.class.php Tue Feb 23 19:58:30 2010 +0900 +++ b/Keyword.class.php Wed Feb 24 20:22:19 2010 +0900 @@ -43,6 +43,10 @@ $options .= " AND channel_id = '".$this->channel_id."'"; } + if( $this->weekofday != 7 ) { + $options .= " AND WEEKDAY(starttime) = '".$this->weekofday."'"; + } + $options .= " ORDER BY starttime ASC"; $recs = array(); @@ -72,7 +76,7 @@ foreach( $precs as $rec ) { try { if( $rec->autorec ) { - Reservation::simple( $rec->id, $this->id, $this->settings->autorec_mode ); + Reservation::simple( $rec->id, $this->id, $this->autorec_mode ); usleep( 100 ); // あんまり時間を空けないのもどう? } } diff -r 69e0dabc765a -r cb7da56c4198 config.php.sample --- a/config.php.sample Tue Feb 23 19:58:30 2010 +0900 +++ b/config.php.sample Wed Feb 24 20:22:19 2010 +0900 @@ -225,7 +225,8 @@ "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'" //録画モード + "mode integer not null default '0',". //録画モード + "index reserve_idx (channel_disc, starttime)" // インデックス ); @@ -242,7 +243,9 @@ "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'" // 自動録画有効無効 + "autorec boolean not null default '1',". // 自動録画有効無効 + "index program_idx (channel_disc, starttime)" // インデックス + ); @@ -270,6 +273,7 @@ "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追加 + "autorec_mode integer not null default '0',". // 自動録画のモード02/23/2010追加 + "weekofday enum ('0','1','2','3','4','5','6','7' ) default '7'" // 曜日 ); ?> \ No newline at end of file diff -r 69e0dabc765a -r cb7da56c4198 index.php --- a/index.php Tue Feb 23 19:58:30 2010 +0900 +++ b/index.php Wed Feb 24 20:22:19 2010 +0900 @@ -61,6 +61,7 @@ try { $crec = new DBRecord( CHANNEL_TBL, "channel_disc", $channel_disc ); $programs[$st]["station_name"] = $crec->name; + $programs[$st]["channel_disc"] = $crec->channel_disc; $reca = $prec->fetch_array( "channel_disc", $channel_disc, "endtime > '".toDatetime($top_time)."' ". diff -r 69e0dabc765a -r cb7da56c4198 install/step1.php --- a/install/step1.php Tue Feb 23 19:58:30 2010 +0900 +++ b/install/step1.php Wed Feb 24 20:22:19 2010 +0900 @@ -79,8 +79,6 @@ if( !file_exists( "/usr/local/bin/grscan" ) ) { -include_once( INSTALL_PATH."/settings/gr_channel.php" ); - echo "

地上デジタルチャンネルの設定確認

"; echo "
現在、config.phpでは以下のチャンネルの受信が設定されています。受信不可能なチャンネルが混ざっていると番組表が表示できません。
"; diff -r 69e0dabc765a -r cb7da56c4198 keywordTable.php --- a/keywordTable.php Tue Feb 23 19:58:30 2010 +0900 +++ b/keywordTable.php Wed Feb 24 20:22:19 2010 +0900 @@ -7,8 +7,12 @@ include_once( INSTALL_PATH . "/Keyword.class.php" ); // include_once( INSTALL_PATH . "/Settings.class.php" ); + +$weekofdays = array( "月", "火", "水", "木", "金", "土", "日", "なし" ); + // 新規キーワードがポストされた + if( isset($_POST["add_keyword"]) ) { if( $_POST["add_keyword"] == 1 ) { try { @@ -18,6 +22,8 @@ $rec->category_id = $_POST['k_category']; $rec->channel_id = $_POST['k_station']; $rec->use_regexp = $_POST['k_use_regexp']; + $rec->weekofday = $_POST['k_weekofday']; + $rec->autorec_mode = $_POST['autorec_mode']; // 録画予約実行 $rec->reservation(); @@ -52,6 +58,10 @@ $arr['use_regexp'] = $rec->use_regexp; + $arr['weekofday'] = $weekofdays["$rec->weekofday"]; + + $arr['autorec_mode'] = $RECORD_MODE[(int)$rec->autorec_mode]['name']; + array_push( $keywords, $arr ); } } diff -r 69e0dabc765a -r cb7da56c4198 programTable.php --- a/programTable.php Tue Feb 23 19:58:30 2010 +0900 +++ b/programTable.php Wed Feb 24 20:22:19 2010 +0900 @@ -6,9 +6,24 @@ $settings = Settings::factory(); - $options = " WHERE starttime > '".date("Y-m-d H:i:s", time() + 300 )."'"; +// 曜日 +$weekofdays = array( + array( "name" => "月", "id" => 0, "selected" => "" ), + array( "name" => "火", "id" => 1, "selected" => "" ), + array( "name" => "水", "id" => 2, "selected" => "" ), + array( "name" => "木", "id" => 3, "selected" => "" ), + array( "name" => "金", "id" => 4, "selected" => "" ), + array( "name" => "土", "id" => 5, "selected" => "" ), + array( "name" => "日", "id" => 6, "selected" => "" ), + array( "name" => "なし", "id" => 7, "selected" => "" ), +); + +$autorec_modes = $RECORD_MODE; +$autorec_modes[(int)($settings->autorec_mode)]['selected'] = "selected"; + +$weekofday = 7; $search = ""; $use_regexp = 0; $type = "*"; @@ -50,6 +65,12 @@ $options .= " AND channel_id = '".$_POST['station']."'"; } } + if( isset($_POST['weekofday']) ) { + $weekofday = $_POST['weekofday']; + if( $weekofday != 7 ) { + $options .= " AND WEEKDAY(starttime) = '".$weekofday."'"; + } + } } $options .= " ORDER BY starttime ASC LIMIT 300"; $do_keyword = 0; @@ -79,7 +100,7 @@ } $k_category_name = ""; - $crecs = DBRecord::createRecords(CATEGORY_TBL ); + $crecs = DBRecord::createRecords(CATEGORY_TBL); $cats = array(); $cats[0]['id'] = 0; $cats[0]['name'] = "すべて"; @@ -135,6 +156,7 @@ if( $station == $c->id ) $k_station_name = $c->name; array_push( $stations, $arr ); } + $weekofdays["$weekofday"]["selected"] = "selected" ; $smarty = new Smarty(); $smarty->assign("sitetitle","番組検索"); @@ -150,6 +172,11 @@ $smarty->assign( "stations", $stations ); $smarty->assign( "k_station", $station ); $smarty->assign( "k_station_name", $k_station_name ); + $smarty->assign( "weekofday", $weekofday ); + $smarty->assign( "k_weekofday", $weekofdays["$weekofday"]["name"] ); + $smarty->assign( "weekofday", $weekofday ); + $smarty->assign( "weekofdays", $weekofdays ); + $smarty->assign( "autorec_modes", $autorec_modes ); $smarty->display("programTable.html"); } catch( exception $e ) { diff -r 69e0dabc765a -r cb7da56c4198 simpleReservation.php --- a/simpleReservation.php Tue Feb 23 19:58:30 2010 +0900 +++ b/simpleReservation.php Wed Feb 24 20:22:19 2010 +0900 @@ -3,12 +3,15 @@ include_once( INSTALL_PATH . "/DBRecord.class.php" ); include_once( INSTALL_PATH . "/Reservation.class.php" ); include_once( INSTALL_PATH . "/reclib.php" ); +include_once( INSTALL_PATH . "/Settings.class.php" ); if( ! isset( $_GET['program_id'] ) ) exit("Error: 番組が指定されていません" ); $program_id = $_GET['program_id']; +$settings = Settings::factory(); + try { - Reservation::simple( $program_id ); + Reservation::simple( $program_id , 0, $settings->autorec_mode); } catch( Exception $e ) { exit( "Error:". $e->getMessage() ); diff -r 69e0dabc765a -r cb7da56c4198 templates/index.html --- a/templates/index.html Tue Feb 23 19:58:30 2010 +0900 +++ b/templates/index.html Wed Feb 24 20:22:19 2010 +0900 @@ -79,6 +79,31 @@ ); } var PRG = { + chdialog:function(disc){ + $('#channelDialog').dialog('close'); + $.get('channelInfo.php', { channel_disc: disc },function(data) { + if(data.match(/^error/i)){ + alert(data); + } + else { + var str = data; + str += '
更新
'; + $('#channelDialog').html(str); + $('#channelDialog').dialog('open', 'center'); + + } + }); + + }, + chupdate:function() { + var v_sid = $('#id_sid').val(); + var v_channel_disc = $('#id_disc').val(); + $.post('channelSetSID.php', { channel_disc: v_channel_disc, + sid: v_sid }, function(data) { + + $('#channelDialog').dialog('close'); + }); + }, rec:function(id){ $.get(INISet.prgRecordURL, { program_id: id } ,function(data){ if(data.match(/^error/i)){ @@ -289,6 +314,11 @@ var DG = $('#floatBox4Dialog'); DG.dialog({title:'録画予約',width:600}); DG.dialog('close'); + + var DG2 = $('#channelDialog'); + DG2.dialog({title:'チャンネル情報',width:600}); + DG2.dialog('close'); + nowBar.INI(); CTG.INI(); MDA.SCR.INI(); // 番組表の位置保存 @@ -403,6 +433,12 @@ #floatBox4Dialog .prg_rec_cfg{background:#EEE;padding:1em 2em;margin:0.4em 0;} #floatBox4Dialog .labelLeft {width:8em;float:left;text-align:right;} #floatBox4Dialog .button {padding:0.4em 1em;} + +#channelDialog .prg_title{font-size:120%;font-weight:bold;padding:0.4em 0;text-align:center;} +#channelDialog .prg_rec_cfg{background:#EEE;padding:1em 2em;margin:0.4em 0;} +#channelDialog .labelLeft {width:8em;float:left;text-align:right;} +#channelDialog .button {padding:0.4em 1em;} + --> @@ -482,7 +518,7 @@
 
{foreach from=$programs item=program } -
{$program.station_name}
+
{$program.station_name}
{/foreach}

@@ -532,6 +568,7 @@
jQuery UI Dialog
+
jQuery UI Dialog
{literal}