OSDN Git Service

update to db version 98
authorlonginus <longinus@4e526526-5e11-4fc0-8910-f8fd03428081>
Wed, 3 Nov 2010 09:43:22 +0000 (09:43 +0000)
committerlonginus <longinus@4e526526-5e11-4fc0-8910-f8fd03428081>
Wed, 3 Nov 2010 09:43:22 +0000 (09:43 +0000)
git-svn-id: svn+ssh://svn.sourceforge.jp/svnroot/rec10@720 4e526526-5e11-4fc0-8910-f8fd03428081

rectool/trunk/rectool.pl

index 801ac52..685e78b 100755 (executable)
@@ -30,7 +30,7 @@ use Sort::Naturally;
 ################ バージョン定義 ################
 
 
-my $rectool_version = 93;
+my $rectool_version = 98;
 
 
 ################ 初期化ここから ################
@@ -235,7 +235,8 @@ EOM
        $forward_order = $order eq 'btime' ? '' : '&amp;order=id';
 
        my $ary_ref = $dbh->selectall_arrayref(
-               "SELECT id, type, epg_ch.chtxt, epg_ch.ontv, epg_ch.chname, title, btime, etime, opt, deltaday, deltatime 
+               "SELECT id, type, epg_ch.chtxt, epg_ch.ontv, epg_ch.chname, title, btime, etime, opt, deltaday, deltatime, 
+               epgtitle, epgbtime, epgetime, epgexp, epgduplicate, epgchange, counter 
                FROM timeline 
                INNER JOIN epg_ch ON timeline.chtxt = epg_ch.chtxt 
                ORDER BY $order");
@@ -256,6 +257,7 @@ EOM
        $HTML .= qq {<th>オプション</th>\n};
        $HTML .= qq {<th>dd</th>\n};
        $HTML .= qq {<th>dt</th>\n};
+       $HTML .= qq {<th>残り</th>\n};
        $HTML .= qq {</tr>\n};
        foreach my $line ( @{ $ary_ref } ) {
 
@@ -277,11 +279,12 @@ EOM
                my $btime = $unix_6->strftime( '%Y%m%d%H%M%S' );
                my $etime = $unix_7->strftime( '%Y%m%d%H%M%S' );
                if ( $extra and $line->[1] =~ /^search_|^reserve_/ ) {
-                       my @ary = $dbh->selectrow_array(
-                               "SELECT title, exp FROM epg_timeline 
-                               WHERE channel = '$line->[3]' 
-                               AND start = '$btime' 
-                               AND stop  = '$etime' ");
+#                      my @ary = $dbh->selectrow_array(
+#                              "SELECT title, exp FROM epg_timeline 
+#                              WHERE channel = '$line->[3]' 
+#                              AND start = '$btime' 
+#                              AND stop  = '$etime' ");
+                       my @ary = ( $line->[11], $line->[14] );
 
                        if ( $ary[0] ) {
                                $ary[0] =~ s/無料≫//;
@@ -297,11 +300,11 @@ EOM
                                        $ary[0] = '説明';
                                }
 
-                               $line->[11] = qq {<div style="float: right; cursor: help" title="$ary[1]">$ary[0]</div>};
+                               $line->[5_2] = qq {<div style="float: right; cursor: help" title="$ary[1]">$ary[0]</div>};
                        }
                        else {
                                my $href    = qq {<a href="rectool.pl?mode=edit&amp;id=$line->[0]&amp;suggest=auto">自動検索</a>};
-                               $line->[11] = qq {<span style="float: right; color: #FF0000">■$href■</span>};
+                               $line->[5_2] = qq {<span style="float: right; color: #FF0000">■$href■</span>};
                        }
                }
 
@@ -320,16 +323,16 @@ EOM
                }
 
                $line->[5] = qq {<a href="rectool.pl?mode=edit&amp;id=$line->[0]">$line->[5]</a>};
-#              $line->[5] = qq {<div style="float: left">$line->[5]</div>} if ( $line->[11] );
+#              $line->[5] = qq {<div style="float: left">$line->[5]</div>} if ( $line->[5_2] );
                $HTML .= qq {<tr align="center">\n};
                $HTML .= qq {<td><input type="checkbox" name="id" value="$line->[0]"></td>\n};
                $HTML .= qq {<td>$line->[0]</td>\n};
                $HTML .= qq {<td>$type</td>\n};
                $HTML .= qq {<td><a href="rectool.pl?mode=program&amp;chtxt=$line->[2]">$line->[2]</a></td>\n};
-               $HTML .= qq {<td align="left" style="white-space: normal">$line->[5]$line->[11]</td>\n};
+               $HTML .= qq {<td align="left" style="white-space: normal">$line->[5]$line->[5_2]</td>\n};
                $HTML .= qq {<td>$begin</td>\n<td>$end</td>\n};
                $HTML .= qq {<td>$hr$diff</td>\n};
-               $HTML .= qq {<td>$line->[8]</td>\n<td>$line->[9]</td>\n<td>$line->[10]</td>\n};
+               $HTML .= qq {<td>$line->[8]</td>\n<td>$line->[9]</td>\n<td>$line->[10]</td>\n<td>$line->[17]</td>\n};
                $HTML .= qq {</tr>\n};
        }
        $HTML .= qq {</table>\n};
@@ -635,6 +638,7 @@ EOM
        }
        else {
                $type = 'reserve_flexible';
+               $counter = -1;
                $datetime_now = DateTime->now( time_zone => $tz )->set_second( 0 )->add( minutes => 1)->strftime( '%Y-%m-%d %H:%M:%S' );
                $button_bgn = qq{<button type="button" onClick="document.reserve.begin.value='$datetime_now'">現在</button>\n<br>\n};
                $button_end = 
@@ -719,6 +723,7 @@ EOM
        $HTML .= qq {隔日周期\n<input type="text" name="deltaday" value="$deltaday" maxlength=2  size=2 >\n};
        $HTML .= qq {時刻誤差\n<input type="text" name="deltatime" value="$deltatime" maxlength=2  size=2 >\n};
        $HTML .= qq {オプション\n<input type="text" name="opt" value="$opt">\n};
+       $HTML .= qq {回数\n<input type="text" name="counter" value="$counter" size=2 >\n};
        $HTML .= qq {<input type="submit" name="update" value="更新">\n</form>\n};
 }
 
@@ -749,19 +754,20 @@ if ( $mode eq 'change' ) {
                $deltaday  = $q->param( 'deltaday' );
                $deltatime = $q->param( 'deltatime' );
                $opt       = $q->param( 'opt' );
+               $counter   = $q->param( 'counter' );
                $id        = $id[0];
                if ( $id ) {
                        $dbh->do( 
                                "UPDATE timeline SET type = '$type', chtxt = '$chtxt', title = '$title', 
                                btime = '$begin', etime = '$end', 
-                               deltaday = '$deltaday', deltatime = '$deltatime', opt = '$opt' 
+                               deltaday = '$deltaday', deltatime = '$deltatime', opt = '$opt', counter = '$counter' 
                                WHERE id = '$id'" 
                        );
                }
                else {
                        $dbh->do( 
-                               "INSERT INTO timeline ( type, chtxt, title, btime, etime, deltaday, deltatime, opt ) 
-                               VALUES ( '$type', '$chtxt', '$title', '$begin', '$end', '$deltaday', '$deltatime', '$opt' )" 
+                               "INSERT INTO timeline ( type, chtxt, title, btime, etime, deltaday, deltatime, opt, counter ) 
+                               VALUES ( '$type', '$chtxt', '$title', '$begin', '$end', '$deltaday', '$deltatime', '$opt', '$counter' )" 
                        );
                }
                $HTML .= "更新しました。<br>\n5秒後に予約確認画面に移動します。<br>\n";
@@ -812,8 +818,8 @@ if ( $mode eq 'change' ) {
                my $pass    = $q->param( 'pass' )    || '';
 
                $dbh->do( 
-                       "INSERT INTO in_settings ( auto_jbk, auto_bayes, auto_del_tmp, auto_opt ) 
-                       VALUES ( '$jbk', '$bayes', '$del_tmp', '$opt' )"
+                       "UPDATE in_settings SET auto_jbk = '$jbk', auto_bayes = '$bayes', 
+                       auto_del_tmp = '$del_tmp', auto_opt = '$opt'"
                );
 
                goto end;
@@ -911,6 +917,7 @@ if ( $mode eq 'reserve' ) {
                $title =~ s/<.*>//;
                $title =~ s/(.*)//;
                $title =~ s/\[新\]//;
+               $title =~ s/無料≫//;
                $title =~ s/\s*$//;
                $deltaday  = 7;
                $deltatime = 3;
@@ -992,8 +999,9 @@ if ( $mode eq 'list' ) {
        $HTML =~ s/%HTML_TITLE_OPT%/ - List/;
        $HTML .= qq {<div>\n};
 
-       my $recording = $cfg->param( 'path.recpath' );
-       my $recorded  = $cfg->param( 'path.recorded' );
+       my $recording   = $cfg->param( 'path.recpath' );
+       my $ts_movepath = $cfg->param( 'path.ts_movepath' );
+       my $recorded    = $cfg->param( 'path.recorded' );
 
        if ( $mode_sub eq 'log' ) {
                my $title = $q->param( 'title' );
@@ -1014,6 +1022,7 @@ if ( $mode eq 'list' ) {
        }
        if ( !$mode_sub || $mode_sub eq 'old' ) {
                $HTML .= "録画後のファイル一覧<br>\n";
+               &simple_list( $ts_movepath );
                &simple_list( $recorded );
        }
 
@@ -1403,6 +1412,9 @@ if ( $mode eq 'recognize' ) {
        $HTML .= qq {<textarea name="text" cols=40 rows=4>\n$text</textarea>\n};
        $HTML .= qq {<input type="submit" value="実行">\n</div>\n</form>\n};
 
+       my @ch_list = @{ $dbh->selectcol_arrayref( "SELECT chtxt FROM epg_ch" ) };
+       my $ch_list = join '|', @ch_list;
+
        if ( $text ) {
                my ( $year, $month, $day );
                my ( $hour, $minute );
@@ -1422,6 +1434,9 @@ if ( $mode eq 'recognize' ) {
                        ( $year, $month, $day ) = @date if ( $date[0] && $date[1] && $date[2] );
                        ( $hour, $minute )      = @time if ( defined $time[0] && defined $time[1] );
                        $next_day = 1 if ( $_ =~ /深夜/ );
+                       my ( $ch ) = /($ch_list)/;
+                       my $chtxt = $ch if ( $ch );
+
                        if ( $year && $month && $day && defined $hour && defined $minute ) {
                                my $tp = Time::Piece->strptime( "$year-$month-$day $hour:$minute", '%Y-%m-%d %H:%M' );
                                $tp += ONE_DAY if ( $next_day );
@@ -1490,6 +1505,9 @@ if ( $mode eq 'expert' ) {
        $HTML .= qq {<hr>\n地上波録画数:$ary[0]\n衛星波録画数:$ary[1]\n解読数:$ary[2]\n縁故数:$ary[3]\n<br>\n};
 
 
+       $HTML .= qq {<hr>\nRec10 バージョン:$rec10_version\nrectool バージョン:$rectool_version\n<br>\n};
+
+
        $HTML .= qq {<hr>\n番組表の欠落<br>\n};
        $ary_ref = $dbh->selectall_arrayref( "SELECT chname, chtxt FROM epg_ch" );
        foreach my $line ( @{$ary_ref} ) {
@@ -1514,6 +1532,7 @@ if ( $mode eq 'expert' ) {
                $HTML .= qq {<pre>\n$line->[0]\n$error</pre>\n} if ( $error );
                }
 
+
        $ary_ref = $dbh->selectall_arrayref( 
                "SELECT chname, chtxt, ontv, bctype, ch, csch, updatetime, status 
                FROM epg_ch 
@@ -1768,7 +1787,7 @@ sub draw_form_opt {
        if ( $chtxt  =~ /\Qbs-nhk-hi\E/ ) {
                $selected{F} = 'selected';
        }
-       elsif ( $chtxt  =~ /movieplus|nihoneiga/ ) {
+       elsif ( $chtxt  =~ /movieplus|nihoneiga|kidshd/ ) {
                $selected{H} = 'selected';
        }
        elsif ( $chtxt =~ /bs-nhk/ || $bctype =~ /cs/ ) {
@@ -1793,6 +1812,8 @@ sub draw_form_opt {
                        $selected{$opt} = 'selected' if ( $opt =~ /S|L|G|H|F/ );
                        $checked {$opt} = 'checked'  if ( $opt =~ /a|h|l|d|2|5/ );
                }
+               $checked{d} = $title =~ /\Q[二]\E|[二]|\Q(二)\E|(二)/ ? 'checked' : '';
+               $checked{5} = $title =~ /5\.1|5.1/ ? 'checked' : '';
        }
 
        $HTML .= qq {<select name="opt">\n};
@@ -1800,6 +1821,7 @@ sub draw_form_opt {
        $HTML .= qq {<option value="W" $selected{W}>W 854x480</option>\n};
        $HTML .= qq {<option value="H" $selected{H}>H 1280x720</option>\n};
        $HTML .= qq {<option value="F" $selected{F}>F 1920x1080</option>\n};
+       $HTML .= qq {<option value="I" $selected{I}>I インタレ保持</option>\n};
        $HTML .= qq {</select>\n};
 
        $HTML .= qq {<select name="opt">\n};
@@ -1875,8 +1897,8 @@ sub parse_program {
                );
        }
        if ( $id ) {
-               ( $type, $chtxt, $title, $begin, $end, $deltaday, $deltatime, $opt ) = $dbh->selectrow_array( 
-                       "SELECT type, chtxt, title, btime, etime, deltaday, deltatime, opt 
+               ( $type, $chtxt, $title, $begin, $end, $deltaday, $deltatime, $opt, $counter ) = $dbh->selectrow_array( 
+                       "SELECT type, chtxt, title, btime, etime, deltaday, deltatime, opt, counter 
                        FROM timeline WHERE id = '$id' " 
                );
                ( $ontv, $chname, $bctype ) = $dbh->selectrow_array(