Index: trunk/install/perl/foltialib.pl =================================================================== --- trunk/install/perl/foltialib.pl (リビジョン 124) +++ trunk/install/perl/foltialib.pl (リビジョン 1) @@ -4,5 +4,5 @@ $path = $0; $path =~ s/foltialib.pl$//i; -if ($path ne "./"){ +if ($pwd ne "./"){ push( @INC, "$path"); } @@ -13,37 +13,18 @@ use DBI; use DBD::Pg; -use DBD::SQLite; -use POSIX qw(strftime); - -$DSN=$main::DSN; + + + $DBDriv=$main::DBDriv; + $DBHost=$main::DBHost; + $DBPort=$main::DBPort; + $DBName=$main::DBName; $DBUser=$main::DBUser; $DBPass=""; - - $FILESTATUSRESERVINGLONG = 10; - $FILESTATUSRESERVINGSHORT = 20; - $FILESTATUSRECORDING = 30; - $FILESTATUSRECTSSPLITTING = 40; - $FILESTATUSRECEND = 50; - $FILESTATUSWAITINGCAPTURE = 55; - $FILESTATUSCAPTURE = 60; - $FILESTATUSCAPEND = 70; - $FILESTATUSTHMCREATE = 72; - $FILESTATUSWAITINGTRANSCODE = 80; - $FILESTATUSTRANSCODETSSPLITTING = 90; - $FILESTATUSTRANSCODEFFMPEG = 100; - $FILESTATUSTRANSCODEWAVE = 110; - $FILESTATUSTRANSCODEAAC = 120; - $FILESTATUSTRANSCODEMP4BOX = 130; - $FILESTATUSTRANSCODEATOM = 140; - $FILESTATUSTRANSCODECOMPLETE = 150; - $FILESTATUSALLCOMPLETE = 200; - - #------------------------------ sub writelog{ my $messages = $_[0]; - my $timestump = strftime("%Y/%m/%d_%H:%M:%S", localtime); +my $timestump = `date +%Y/%m/%d_%H:%M:%S`; chomp($timestump); if ($debugmode == 1){ @@ -144,8 +125,9 @@ my $stationname = $_[0] ; my $stationid ; +my $DBQuery = "SELECT count(*) FROM foltia_station WHERE stationname = '$item{ChName}'"; my $sth; - $sth = $dbh->prepare($stmt{'foltialib.getstationid.1'}); - $sth->execute($item{'ChName'}); + $sth = $dbh->prepare($DBQuery); + $sth->execute(); my @stationcount; @stationcount= $sth->fetchrow_array; @@ -153,6 +135,7 @@ if ($stationcount[0] == 1){ #チャンネルID取得 - $sth = $dbh->prepare($stmt{'foltialib.getstationid.2'}); - $sth->execute($item{'ChName'}); +$DBQuery = "SELECT stationid,stationname FROM foltia_station WHERE stationname = '$item{ChName}'"; + $sth = $dbh->prepare($DBQuery); + $sth->execute(); @stationinfo= $sth->fetchrow_array; #局ID @@ -162,5 +145,6 @@ }elsif($stationcount[0] == 0){ #新規登録 - $sth = $dbh->prepare($stmt{'foltialib.getstationid.3'}); +$DBQuery = "SELECT max(stationid) FROM foltia_station"; + $sth = $dbh->prepare($DBQuery); $sth->execute(); @stationinfo= $sth->fetchrow_array; @@ -169,8 +153,10 @@ ##$DBQuery = "insert into foltia_station values ('$stationid' ,'$item{ChName}','0','','','','','','')"; #新規局追加時は非受信局をデフォルトに - $sth = $dbh->prepare($stmt{'foltialib.getstationid.4'}); - $sth->execute($stationid, $item{'ChName'}, -10); +$DBQuery = "insert into foltia_station (stationid , stationname ,stationrecch ) values ('$stationid' ,'$item{ChName}','-1')"; + + $sth = $dbh->prepare($DBQuery); + $sth->execute(); #print "Add station;$DBQuery\n"; - &writelog("foltialib Add station;$stmt{'foltialib.getstationid.4'}"); +&writelog("foltialib Add station;$DBQuery"); }else{ @@ -241,219 +227,4 @@ -sub getphpstyleconfig{ -my $key = $_[0]; -my $phpconfigpath = ""; -my $configline = ""; - # read -if (-e "$phptoolpath/php/foltia_config2.php"){ - $phpconfigpath = "$phptoolpath/php/foltia_config2.php"; -}elsif(-e "$toolpath/php/foltia_config2.php"){ - $phpconfigpath = "$toolpath/php/foltia_config2.php"; -}else{ - $phpconfigpath = `locate foltia_config2.php | head -1`; - chomp($phpconfigpath); -} - - -if (-r $phpconfigpath ){ -open (CONFIG ,"$phpconfigpath") || die "File canot read.$!"; -while(){ - if (/$key/){ - $configline = $_; - $configline =~ s/\/\/.*$//; - $configline =~ s/\/\*.*\*\///; - }else{ - } -} -close(CONFIG); -}#end if -r $phpconfigpath -return ($configline); -}#end sub getphpstyleconfig - - -sub getpidbympegfilename { -#引き数:m2pfilename -#戻り値:PID -my $m2pfilename = $_[0] ; -if ($m2pfilename eq ""){ - return 0 ; -} - -my $sth; - $sth = $dbh->prepare($stmt{'foltialib.getpidbympegfilename.1'}); - $sth->execute($m2pfilename); -#print "$stmt{'foltialib.getpidbympegfilename.1'}\n"; -my @pidinfo = $sth->fetchrow_array; -my $pid = $pidinfo[0]; - -if ($pid eq ""){ - return 0 ; -}else{ - return $pid; -} -}#end sub getpidbympegfilename - -sub changefilestatus { -#引き数:PID,updatestatus -#戻り値:エラーコード -my $pid = $_[0] ; -my $updatestatus = $_[1]; -if (($pid eq "" ) || ($updatestatus eq "")){ - return 0 ; -} - -if ($updatestatus > 0 ){ -my $sth; - $sth = $dbh->prepare($stmt{'foltialib.changefilestatus.1'}); - $sth->execute($updatestatus, $pid); -return 1; -}else{ - &writelog("foltialib changefilestatus ERR Sttus invalid:$updatestatus"); - return 0 ; -} -}# end sub changefilestatus - - -sub getfilestatus { -#引き数:PID -#戻り値:ステータス - -#10:予約中(5分以上先) -#20:予約中(5分以内) -#30:録画中 -#40:TSSplit中 -#50:MPEG2録画終了 -#55 静止画キャプチャ待 -#60:静止画キャプ中 -#70:静止画キャプ終了 -#72:サムネイル作成済み(.THM) -#80:トラコン待 -#90:トラコン中:TSsplit -#100:トラコン中:H264 -#110:トラコン中:WAVE -#120:トラコン中:AAC -#130:トラコン中:MP4Box -#140:トラコン中:ATOM -#150:トラコン完了 -#200:全完了 -my $pid = $_[0] ; -if ($pid eq "" ){ - return 0 ; -} - -my $sth; - $sth = $dbh->prepare($stmt{'foltialib.getfilestatus.1'}); - $sth->execute($pid); - -my @statusinfo = $sth->fetchrow_array; -my $status = $statusinfo[0]; - -if ($status eq ""){ - return 0 ; -}else{ - return $status; -} - - -}# end sub getfilestatus - - -sub makemp4dir{ -#TIDが100以上の3桁の場合はそのまま -my $pspfilnamehd = $_[0]; -my $tid = $_[0]; -my $pspdirname = "$tid.localized/"; -$pspdirname = $recfolderpath."/".$pspdirname; - -#なければ作る -unless (-e $pspdirname ){ - system("$toolpath/perl/mklocalizeddir.pl $tid"); - #&writelog("recwrap mkdir $pspdirname"); -} -$pspdirname = "$tid.localized/mp4/"; -$pspdirname = $recfolderpath."/".$pspdirname; -#なければ作る -unless (-e $pspdirname ){ - mkdir $pspdirname ,0777; - #&writelog("recwrap mkdir $pspdirname"); -} -return ("$pspdirname"); -}#endsub makemp4dir - -sub pid2sid{ -#番組IDからStation IDを取得 -my $pid = $_[0]; -my $sth; - $sth = $dbh->prepare($stmt{'foltialib.pid2sid.1'}); - $sth->execute($pid); -my @statusinfo = $sth->fetchrow_array; -my $sid = $statusinfo[0]; - -if ($sid eq ""){ - return 0 ; -}else{ - return $sid; -} - -}#end sub pid2sid - - -sub mp4filename2tid{ -#MPEG4ファイル名からTIDを得る -my $mp4filename = $_[0]; - -my $sth; - $sth = $dbh->prepare($stmt{'foltialib.mp4filename2tid.1'}); - $sth->execute($mp4filename); -my @statusinfo = $sth->fetchrow_array; -my $tid = $statusinfo[0]; - -if ($tid eq ""){ - return 0 ; -}else{ - return $tid; -} -}#end sub mp4filename2tid - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - 1; Index: trunk/install/perl/folprep.pl =================================================================== --- trunk/install/perl/folprep.pl (リビジョン 112) +++ trunk/install/perl/folprep.pl (リビジョン 1) @@ -23,5 +23,5 @@ $path = $0; $path =~ s/folprep.pl$//i; -if ($path ne "./"){ +if ($pwd ne "./"){ push( @INC, "$path"); } @@ -29,9 +29,9 @@ require "foltialib.pl"; - -#PID探し -my $pid = $ARGV[0]; +#XMLゲット & DB更新 +system("$toolpath/perl/getxml2db.pl"); #引き数がアルか? +$pid = $ARGV[0] ; if ($pid eq "" ){ #引き数なし出実行されたら、終了 @@ -40,19 +40,9 @@ } -my $stationid = ""; -if ($pid <= 0){#EPG録画/キーワード録画 - #EPG更新 & DB更新 - $dbh = DBI->connect($DSN,$DBUser,$DBPass) ||die $DBI::error;; - $stationid = &pid2sid($pid); - &writelog("folprep DEBUG epgimport.pl $stationid"); - system("$toolpath/perl/epgimport.pl $stationid"); -}else{#しょぼかる録画 - #XMLゲット & DB更新 - &writelog("folprep DEBUG getxml2db.pl"); - system("$toolpath/perl/getxml2db.pl"); -} +#PID探し +$pid = $ARGV[0]; #キュー再投入 -&writelog("folprep $toolpath/perl/addpidatq.pl $pid"); + &writelog("folprep $toolpath/perl/addpidatq.pl $pid"); system("$toolpath/perl/addpidatq.pl $pid"); Index: trunk/install/perl/changestbch.pl =================================================================== --- trunk/install/perl/changestbch.pl (リビジョン 94) +++ trunk/install/perl/changestbch.pl (リビジョン 1) @@ -26,9 +26,8 @@ use DBI; use DBD::Pg; -use DBD::SQLite; $path = $0; $path =~ s/changestbch.pl$//i; -if ($path ne "./"){ +if ($pwd ne "./"){ push( @INC, "$path"); } @@ -55,8 +54,11 @@ # pidから局(送出コマンド)調べる #DB初期化 - $dbh = DBI->connect($DSN,$DBUser,$DBPass) ||die $DBI::error;; + my $data_source = sprintf("dbi:%s:dbname=%s;host=%s;port=%d", + $DBDriv,$DBName,$DBHost,$DBPort); + $dbh = DBI->connect($data_source,$DBUser,$DBPass) ||die $DBI::error;; - $sth = $dbh->prepare($stmt{'changestbch.1'}); - $sth->execute($pid); +$DBQuery = "SELECT foltia_station.tunertype,foltia_station.tunerch ,foltia_station.stationrecch ,foltia_station.stationid FROM foltia_subtitle,foltia_station WHERE foltia_subtitle.stationid = foltia_station.stationid AND foltia_subtitle.pid = '$pid' "; + $sth = $dbh->prepare($DBQuery); + $sth->execute(); @chstatus = $sth->fetchrow_array; $tunertype = $chstatus[0]; Index: trunk/install/perl/updatem2pfiletable.pl =================================================================== --- trunk/install/perl/updatem2pfiletable.pl (リビジョン 101) +++ trunk/install/perl/updatem2pfiletable.pl (リビジョン 1) @@ -16,40 +16,41 @@ use DBI; use DBD::Pg; -use DBD::SQLite; $path = $0; $path =~ s/updatem2pfiletable.pl$//i; -if ($path ne "./"){ +if ($pwd ne "./"){ push( @INC, "$path"); } require "foltialib.pl"; -$dbh = DBI->connect($DSN,$DBUser,$DBPass) ||die $DBI::error;; + my $data_source = sprintf("dbi:%s:dbname=%s;host=%s;port=%d", + $DBDriv,$DBName,$DBHost,$DBPort); + $dbh = DBI->connect($data_source,$DBUser,$DBPass) ||die $DBI::error;; -$dbh->{AutoCommit} = 0; # ひとまず消す -$sth = $dbh->prepare($stmt{'updatem2pfiletable.1'}); +$query = "DELETE FROM foltia_m2pfiles "; + $sth = $dbh->prepare($query); $sth->execute(); -while ($file = glob("$recfolderpath/*.m2?")) { + +while ($file = glob("$recfolderpath/*.m2p")) { $file =~ s/$recfolderpath\///; - $sth = $dbh->prepare($stmt{'updatem2pfiletable.2'}); - $sth->execute($file); -# print "$file\n"; -}#while -while ($file = glob("$recfolderpath/*.aac")) { -$file =~ s/$recfolderpath\///; - $sth = $dbh->prepare($stmt{'updatem2pfiletable.2'}); - $sth->execute($file); +$query = "insert into foltia_m2pfiles values ('$file')"; + $sth = $dbh->prepare($query); + $sth->execute(); # print "$file\n"; }#while -$oserr = $dbh->commit; - # foltia_mp4files -@mp4filelist = `find ${recfolderpath}/ | grep MP4`;#by foltia dev ticket #5 http://www.dcc-jpl.com/foltia/ticket/5 # ひとまず消す -$sth = $dbh->prepare($stmt{'updatem2pfiletable.3'}); +$query = "DELETE FROM foltia_mp4files "; + $sth = $dbh->prepare($query); $sth->execute(); + +@mp4filelist = `find $recfolderpath | grep MP4`; +# find /home/foltia/php/tv | grep MP4 + +#/home/foltia/php/tv/1057.localized/mp4/M4V-1057-14-20061016-2345.MP4 +#/home/foltia/php/tv/1057.localized/mp4/M4V-1057-15-20061023-2345.MP4 @@ -57,14 +58,17 @@ chomp(); s/$recfolderpath\///; +# 1057.localized/mp4/M4V-1057-14-20061016-2345.MP4 +# 1057.localized/mp4/M4V-1057-15-20061023-2345.MP4 @fileline = split (/\//); $filetid = $fileline[0]; $filetid =~ s/[^0-9]//g; -if (($filetid ne "" )&& ($fileline[2] ne "" )){ - $sth = $dbh->prepare($stmt{'updatem2pfiletable.4'}); - $oserr = $sth->execute($filetid, $fileline[2]); + +$query = "insert into foltia_mp4files values ('$filetid','$fileline[2]')"; + $sth = $dbh->prepare($query); + $sth->execute(); + + #print "$filetid;$fileline[2];$query\n" # http://www.atmarkit.co.jp/fnetwork/rensai/sql03/sql1.html -}#end if -}# end foreach -$oserr = $dbh->commit; +} Index: trunk/install/perl/foltia_conf1.pl.template =================================================================== --- trunk/install/perl/foltia_conf1.pl.template (リビジョン 131) +++ trunk/install/perl/foltia_conf1.pl.template (リビジョン 1) @@ -11,30 +11,19 @@ #config section $toolpath = '/home/foltia'; #「perl」ディレクトリがあるPATH -$recunits = 0; #アナログキャプチャカード搭載エンコーダの数 +$recunits = '4'; #搭載エンコーダの数 $recfolderpath = '/home/foltia/php/tv'; #録画ファイルを置くPATH $uhfbandtype = 1; # CATVなら1 UHF帯なら0 : 0=ntsc-bcast-jp 1=ntsc-cable-jp $rapidfiledelete = 1;#1なら削除ファイルは「mita」ディレクトリに移動。0なら即時削除 -$tunerinputnum = 0; #IO-DATA DV-MVP/RX,RX2,RX2W -$svideoinputnum = 1;#IO-DATA DV-MVP/RX,RX2,RX2W -$comvideoinputnum= 2;#IO-DATA DV-MVP/RX,RX2,RX2W +$tunerinputnum = 6; #IO-DATA DV-MVP/RX,RX2,RX2W +$svideoinputnum = 7;#IO-DATA DV-MVP/RX,RX2,RX2W +$comvideoinputnum = 8;#IO-DATA DV-MVP/RX,RX2,RX2W $haveirdaunit = 1;#Tira-2をつないでいるときに1,なければ0 $mp4filenamestyle = 1 ;#0:PSP ファームウェアver.2.80より前と互換性を持つファイル名 1;よりわかりやすいファイル名 -$trconqty = 2; -#0:PSP/iPod XviD MPEG4(旧式):faacとMPEG4IPを使って変換(古い設定) -#1:iPod Xvid MPEG4 標準画質 15fps 300kbps / デジタル 360x202 24.00fps 300kbps -#2:iPod H.264 中画質 24fps 300kbps / デジタル 480x272 29.97fps 400kbps -#3:iPod H.264 高画質 30fps 300kbps / デジタル 640x352 29.97fps 600kbps -$phptoolpath = $toolpath ;#php版の初期設定の位置。デフォルトではperlと同じ位置 -#以下はデフォルトでインストールしてればいじらなくてもいい - -## for postgresql -#$main::DSN="dbi:Pg:dbname=foltia;host=localhost;port=5432"; -#require 'db/Pg.pl'; - -## for sqlite -$main::DSN="dbi:SQLite:dbname=/home/foltia/foltia.sqlite"; -require 'db/SQLite.pl'; - +#デフォルトでインストールしてればいじらなくてもいい +$main::DBDriv="Pg"; +$main::DBHost="localhost"; +$main::DBPort="5432"; +$main::DBName="foltia"; $main::DBUser="foltia"; $main::DBPass=""; Index: trunk/install/perl/singletranscode.pl =================================================================== --- trunk/install/perl/singletranscode.pl (リビジョン 94) +++ trunk/install/perl/singletranscode.pl (リビジョン 1) @@ -28,5 +28,4 @@ use DBI; use DBD::Pg; -use DBD::SQLite; use Schedule::At; use Time::Local; @@ -35,5 +34,5 @@ $path = $0; $path =~ s/singletranscode.pl$//i; -if ($path ne "./"){ +if ($pwd ne "./"){ push( @INC, "$path"); } @@ -64,11 +63,15 @@ #PSPトラコン必要かどうか -$dbh = DBI->connect($DSN,$DBUser,$DBPass) ||die $DBI::error;; + my $data_source = sprintf("dbi:%s:dbname=%s;host=%s;port=%d", + + $DBDriv,$DBName,$DBHost,$DBPort); + $dbh = DBI->connect($data_source,$DBUser,$DBPass) ||die $DBI::error;; if ($ARGV[1] != ""){ $pid = $ARGV[1] ; }else{ - $sth = $dbh->prepare($stmt{'singletranscode.1'}); - $sth->execute($ARGV[0]); +$DBQuery = "SELECT pid FROM foltia_subtitle WHERE m2pfilename = '$ARGV[0]' "; + $sth = $dbh->prepare($DBQuery); + $sth->execute(); @pidarray = $sth->fetchrow_array; unless ($pidarray[0] == "" ){ @@ -83,11 +86,13 @@ # 追加部分 -$sth = $dbh->prepare($stmt{'singletranscode.2'}); -$sth->execute($tid, $countno); +$query = "SELECT count(*) FROM foltia_subtitle WHERE tid = '$tid' AND countno = '$countno' "; + $sth = $dbh->prepare($query); + $sth->execute(); @subticount= $sth->fetchrow_array; unless ($subticount[0] >= 1){ - $sth = $dbh->prepare($stmt{'singletranscode.3'}); - $sth->execute($tid); +$query = "SELECT count(*) FROM foltia_subtitle WHERE tid = '$tid' "; + $sth = $dbh->prepare($query); + $sth->execute(); @subticount= $sth->fetchrow_array; @@ -115,6 +120,7 @@ # PSP ------------------------------------------------------ #PSPトラコン必要かどうか -$sth = $dbh->prepare($stmt{'singletranscode.4'}); -$sth->execute($tid); +$DBQuery = "SELECT psp,aspect,title FROM foltia_program WHERE tid = '$tid' "; + $sth = $dbh->prepare($DBQuery); + $sth->execute(); @psptrcn= $sth->fetchrow_array; if ($psptrcn[0] == 1 ){#トラコン番組 @@ -221,5 +227,5 @@ my $newestmp4filename = `cd $pspdirname ; ls -t *.MP4 | head -1`; if ($newestmp4filename =~ /M4V$tid/){ - $nowcountno = $' ;#' + $nowcountno = $' ; $nowcountno++; $pspfilnameft = sprintf("%02d",$nowcountno); @@ -255,6 +261,7 @@ #最適化 - $sth = $dbh->prepare($stmt{'singletranscode.5'}); - $sth->execute($tid, $countno); +$DBQuery = "SELECT subtitle FROM foltia_subtitle WHERE tid = '$tid' AND countno = '$countno' "; + $sth = $dbh->prepare($DBQuery); + $sth->execute(); @programtitle = $sth->fetchrow_array; @@ -278,5 +285,5 @@ if (-e "$pspdirname/M4V".$pspfilname.".THM"){ - $timestamp = strftime("%Y%m%d-%H%M%S", localtime); +$timestamp =`date "+%Y%m%d-%H%M%S"`; chomp $timestamp; system("convert -crop 160x120+1+3 -resize 165x126\! $pspdirname/00000002.jpg $pspdirname/M4V".$pspfilname.".THM.".$timestamp.".THM"); @@ -290,16 +297,26 @@ system("rm -rf $pspdirname/0000000*.jpg "); + + + # MP4ファイル名をPIDレコードに書き込み unless ($pid eq ""){ - $sth = $dbh->prepare($stmt{'singletranscode.6'}); - $sth->execute("M4V$pspfilname.MP4", $pid); - &writelog("singletranscode UPDATEsubtitleDB $stmt{'singletranscode.6'}"); + $DBQuery = " + UPDATE foltia_subtitle + SET PSPfilename = 'M4V$pspfilname.MP4' + WHERE pid = '$pid' "; + $sth = $dbh->prepare($DBQuery); + $sth->execute(); +&writelog("singletranscode UPDATEsubtitleDB $DBQuery"); }else{ &writelog("singletranscode PID not found"); } # MP4ファイル名をfoltia_mp4files挿入 - $sth = $dbh->prepare($stmt{'singletranscode.7'}); - $sth->execute($tid, "M4V$pspfilname.MP4"); - &writelog("singletranscode UPDATEmp4DB $stmt{'singletranscode.7'}"); + $DBQuery = "insert into foltia_mp4files values ('$tid','M4V$pspfilname.MP4') "; + $sth = $dbh->prepare($DBQuery); + $sth->execute(); +&writelog("singletranscode UPDATEmp4DB $DBQuery"); }#PSPトラコンあり + + Index: trunk/install/perl/captureimagemaker.pl =================================================================== --- trunk/install/perl/captureimagemaker.pl (リビジョン 94) +++ trunk/install/perl/captureimagemaker.pl (リビジョン 1) @@ -14,5 +14,5 @@ $path = $0; $path =~ s/captureimagemaker.pl$//i; -if ($path ne "./"){ +if ($pwd ne "./"){ push( @INC, "$path"); } @@ -56,5 +56,5 @@ $date =~ s/[^0-9]//ig; if ($date eq "" ){ - $date = strftime("%Y%m%d", localtime); + $date = `date +%Y%m%d` } # print "DATE:$date\n"; @@ -65,5 +65,5 @@ $time =~ s/[^0-9]//ig; if ($time eq "" ){ - $time = strftime("%H%M", localtime); + $time = `date +%H%M` } # print "TIME:$time\n"; @@ -100,5 +100,5 @@ # $captureimgdir = "$tid"."-"."$countno"."-"."$date"."-"."$time"; $captureimgdir = $filename; -$captureimgdir =~ s/\.m2p$|\.m2t$//; +$captureimgdir =~ s/\.m2p$//; unless (-e "$capimgdirname/$captureimgdir"){ @@ -118,20 +118,4 @@ # 10秒ごとに -if ($filename =~ /m2t$/){ - &writelog("captureimagemaker DEBUG mplayer -ss 00:00:10 -vo jpeg:outdir=$capimgdirname/$captureimgdir/ -vf scale=192:108 -ao null -sstep 9 $recfolderpath/$filename"); - system ("mplayer -ss 00:00:10 -vo jpeg:outdir=$capimgdirname/$captureimgdir/ -vf scale=192:108 -ao null -sstep 9 $recfolderpath/$filename"); - if(-e "$capimgdirname/$captureimgdir/00000001.jpg" ){ #$capimgdirname/$captureimgdir/があったらなにもしない - }else{ #空っぽなら再試行 - &writelog("captureimagemaker DEBUG RETRY mplayer -ss 00:00:10 -vo jpeg:outdir=$capimgdirname/$captureimgdir/ -vf framestep=300step,scale=192:108 -ao null $recfolderpath/$filename"); - system ("mplayer -ss 00:00:10 -vo jpeg:outdir=$capimgdirname/$captureimgdir/ -vf framestep=300step,scale=192:108 -ao null $recfolderpath/$filename"); - } - -}else{ - &writelog("captureimagemaker DEBUG mplayer -ss 00:00:10 -vo jpeg:outdir=$capimgdirname/$captureimgdir/ -vf crop=690:460:12:10,scale=160:120 -ao null -sstep 9 -v 3 $recfolderpath/$filename"); - system ("mplayer -ss 00:00:10 -vo jpeg:outdir=$capimgdirname/$captureimgdir/ -vf crop=690:460:12:10,scale=160:120 -ao null -sstep 9 $recfolderpath/$filename"); - if(-e "$capimgdirname/$captureimgdir/00000001.jpg" ){ #$capimgdirname/ - }else{ - system ("mplayer -ss 00:00:10 -vo jpeg:outdir=$capimgdirname/$captureimgdir/ -vf framestep=300step,crop=690:460:12:10,scale=160:120 -ao null $recfolderpath/$filename"); - } -} +system ("mplayer -ss 00:00:10 -vo jpeg:outdir=$capimgdirname/$captureimgdir/ -vf crop=690:460:12:10,scale=160:120 -ao null -sstep 9 -v 3 $recfolderpath/$filename"); Index: trunk/install/perl/tvrecording.pl =================================================================== --- trunk/install/perl/tvrecording.pl (リビジョン 94) +++ trunk/install/perl/tvrecording.pl (リビジョン 1) @@ -5,5 +5,5 @@ # #tvrecording.pl -# record-v4l2.plを呼びだす録画モジュール。 +# record-v4l2.plに準備処理を加えた録画モジュール。 # #usage tvrecording.pl ch length(sec) [clip No(000-)] [filename] [bitrate(5)] [TID] [NO] [/dev/video0] @@ -11,5 +11,5 @@ #ch :録画チャンネル 0だとS入力、-1だとコンポジット入力 [必須項目] #length(sec) :録画秒数 [必須項目] -#[sleeptype] :0かN Nならスリープなしで録画 +#[clip No(000-)] :歴史的に0 #[filename] :出力ファイル名 #[bitrate(5)] :ビットレート Mbps単位で指定 @@ -24,10 +24,10 @@ -#use Time::HiRes qw(usleep); +use Time::HiRes qw(usleep); $path = $0; $path =~ s/tvrecording.pl$//i; -if ($path ne "./"){ +if ($pwd ne "./"){ push( @INC, "$path"); } @@ -42,7 +42,6 @@ #tvConfig.pl ------------------------------- $extendrecendsec = 10; #recording end second. -#$startupsleeptime = 52; #process wait(MAX60sec) -$startupsleeptime = 37; #process wait(MAX60sec) - +$startupsleeptime = 52; #process wait(MAX60sec) +#$startupsleeptime = 1; #process wait(MAX60sec) #------------------------------- @@ -64,6 +63,5 @@ $recfolderpath = '/home/foltia/php/tv'; }#end sub getRecPath -# -# -- ここからメイン ---------------------------- + #準備 &prepare; @@ -75,9 +73,9 @@ $reclengthsec = $reclengthsec + $extendrecendsec ; -&callrecordv4l; - &writelog("tvrecording:$recch:$reclengthsec:$outputfile:$recdevice:$capturedeviceinputnum:$ivtvrecch:$stdbitrate:$peakbitrate"); -# -- これ以下サブルーチン ---------------------------- +#------------------------------ + + sub chkextinput{ @@ -88,5 +86,5 @@ $capturedeviceinputnum = 7 ; } - $capturedeviceinputName = "S-Video 1"; + $capturedeviceinputName = "S-Video 0"; $ivtvrecch = ''; }elsif($recch == -1){ @@ -96,5 +94,5 @@ $capturedeviceinputnum = 8; } - $capturedeviceinputName = "Composite 1"; + $capturedeviceinputName = "Composite 0"; $ivtvrecch = ''; }else{ @@ -104,5 +102,5 @@ $capturedeviceinputnum = 6 ; } - $capturedeviceinputName = "Tuner 1"; + $capturedeviceinputName = "Tuner 0"; $ivtvrecch = $recch; } @@ -252,28 +250,16 @@ } #1分前にプロセス起動するから指定時間スリープ -#srand(time ^ ($$ + ($$ << 15))); -#my $useconds = int(rand(12000000)); -#my $intval = int ($useconds / 1000000); -#my $startupsleeptimemicro = ($startupsleeptime * 1000000) - $useconds; -#$reclengthsec = $reclengthsec + $intval + 1; -#&writelog("tvrecording: DEBUG SLEEP $startupsleeptime:$useconds:$intval:$startupsleeptimemicro"); -# usleep ( $startupsleeptimemicro ); - +srand(time ^ ($$ + ($$ << 15))); +my $useconds = int(rand(12000000)); +my $intval = int ($useconds / 1000000); +my $startupsleeptimemicro = ($startupsleeptime * 1000000) - $useconds; +$reclengthsec = $reclengthsec + $intval + 1; # $recch でウェイト調整入れましょう -#52 -#my $intval = $recch % 50; # 0〜49 -#my $startupsleep = $startupsleeptime - $intval; # 3〜52 (VHF 40-51) -#37 -my $intval = $recch % 35; # 0〜34 -my $startupsleep = $startupsleeptime - $intval; # 3-37 (VHF 25-36,tvk 30) -$reclengthsec = $reclengthsec + (60 - $startupsleep) + 1; # - -if ( $ARGV[2] ne "N"){ - &writelog("tvrecording: DEBUG SLEEP $startupsleeptime:$intval:$startupsleep:$reclengthsec"); - sleep ( $startupsleep); -}else{ - &writelog("tvrecording: DEBUG RAPID START"); - -} + + +&writelog("tvrecording: DEBUG SLEEP $startupsleeptime:$useconds:$intval:$startupsleeptimemicro"); + + usleep ( $startupsleeptimemicro ); + if ($recunits > 1){ my $deviceno = $recunits - 1;#3枚差しのとき/dev/video2から使う @@ -301,19 +287,19 @@ # $outputfile .= "$ARGV[3]"; # }else{ -# $outputfile .= strftime("%Y%m%d-%H%M", localtime(time + 60)); +# $outputfile .= `date +%Y%m%d-%H%M --date "1 min "`; # } $outputfile = $ARGV[3]; $outputfile = &filenameinjectioncheck($outputfile); - $outputfilewithoutpath = $outputfile ; $outputfile = $outputpath.$outputfile ; # $outputfile .= "$ARGV[3]"; -# $outputfile .= strftime("%Y%m%d-%H%M", localtime(time + 60)); - &writelog("tvrecording: DEBUG ARGV[2] ne null \$outputfile $outputfile "); +# $outputfile .= `date +%Y%m%d-%H%M --date "1 min "`; + &writelog("tvrecording: DEBUG ARGV[2] ne null \$outputfile $outputfile "); + }else{ - $outputfile .= strftime("%Y%m%d-%H%M", localtime(time + 60)); - chomp($outputfile); - $outputfile .= ".m2p"; - $outputfilewithoutpath = $outputfile ; - &writelog("tvrecording: DEBUG ARGV[2] is null \$outputfile $outputfile "); + $outputfile .= `date +%Y%m%d-%H%M --date "1 min "`; + chomp($outputfile); + $outputfile .= ".m2p"; +&writelog("tvrecording: DEBUG ARGV[2] is null \$outputfile $outputfile "); + } @@ -325,8 +311,6 @@ #二重録りなど既に同名ファイルがあったら中断 if ( -e "$outputfile" ){ - if ( -s "$outputfile" ){ - &writelog("tvrecording :ABORT :recfile $outputfile exist."); - exit 1; - } +&writelog("tvrecording :ABORT :recfile $outputfile exist."); +exit 1; } @@ -342,32 +326,1490 @@ }#end setbitrate - -sub callrecordv4l{ - -#$frequency = `ivtv-tune -d $recdevice -t $frequencyTable -c $ivtvrecch | awk '{print $2}'|tr -d .`; -my $ivtvtuneftype = ''; -if ($frequencyTable eq "ntsc-cable-jp"){ - $ivtvtuneftype = 'japan-cable'; -}else{ - $ivtvtuneftype = 'japan-bcast'; -} -#print "ivtv-tune -d $recdevice -t $ivtvtuneftype -c $ivtvrecch\n"; -&writelog("tvrecording DEBUG ivtv-tune -d $recdevice -t $ivtvtuneftype -c $ivtvrecch"); -&writelog("tvrecording DEBUG $ENV{PATH}"); - -$frequency = `env PATH=PATH=/usr/kerberos/bin:/usr/lib/ccache:/usr/local/bin:/bin:/usr/bin:/home/foltia/bin ivtv-tune -d $recdevice -t $ivtvtuneftype -c $ivtvrecch`; -&writelog("tvrecording DEBUG frequency:$frequency"); -@frequency = split(/\s/,$frequency); -$frequency[1] =~ s/\.//gi; -$frequency = $frequency[1] ; -&writelog("tvrecording DEBUG frequency:$frequency"); - -my $recordv4lcallstring = "$toolpath/perl/record-v4l2.pl --frequency $frequency --duration $reclengthsec --input $recdevice --directory $recfolderpath --inputnum $capturedeviceinputnum --inputname '$capturedeviceinputName' --freqtable $frequencyTable --bitrate $stdbitrate --peakbitrate $peakbitrate --output $outputfilewithoutpath "; - -&writelog("tvrecording $recordv4lcallstring"); -&writelog("tvrecording DEBUG $ENV{HOME}/.ivtvrc"); -$oserr = `env HOME=$toolpath $recordv4lcallstring`; -&writelog("tvrecording DEBUG $oserr"); - -}#end callrecordv4l - +#------------------------------------------------------------------------------------------------- +# record-v4l2.pl created by James A. Pattie 04/10/2003 +# Copyright 2003 +# Purpose: to record from the specified channel for the specified amount +# of time to the video OutputDirectory under the channel-start time name as video.mpg. + +# +# You can always get the latest version of this script at +# http://www.pcxperience.org/ +# + +#2003.11.18 patched by DCC-JPL + +# 20030425 - 1.4 - Added devfs support based upon patch submitted by +# Jonathan Kolb +# 20030426 - 1.5 - Imported the ptune.pl functionality +# 20030426 - 1.6 - moved -F -> -L, -F now lets you specify the frequency to tune to. +# 20030427 - 1.7 - renamed to record_ivtv.pl per Kevin's request. Added -R option. +# 20030430 - 1.8 - fixing some comparisons that needed to be strings, etc. +# 20030504 - 1.9 - Migrating to Video::ivtv for video resolution support. +# 20030505 - 1.10- Replaced open w/ sysopen but it doesn't make a difference. +# Starting to replace the Standard code w/ Video::ivtv methods. +# Added the version numbers that I require to the use statements. +# 20030507 - 1.11- Migrated to using get/setFrequency from Video::ivtv 0.03. +# 20030510 - 1.12- Migrated to using get/setInput from Video::ivtv 0.04. Moved to using +# the exported method names rather than Video::ivtv::method(). +# Converted to using enumerateStandard(). +# Fixed the condition where switching Video Standards will most likely +# not get the correct channel and so would switch back with channel = 0 +# which is invalid. In this case I store the previous frequency, do the +# channel change but signal to restore the previous frequency on cleanup. +# Converted to using enumerateInput(). +# 20030512 - 1.13- Added initial support for setting the bitrate/bitrate_peak values. +# 20030513 - 1.14- Tweaked the bitrate values to be closer to real DVD bitrates. +# Added support for the .ivtvrc config file and User Profiles. +# 20030516 - 1.15- Updated to the OO interface that Video::ivtv 0.06 now requires. +# Cleaned up a lot of the global variables into a settings hash. +# Made the -S command add any config items you specified on the command line +# that were not in the Profile being updated. This way you can add new items. +# Made the config file work from a mapping hash so that we can easily add/remove +# config items in the future. +# 20030518 - 1.16- Fixed a Frequency bug that happened when changing Video Standards and the +# Frequency came from a user specified Profile. +# 20030519 - 1.17- Adding the rest of the Codec related options to the config file / defaults. +# Switched to using Getopt::Long. You can specify all config file options at +# least by a --long version and still by the original -X command option. +# Cleaned up the option parsing code to take advantage of the mappings hash. +# 20030520 - 1.18- Fixing the handling of the Profile command line option. +# 20030524 - 1.19- Cleaned up the output for -L/--list-freqtable. Changed --list -> --list-freqtable. +# Added support to detect the v4l2 driver in use and disable the ivtv "enhancements" +# if driver != "ivtv". +# Renamed to record-v4l2.pl to reflect the ability of this program to record from any +# v4l2 device but with special support for the ivtv driver. +# 20030524 - 1.20- Improving the Ctrl-C handling (cleanup before dying). It may take a second or two +# before the program exits, but it should exit after resetting anything it changed, unless +# you had specified not to reset the card. +# Allow layering of profiles by calling -P/--profile multiple times. Each profile will +# be layered over the last. You will not be able to create/update a profile if you +# specify more than one though. +# Fixed a bug that would cause a parameter from the profile to be set n times, where n was +# the number of characters in the mapping string that consisted of the single letter | and +# the long command option name. Ex: Channel has 'c|channel' so the Channel value was being +# set 9 times instead of just the first time if it was in the profile. +# 20030525 - 1.21- Fixed devfsd detection code as it was overriding what came from the config file. +# Adding --no-record option so that we can start to implement the replacement functionality for +# ptune.pl (ie. Set all values and then exit, do not reset the card and do not capture) +# 20030607 - 1.22- Adding --directory-format and --date-format options so that the user can specify the +# naming convention to use when specifying the directory the output file should be put in. +# Tweaked some of the defaults. +# Create the config file if it doesn't exist, regardless of the --save flag being specified. +# Added method error() to output an error condition that doesn't warrant the whole usage and +# converted all relevant usage() calls to error() calls. +# Added option --debug to dynamically on the fly enable debug output. +# 20030609 - 1.23- Added option --list-channels to display the currently selected frequency tables contents. +# Changed the default output directory to '.'. +# Moved $debug -> $settings{Debug} so it can be stored in the config file. This allows you to +# turn debugging on for only certain profiles, etc. +# Restructured some of the validity tests to only happen as long as we are recording since they +# do not need to be validated when we are not recording. Mainly to do with the output stuff. +# 20030610 - 1.24- Moved the tunerNum variable into the config file: TunerNum +# Added --tuner-num option to dynamically set it. +# 20030614 - 1.25- I now require Video::ivtv 0.09 to make sure everyone is using the version that fixes the known +# reported segfault issues. +# Added freqtable "custom" support so that people using the new feature in ptune-ui.pl and have +# set their default frequency table to be "custom" will just work when they specify channel X, etc. +# I'm now sorting the command line input since otherwise I can't guarantee the order options get +# processed in, but even that is wrong. I need to use Tie::IxHash, but that isn't standard. +# 20030626 - 1.26- Updated to cover the audio -> audio_bitmask changes that Video::ivtv 0.11 implemented to cover +# the ivtv_ioctl_codec structure changes. +# Implemented config file versioning so that I know when the Audio entry needs to be updated in case it +# comes back in a future version of the ivtv_ioctl_codec structure. +# 20030628 - 1.27- Adding --list-inputs and --list-standards to display the available inputs and video standards. +# 20030713 - 1.28- Added code to make sure the codec properties are proper when switching standard to PAL/SECAM. +# Added config options SetMSPMatrix, MSPInput, MSPOutput, MSPSleep to allow the user to specify if they +# want the msp matrix updated any time the Video Standard is changed and to specify what they want programmed. +# Bumping the config file version to 2 to account for the new options. +# 20030715 - 1.29- Adding the missing msp matrix reset code in the reset section. +# Adding codec checks to make sure that they are right for NTSC. +# Made it legal to specify the channel by itself without -c/--channel. + + +#use strict; +use Getopt::Long qw(:config no_ignore_case bundling); +use Fcntl; +use Video::Frequencies 0.03; +use Video::ivtv 0.12; +use Config::IniFiles; + +my $version="1.29"; +my $cfgVersion = "2"; +my $cfgVersionStr = "_configVersion_"; # hopefully unique [defaults] value to let me know what version the config file is. + +my @capabilities = (); # The cards capabilities + +my %settings = ( + Channel => $ivtvrecch , # default to the ivtv default channel + RecordDuration => $reclengthsec , # default to 59 minutes 50 seconds (in seconds) - This lets 2 back to back cron jobs work! + InputNum => $capturedeviceinputnum , # TV-Tuner 0 on GV-MVP/RX $capturedeviceinputnum + InputName => "$capturedeviceinputName", + OutputDirectory => "$recfolderpath", + VideoDevice => "$recdevice", + VideoWidth => "720", # 720x480-fullscreen NTSC + VideoHeight => "480", + VideoStandard => "NTSC", # NTSC, PAL or SECAM + VideoType => "mpeg", # mpeg, yuv + Bitrate => "$stdbitrate", + PeakBitrate => "$peakbitrate", # peak bitrate + Aspect => 2, + AudioBitmask => 0x00e9, + BFrames => 3, + DNRMode => 0, + DNRSpatial => 0, + DNRTemporal => 0, + DNRType => 0, + Framerate => 0, + FramesPerGOP => 15, + GOPClosure => 1, + Pulldown => 0, + StreamType => 0, # 10 = DVD format (almost) + OutputFileName => "$outputfile", + FrequencyTable => "$frequencyTable", # default to NTSC_CABLE mapping. + Frequency => "", # user specified frequency. + ResetCardSettings => 1, + ConfigFileName => "$ENV{HOME}/.ivtvrc", + UpdateConfigFile => 0, + UseConfigFile => 0, + UsingIvtvDriver => 1, # default to being able to use the ivtv "enhancements". + DontRecord => 0, # default to always recording data. + DirectoryFormatString => " ", # format string used to define the sub directory under OutputDirectory + DateTimeFormatString => "+%Y%m%d-%H%M", # format string used to represent the date/time if the user wants it in their DirectoryFormatString + # define the Codec related min/max values + minBitrate => 1, + maxBitrate => 14500000, + minPeakBitrate => 1500, + maxPeakBitrate => 16000000, + # msp matrix settings + SetMSPMatrix => 1, + MSPInput => 3, + MSPOutput => 1, + MSPSleep => 2, # number of seconds the card needs before we can set the msp matrix. + # other settings + Debug => 0,#DEBUG + TunerNum => 0, +); + + +print " $settings{InputNum} / $settings{InputName} /IVTVRECCH:$settings{Channel}/$recdevice \n\n" if $settings{Debug}; + + +my $result=""; +my @profileNames=(); # list of user defined sections to work with in the config file. +my %configIni; # config hash we tie to for Config::IniFiles. +my $ivtvObj = Video::ivtv->new(); + +# map the Settings/Config file parameter to the command line variable that specifies it. +my %mappings = ( + "Channel" => "c|channel", + "RecordDuration" => "t|duration", + "InputNum" => "i|inputnum", + "InputName" => "I|inputname", + "OutputDirectory" => "D|directory", + "VideoDevice" => "d|input", + "VideoWidth" => "W|width", + "VideoHeight" => "H|height", + "VideoStandard" => "s|standard", + "VideoType" => "T|type", + "Bitrate" => "b|bitrate", + "PeakBitrate" => "B|peakbitrate", + "Aspect" => "aspect", + "AudioBitmask" => "audio-bitmask", + "BFrames" => "bframes", + "DNRMode" => "dnrmode", + "DNRSpatial" => "dnrspatial", + "DNRTemporal" => "dnrtemporal", + "DNRType" => "dnrtype", + "Framerate" => "framerate", + "FramesPerGOP" => "framespergop", + "GOPClosure" => "gopclosure", + "Pulldown" => "pulldown", + "StreamType" => "streamtype", + "OutputFileName" => "o|output", + "FrequencyTable" => "f|freqtable", + "Frequency" => "F|frequency", + "ResetCardSettings" => "R|noreset", + "DirectoryFormatString" => "directory-format", + "DateTimeFormatString" => "date-format", + "Debug" => "debug", + "TunerNum" => "tuner-num", + "SetMSPMatrix" => "set-msp-matrix", + "MSPInput" => "msp-input", + "MSPOutput" => "msp-output", + "MSPSleep" => "msp-sleep", + "OutputMPGFileName" => "outputmpgfilename", + ); + +my %codecMappings = ( + "Aspect" => "aspect", + "AudioBitmask" => "audio_bitmask", + "BFrames" => "bframes", + "Bitrate" => "bitrate", + "PeakBitrate" => "bitrate_peak", + "DNRMode" => "dnr_mode", + "DNRSpatial" => "dnr_spatial", + "DNRTemporal" => "dnr_temporal", + "DNRType" => "dnr_type", + "Framerate" => "framerate", + "FramesPerGOP" => "framespergop", + "GOPClosure" => "gop_closure", + "Pulldown" => "pulldown", + "StreamType" => "stream_type", + ); + +# check for devfs support +if ( -e "/dev/.devfsd" ) +{ + $settings{VideoDevice} = "/dev/v4l/video0"; +} + +## check for the config file +#if (-f $settings{ConfigFileName}) +#{ +# $settings{UseConfigFile} = 1; +# +# # tie to it. +# tie %configIni, 'Config::IniFiles', (-file => $settings{ConfigFileName}) or die "Error: Opening config file '$settings{ConfigFileName}' failed! $!\n"; +# +# my $profile = "defaults"; +# if (exists $configIni{$profile}) +# { +# my $saveFile = 0; +# # check version of the config file. +# if (!exists $configIni{$profile}{$cfgVersionStr}) +# { +# print "Updating config file to version 1...\n"; +# +# # first version config file! Update the Audio -> AudioBitmask entries. +# $configIni{$profile}{$cfgVersionStr} = 1; +# +# # find all entries that have Audio and move to AudioBitmask. +# foreach my $p (keys %configIni) +# { +# if (exists $configIni{$p}{Audio}) +# { +# $configIni{$p}{AudioBitmask} = $configIni{$p}{Audio}; +# delete $configIni{$p}{Audio}; +# } +# } +# +# $saveFile = 1; # signal we need to save the config changes. +# } +# if ($configIni{$profile}{$cfgVersionStr} != $cfgVersion) +# { +# # we need to upgrade +# if ($configIni{$profile}{$cfgVersionStr} == 1) +# { +# print "Updating config file to version 2...\n"; +# # add the MSP Matrix related options. +# $configIni{$profile}{SetMSPMatrix} = $settings{SetMSPMatrix}; +# $configIni{$profile}{MSPInput} = $settings{MSPInput}; +# $configIni{$profile}{MSPOutput} = $settings{MSPOutput}; +# $configIni{$profile}{MSPSleep} = $settings{MSPSleep}; +# $configIni{$profile}{$cfgVersionStr} = 2; +# $saveFile = 1; +# } +# } +# +# if ($saveFile) +# { +# # now save the updated config file before we continue. +# tied(%configIni)->RewriteConfig or die "Error: Writing config file '$settings{ConfigFileName}' failed! $!\n"; +# } +# +# # update the defaults stored. +# foreach my $arg (keys %mappings) +# { +# if (exists $configIni{$profile}{$arg}) +# { +# $settings{$arg} = $configIni{$profile}{$arg}; +# print "settings{$arg} = '" . $settings{$arg} . "'\n"; +# } +# } +# } +# else +# { +# print "Warning: config file '$settings{ConfigFileName}' exists but does not have the\n[$profile] section! Use -S to create it without specifying -P.\n\n"; +# } +#} +#else # create the config file +#{ +# print "Auto Creating config file $settings{ConfigFileName}...\n"; +# my $profile = "defaults"; +# +# # we have to create the config file and tie to it. +# tie %configIni, 'Config::IniFiles', () or die "Error: Initializing config file '$settings{ConfigFileName}' failed! $!\n"; +# +# # now set the name to work with. +# tied(%configIni)->SetFileName($settings{ConfigFileName}) or die "Error: Setting config file to '$settings{ConfigFileName}' failed! $!\n"; +# +# $configIni{$profile} = {}; # make sure the section exists. +# +# foreach my $arg (keys %mappings) +# { +# $configIni{$profile}{$arg} = $settings{$arg}; +# print "configIni{$profile}{$arg} = '" . $settings{$arg} . "'\n" if $settings{Debug}; +# } +# +# # set the config file version +# $configIni{$profile}{$cfgVersionStr} = $cfgVersion; +# +# # write the config file out. +# tied(%configIni)->RewriteConfig or die "Error: Writing config file '$settings{ConfigFileName}' failed! $!\n"; +#} + +# build up the "custom" frequency table +my %customMap = (); +foreach my $profileName (keys %configIni) +{ + next if $profileName =~ /^(defaults)$/; + + if (exists $configIni{$profileName}{Frequency}) + { + $customMap{$profileName} = $configIni{$profileName}{Frequency}; + } +} +$CHANLIST{custom} = \%customMap; + +# enumerations +my @standards; +my %name2std; +my @inputs; +my %name2input; +my @codecInfo; # stores the Codec Info +my @newCodecInfo; # the version we mess with. +# Current settings (Input, Channel, Standard) +my $curinput; +my $curinputName; +my $std; +my $curstd = "???"; +my $curStandard = 0; # numeric representation. +my $curChannel = 0; +my $curFrequency = 0; + +my $tuner; +my $err; +my $v4l2input; + +my $tmpDirectoryStr = formatDirectoryString(); +my $versionStr = "record-v4l2.pl $version for use with http://ivtv.sf.net/"; +my $usageStr = <<"END_OF_USAGE"; +$versionStr + +Usage: record-v4l2.pl [--channel CHANNEL] [--duration TIME] + [--directory DIRECTORY] [--output OUTPUT] + [--directory-format FORMAT] [--date-format FORMAT] + [--input VIDEO_DEV][--width WIDTH --height HEIGHT] + [--standard STANDARD] [--type TYPE] + [--inputnum INPUT#] [--inputname INPUT NAME] + [--freqtable FREQENCY MAP] [--frequency FREQUENCY] + [--bitrate BITRATE] [--peakbitrate PEAK_BITRATE] + [--set-msp-matrix BOOL] [--msp-sleep SLEEP] + [--msp-input INPUT] [--msp-output OUTPUT] + [--profile PROFILE] [--list-freqtable] [--list-channels] + [--no-record] [--noreset] [--save] [--help] [--version] + [--aspect ASPECT] [--audio-bitmask AUDIO-BITMASK] [--bframes BFRAMES] + [--dnrmode DNRMODE] [--dnrspatial DNRSPATIAL] + [--dnrtemporal DNRTEMPORAL] [--dnrtype DNRTYPE] + [--framerate FRAMERATE] [--framespergop FRAMESPERGOP] + [--gopclosure GOPCLOSURE] [--pulldown PULLDOWN] + [--streamtype STREAMTYPE] [--debug] + [--tuner-num TUNERNUM] + [--list-inputs] [--list-standards] [CHANNEL] + + -c/--channel CHANNEL: channel number to switch to + NOTE: You can also specify the channel by itself. + Ex. record-v4l2.pl 73 + would change to channel 73 using the default settings + or the settings from your ~/.ivtvrc config file. + -t/--duration TIME: number of seconds to record + -D/--directory DIRECTORY: Base directory to record into + --directory-format FORMAT: format string that specifies the + sub-directory to create under the base directory that + the output file will be created in. This can be empty + to indicate no sub-directory should be created. + + Available tokens are: + %d - date formatted by --date-format + %I - input name recorded from + Any white space in the name is converted to + underscores (_). Ex. 'Tuner 0' => 'Tuner_0' + + %c - channel or "freq-#" frequency + + --date-format FORMAT: format string that specifies the + date format string to generate and substitute for + %d in the --directory-format string. + + Available tokens: see the date commands man page. + The string must start with a + (plus). + + -o/--output OUTPUT: name of file to create + -d/--input VIDEO_DEV: video device to capture from + -W/--width WIDTH: width of screen (720 for NTSC fullscreen) + -H/--height HEIGHT: height of screen (480 for NTSC fullscreen) + -s/--standard STANDARD: NTSC, PAL or SECAM - video standard to record in + -T/--type TYPE: mpeg or yuv output + -i/--inputnum INPUT#: + The index number of the input you want to use (0 -> n-1) + -I/--inputname INPUT NAME: The name of the input you want to use. + -f/--freqtable FREQUENCY MAP: Specify the frequency mapping to use. + -F/--frequency FREQUENCY: Specify the frequency to tune to. + ex. 517250 = NTSC Cable 73 (SCiFi) + --tuner-num TUNERNUM: Specify the tuner to use. + --set-msp-matrix BOOL: 1 - set the msp matrix after Video Standard changes + 0 - never set the msp matrix + Uses the --msp-input and --msp-output options. + --msp-sleep SLEEP: number of seconds the card needs before we can program + the msp matrix. + --msp-input INPUT: Specify the input parameter to program the msp matrix. + Valid values are from 1 - 8. + --msp-output OUTPUT: Specify the output parameter to program the msp matrix. + Valid values are from 0 - 3. + -L/--list-freqtable: + list all available frequency mappings that Video::Frequencies knows + --list-channels: lists all channels and their frequencies for the + specified frequency table being used. + --list-inputs: lists all inputs the v4l2 driver reports. + --list-standards: lists all Video Standards the v4l2 driver supports. + -R/--noreset: Do not Reset anything that was changed + (standard, channel, resolution, etc.) + --no-record: Do not create any directories, capture data or reset the card + back to original settings. This is the ptune.pl mode. + -h/--help: display this help + -v/--version: display the version of this program + --debug: turns on debug output + + Codec related options: + -b/--bitrate BITRATE: Specify the Bitrate to capture at + -B/--peakbitrate PEAK_BITRATE: Specify the Peak Bitrate to capture at + --aspect ASPECT: Specify the aspect value + --audio-bitmask AUDIO-BITMASK: Specify the audio bitmask value + --bframes BFRAMES: Specify the bframes value + --dnrmode DNRMODE: Specify the dnr_mode value + --dnrspatial DNRSPATIAL: Specify the dnr_spatial value + --dnrtemporal DNRTEMPORAL: Specify the dnr_temporal value + --dnrtype DNRTYPE: Specify the dnr_type value + --framerate FRAMERATE: Specify the framerate value + --framespergop FRAMESPERGOP: Specify the framespergop value + --gopclosure GOPCLOSURE: Specify the gop_closure value + --pulldown PULLDOWN: Specify the pulldown value + --streamtype STREAMTYPE: Specify the stream_type value + + Config file related options: + -P/--profile PROFILE: Override defaults and command line values with the + config entries in the section labeled [PROFILE] from the + config file $settings{ConfigFileName}. + Examples: -P NTSC-DVD, -P PAL-DVD, --profile MY-SETTINGS + + You can specify this option multiple times and each successive + profile will overlay the defaults and any previous profiles. + You will not be able to create/update a profile if you do + specify multiple profiles. + -S/--save: save the current values as the defaults in + $settings{ConfigFileName}. + If -P/--profile PROFILE is specified, then those values that exist in + the specified profile will be updated. If the profile doesn't exist, + then it will be created, but will have all possible config items + defined in it. It will be your responsibility to hand check the + config file and remove any config items you do not want set for + that profile. + Any options specified on the command line will override options + defined in the config file. + +Notes: + If you specify both -i/--inputnum and -I/--inputname then + -i/--inputnum will take precedence. + + If you specify both -c/--channel and -F/--frequency then + -F/--frequency will take precedence. + + If you use a Profile, it has the ability to override all command line + arguments, so check your Profile first if things seem to be ignored. + +Defaults: + --duration $settings{RecordDuration} --input $settings{VideoDevice} --width $settings{VideoWidth} --height $settings{VideoHeight} --standard $settings{VideoStandard} + --type $settings{VideoType} --directory $settings{OutputDirectory} --output $settings{OutputFileName} + --directory-format "$settings{DirectoryFormatString}" --date-format "$settings{DateTimeFormatString}" + --inputnum $settings{InputNum} --inputname '$settings{InputName}' --freqtable $settings{FrequencyTable} + --set-msp-matrix $settings{SetMSPMatrix} --msp-sleep $settings{MSPSleep} --msp-input $settings{MSPInput} --msp-output $settings{MSPOutput} + --bitrate $settings{Bitrate} --peakbitrate $settings{PeakBitrate} --aspect $settings{Aspect} --audio-bitmask $settings{AudioBitmask} --bframes $settings{BFrames} + --dnrmode $settings{DNRMode} --dnrspatial $settings{DNRSpatial} --dnrtemporal $settings{DNRTemporal} --dnrtype $settings{DNRType} + --framerate $settings{Framerate} --framespergop $settings{FramesPerGOP} --gopclosure $settings{GOPClosure} --pulldown $settings{Pulldown} --streamtype $settings{StreamType} + --tuner-num $settings{TunerNum} + + config file = '$settings{ConfigFileName}' + + If Channel = $settings{Channel}, this would create: + $tmpDirectoryStr$settings{OutputFileName} + + Note: This script relies on Perl Modules: Video::Frequencies, Video::ivtv, + Config::IniFiles and Getopt::Long. +END_OF_USAGE + +# handle user input here +my %opts; +#getopts('c:t:o:hd:W:H:s:T:D:vi:I:f:F:LRb:B:P:S', \%opts); +GetOptions(\%opts, "channel|c=s", "duration|t=i", "output|o=s", "help|h", "input|d=s", "width|W=i", "height|H=i", "standard|s=s", + "type|T=s", "directory|D=s", "version|v", "inputnum|i=i", "inputname|I=s", "freqtable|f=s", "frequency|F=i", "list-freqtable|L", + "noreset|R", "bitrate|b=i", "peakbitrate|B=i", "profile|P=s@", "save|S", "aspect=i", "audio-bitmask=s", "bframes=i", "dnrmode=i", "dnrspatial=i", + "dnrtemporal=i", "dnrtype=i", "framerate=i", "framespergop=i", "gopclosure=i", "pulldown=i", + "streamtype=i", "no-record", "directory-format=s", "date-format=s", "debug", "list-channels", + "tuner-num=i", "list-inputs", "list-standards", "set-msp-matrix=i", "msp-input=i", "msp-output=i", "outputmpgfilename=s"); +if (scalar keys %opts == 0 && @ARGV == 0) +{ + usage(0, ""); +} +foreach my $option (sort keys %opts) +{ + my $found = 0; + foreach my $mapName (keys %mappings) + { + if ($option =~ /^($mappings{$mapName})$/) + { + $settings{$mapName} = $opts{$option}; + $found = 1; + print "$mapName = '$opts{$option}'\n" if $settings{Debug}; + } + } + if (!$found) + { + # handle the non-settings cases. + if ($option =~ /^(L|list-freqtable)$/) + { + my $errStr = "\nAvailable Frequency Mappings:\n"; + foreach my $name (sort keys %CHANLIST) + { + $errStr .= "$name\n"; + } + print "$versionStr\n$errStr"; + exit 0; + } + elsif ($option eq "list-channels") + { + my $errStr = "\nAvailable Channels for $settings{FrequencyTable}:\n"; + foreach my $name (sort { $a <=> $b } keys %{$CHANLIST{$settings{FrequencyTable}}}) + { + $errStr .= "$name\t= $CHANLIST{$settings{FrequencyTable}}->{$name}\n"; + } + print "$versionStr\n$errStr"; + exit 0; + } + elsif ($option =~ /^(no-record)$/) + { + $settings{DontRecord} = 1; + } + elsif ($option =~ /^(S|save)$/) + { + $settings{UpdateConfigFile} = 1; + } + elsif ($option =~ /^(P|profile)$/) + { + @profileNames = @{$opts{$option}}; + } + elsif ($option =~ /^(v|version)$/) + { + print "$versionStr\n"; + exit 0; + } + elsif ($option =~ /^(h|help)$/) + { + usage(0, ""); + } + elsif ($option =~ /^(list-inputs|list-standards)$/) + { + # do nothing for now since they will be handled later. + } + + else + { + usage(1, "-$option is an unknown option!"); + } + } +} + +if (@profileNames) +{ + # loop over all profiles the user specified. + foreach my $profileName (@profileNames) + { + print "profile = '$profileName'\n" if $settings{Debug}; + # for now the profile can not be "defaults". + if ($profileName eq "defaults") + { + error(1, "Profile = '$profileName' is invalid!"); + } + if (exists $configIni{$profileName}) + { + # update defaults/override command line arguments that exist in this profile. + my $profileUpdating = (((exists $opts{S} || exists $opts{save}) && @profileNames == 1) ? 1 : 0); + my $profile = $profileName; + + foreach my $arg (keys %mappings) + { + foreach my $option (split(/\|/, $mappings{$arg})) # handle the long/short command option versions + { + #print "arg = '$arg', option = '$option'\n" if $settings{Debug}; + if (exists $configIni{$profile}{$arg} && !($profileUpdating && exists $opts{$option})) + { + $settings{$arg} = $configIni{$profile}{$arg}; + print "settings{$arg} = '" . $settings{$arg} . "'\n" if $settings{Debug}; + last; + } + } + } + } + else + { + if ($settings{UpdateConfigFile} && @profileNames == 1) + { + print "Warning: Profile = '$profileName' will be created.\n" if ($settings{Debug}); + } + else + { + error(1, "Profile = '$profileName' does not exist! You must specify -S/--save to create it."); + } + } + } +} + +# verify input + +if (@ARGV) +{ + if (exists $opts{c} || exists $opts{channel}) + { + print "Warning: ignoring channel argument and using '$ARGV[0]' instead.\n"; + } + $settings{Channel} = $ARGV[0]; +} + +if (!$settings{DontRecord}) +{ + print "RecordDuration = $settings{RecordDuration}\n" if $settings{Debug}; + + if ($settings{VideoType} !~ /^(mpeg|yuv)$/) + { + error(1, "Video Type = '$settings{VideoType}' is invalid!"); + } + if ($settings{VideoType} eq "yuv") + { + # see if we need to change our defaults. + if (!exists $opts{o} && !exists $opts{output}) + { + $settings{OutputFileName} = "video.yuv"; + } + if (!exists $opts{d} && !exists $opts{input}) + { + if ( -e "/dev/.devfsd" ) + { + $settings{VideoDevice} = "/dev/v4l/yuv0"; + } + else + { + $settings{VideoDevice} = "/dev/yuv0"; + } + } + } +} + +if ( ! -c "$settings{VideoDevice}") +{ + error(1, "Video Dev = '$settings{VideoDevice}' is invalid! $!"); +} + +# now that the video device has been semi validated, we can use it to lookup +# the inputs, standards, etc. and use that for validating some of the following +# pieces of user input. +sysopen($tuner, $settings{VideoDevice}, O_RDWR) or die "Error unable to open '$settings{VideoDevice}': $!"; +my $tunerFD = fileno($tuner); + +# get the current capabilities. +@capabilities = $ivtvObj->getCapabilities($tunerFD); +if (@capabilities != keys %{$ivtvObj->{capIndexes}}) +{ + error(1, "getCapabilities() failed!"); +} +if ($capabilities[$ivtvObj->{capIndexes}{driver}] ne "ivtv") +{ + $settings{UsingIvtvDriver} = 0; # we can't use the ivtv "enhancements". + print "Warning: V4l2 driver = '$capabilities[$ivtvObj->{capIndexes}{driver}]' does not support the ivtv \"enhancements\"!\n"; + print " All codec related options will be ignored.\n\n"; +} + +my $i; + +# get the current video standard +$std = $ivtvObj->getStandard($tunerFD); +if ($std > 0) +{ + printf("Standard: 0x%08x\n",$std) if ($settings{Debug}); +} +else +{ + die "Error: getStandard() failed!\n"; +} + +# get the current input +$curinput = $ivtvObj->getInput($tunerFD); +if ($curinput < 0) +{ + die "Error: getInput() failed!\n"; +} +printf("Input: 0x%08x\n",$curinput) if ($settings{Debug}); + +my $done=0; +# Standards +for ($i=0; !$done; ++$i) +{ + my($index,$std_id,$name,$frameperiod_n,$frameperiod_d,$framelines) = $ivtvObj->enumerateStandard($tunerFD, $i); + if ($index == -1) + { + $done = 1; + } + else + { + printf("%d 0x%08x %s %d/%d %d\n",$index,$std_id,$name,$frameperiod_n,$frameperiod_d,$framelines) if ($settings{Debug}); + push @standards, [($name,$std_id)]; + $name2std{$name} = $std_id; + if( (($std_id & $std) == $std)) + { + $curstd = $name; + $curStandard = $std; + } + } +} + +if (exists $opts{'list-standards'}) +{ + print "$versionStr\n"; + print "Available Video Standards:\n"; + foreach my $standard (@standards) + { + print "$standard->[0]\n"; + } + exit 0; +} + +$done=0; +# Inputs +for ($i=0; !$done; ++$i) +{ + my($index,$name,$type,$audioset,$tuner,$std,$status) = $ivtvObj->enumerateInput($tunerFD, $i); + if ($index == -1) + { + $done = 1; + } + else + { + push @inputs, $name; + $name2input{$name} = $index; + } +} +$curinputName = $inputs[$curinput]; + +if (exists $opts{'list-inputs'}) +{ + print "$versionStr\n"; + print "Available Inputs:\n"; + my $counter = 0; + foreach my $input (@inputs) + { + print "$counter: $input\n"; + $counter++; + } + exit 0; +} + +if ($settings{UsingIvtvDriver}) +{ + # get the current Codec Info + @codecInfo = $ivtvObj->getCodecInfo($tunerFD); + if (@codecInfo != keys %{$ivtvObj->{codecIndexes}}) + { + error(1, "getCodecInfo() failed!"); + } + @newCodecInfo = $ivtvObj->getCodecInfo($tunerFD); + if (@newCodecInfo != keys %{$ivtvObj->{codecIndexes}}) + { + error(1, "getCodecInfo() failed!"); + } +} + +# finish validating the user input. + +if (!$settings{DontRecord}) +{ + if ($settings{RecordDuration} !~ /^(\d+)$/) + { + error(1, "Time = '$settings{RecordDuration}' is invalid!"); + } + + if ( ! -d "$settings{OutputDirectory}") + { + error(1, "Directory = '$settings{OutputDirectory}' is invalid! $!"); + } + + # assume for now we are only generating mpeg files. +# if (($settings{VideoType} eq "mpeg" && $settings{OutputFileName} !~ /^.+\.mpg$/) || ($settings{VideoType} eq "yuv" && $settings{OutputFileName} !~ /^.+\.yuv$/)) +# { +# error(1, "Output = '$settings{OutputFileName}' is invalid!"); +# } +# + if ($settings{DateTimeFormatString} !~ /^(\+((\%.)|.)+)$/) + { + usage(1, "Date Format String = '$settings{DateTimeFormatString}' is invalid!"); + } +} + +if ($settings{VideoWidth} !~ /^(\d+)$/) +{ + error(1, "Width = '$settings{VideoWidth}' is invalid!"); +} + +if ($settings{VideoHeight} !~ /^(\d+)$/) +{ + error(1, "Height = '$settings{VideoHeight}' is invalid!"); +} + +if (!exists $name2std{$settings{VideoStandard}}) +{ + my $validStandards = join(", ", keys(%name2std)); + error(1, "Video Standard = '$settings{VideoStandard}' is invalid!\nValid Standards are: $validStandards"); +} + +if (exists $opts{i} || exists $opts{inputnum}) +{ + if ($settings{InputNum} < 0 || $settings{InputNum} >= scalar(@inputs)) + { + error(1, "Video Input = '$settings{InputNum}' is invalid!\nValid Inputs are from 0 - " . int(scalar(@inputs) - 1)); + } + $settings{InputName} = $inputs[$settings{InputNum}]; +} + +if ((exists $opts{I} || exists $opts{inputname}) && !(exists $opts{i} || exists $opts{inputnum})) +{ + if (!exists $name2input{$settings{InputName}}) + { + my $validInputs = join(", ", @inputs); + error(1, "Video Input Name = '$settings{InputName}' is invalid!\nValid Input Names are: $validInputs"); + } + $settings{InputNum} = $name2input{$settings{InputName}}; +} + +if (!exists $CHANLIST{$settings{FrequencyTable}}) +{ + error(1, "Frequency Table = '$settings{FrequencyTable}' is invalid!"); +} + +# only validate the channel if the input is a tuner. +if ($inputs[$settings{InputNum}] =~ /Tuner/) +{ + if ($settings{TunerNum} !~ /^(\d)$/) + { + error(1, "TunerNum = '$settings{TunerNum}' is invalid!"); + } + if (exists $opts{F} || exists $opts{frequency} || $settings{Frequency}) # the user may have specified a Frequency in their config file + { + if ($settings{Frequency} !~ /^(\d+)$/) + { + error(1, "Frequency = '$settings{Frequency}' is invalid!"); + } + $settings{Channel} = "freq-$settings{Frequency}"; # make sure we output the channel part. + } + # now verify that the channel exists in the frequency table! + else + { + if (!$settings{Channel}) + { + error(1, "channel = '$settings{Channel}' is invalid!"); + } + # first verify the freqency table is appropriate for the standard (NTSC, PAL, SECAM), + # unless they specified the frequency to tune to. + if ($settings{FrequencyTable} !~ /^(custom|$settings{VideoStandard})/i) + { + error(1, "You specified Video Standard '$settings{VideoStandard}' which is incompatible with Frequency Table '$settings{FrequencyTable}'!"); + } + if (!exists $CHANLIST{$settings{FrequencyTable}}->{$settings{Channel}}) + { + error(1, "Channel = '$settings{Channel}' does not exist in Frequency Table '$settings{FrequencyTable}'!"); + } + } + + # get the current channel/frequency value. + my $Frequency; + if(($Frequency = $ivtvObj->getFrequency($tunerFD, $settings{TunerNum})) >= 0) + { + my $freq = ($Frequency * 1000) / 16; + print "freq = $freq\n" if ($settings{Debug}); + # find the associated channel. + if ((!exists $opts{F} && !exists $opts{frequency} && !$settings{Frequency}) && ($curstd eq $settings{VideoStandard}) ) + { + foreach my $chan (keys %{$CHANLIST{$settings{FrequencyTable}}}) + { + if ($CHANLIST{$settings{FrequencyTable}}->{$chan} == $freq) + { + $curChannel = $chan; + } + } + print "curChannel = $curChannel\n" if ($settings{Debug}); + } + else + { + $curFrequency = $freq; + } + } + else + { + die "Error: getFrequency() failed!\n"; + } +} +else +{ + # set the channel = "" so we know to ignore it. + $settings{Channel} = ""; +} + +if ($settings{UsingIvtvDriver}) +{ + # validate the Codec related stuff. + if ($settings{Bitrate} < $settings{minBitrate} || $settings{Bitrate} > $settings{maxBitrate}) + { + error(1, "Bitrate = '$settings{Bitrate}' is invalid!"); + } + if ($settings{PeakBitrate} <= $settings{Bitrate}) + { + error(1, "PeakBitrate can not be less than or equal to Bitrate!"); + } + elsif ($settings{PeakBitrate} < $settings{minPeakBitrate} || $settings{PeakBitrate} > $settings{maxPeakBitrate}) + { + error(1, "PeakBitrate = '$settings{PeakBitrate}' is invalid!"); + } + + if ($settings{VideoStandard} !~ /^(NTSC)/) + { + my $warn = 0; + if ($settings{Framerate} == 0) + { + $settings{Framerate} = 1; + $warn = 1; + } + if ($settings{FramesPerGOP} == 15) + { + $settings{FramesPerGOP} = 12; + $warn = 1; + } + if ($warn) + { + print "Warning: Setting Framerate/FramesPerGOP to PAL settings for Video Standard '$settings{VideoStandard}'!\n\nYou should either specify on the command line or in the ~/.ivtvrc config file.\n"; + } + } + elsif ($settings{VideoStandard} =~ /^(NTSC)/) + { + my $warn = 0; + if ($settings{Framerate} == 1) + { + $settings{Framerate} = 0; + $warn = 1; + } + if ($settings{FramesPerGOP} == 12) + { + $settings{FramesPerGOP} = 15; + $warn = 1; + } + if ($warn) + { + print "Warning: Setting Framerate/FramesPerGOP to NTSC settings for Video Standard '$settings{VideoStandard}'!\n\nYou should either specify on the command line or in the ~/.ivtvrc config file.\n"; + } + } + + if ($settings{SetMSPMatrix} !~ /^(0|1)$/) + { + error(1, "SetMSPMatrix = '$settings{SetMSPMatrix}' is invalid! It can only be 0 or 1."); + } + if ($settings{MSPInput} < 1 || $settings{MSPInput} > 8) + { + error(1, "MSPInput = '$settings{MSPInput}' is invalid! It can only be 1 - 8."); + } + if ($settings{MSPOutput} < 0 || $settings{MSPOutput} > 3) + { + error(1, "MSPOutput = '$settings{MSPOutput}' is invalid! It can only be 0 - 3."); + } +} + +# update the config file if the user wants us to. +if ($settings{UpdateConfigFile}) +{ + my $profile; + if (@profileNames > 1) + { + print "Warning: Not updating config file as you have more than 1 profile specified!\n"; + } + elsif (@profileNames == 1) + { + $profile = $profileNames[0]; + } + else + { + $profile = "defaults"; + } + if ($profile) + { + my $createProfile = (exists $configIni{$profile} ? 0 : 1); + print "Creating Profile = '$profile': $createProfile\n" if ($settings{Debug}); + + if (!$settings{UseConfigFile}) + { + # we have to create the config file and tie to it. + tie %configIni, 'Config::IniFiles', () or die "Error: Initializing config file '$settings{ConfigFileName}' failed! $!\n"; + + # now set the name to work with. + tied(%configIni)->SetFileName($settings{ConfigFileName}) or die "Error: Setting config file to '$settings{ConfigFileName}' failed! $!\n"; + + $configIni{$profile} = {}; # make sure the section exists. + } + + foreach my $arg (keys %mappings) + { + foreach my $option (split(/\|/, $mappings{$arg})) # handle the long/short command option versions + { + if (exists $configIni{$profile}{$arg} || $createProfile || exists $opts{$option}) + { + $configIni{$profile}{$arg} = $settings{$arg}; + print "configIni{$profile}{$arg} = '" . $settings{$arg} . "'\n" if $settings{Debug}; + last; + } + } + } + + # write the config file out. + tied(%configIni)->RewriteConfig or die "Error: Writing config file '$settings{ConfigFileName}' failed! $!\n"; + } +} + +# this hash keeps track of those values I have to set back. +my %changedSettings = ( + resolution => 0, + standard => 0, + VideoType => 0, + InputNum => 0, + Channel => 0, + Frequency => 0, + codec => 0, + ); + +my $directoryName; +if (!$settings{DontRecord}) +{ + # make directory + #$directoryName = formatDirectoryString(); + #$result=`mkdir -p $directoryName`; + $directoryName = $settings{DirectoryFormatString}; +} + +# change the channel +if ($inputs[$settings{InputNum}] =~ /Tuner/) +{ + if (exists $opts{F} || exists $opts{frequency} || $settings{Frequency}) + { + if ($settings{Frequency} != $curFrequency) + { + $changedSettings{Frequency} = 1; + tuneFrequency($settings{Frequency}); + } + } + else + { + if ($curstd ne $settings{VideoStandard}) + { + # we have to set the channel regardless. + # but we want to tune back to the previous frequency. + $changedSettings{Frequency} = 1; + changeChannel($settings{Channel}); + } + elsif ($settings{Channel} ne $curChannel) + { + # otherwise we just changeChannel and restore the previous channel. + $changedSettings{Channel} = 1; + changeChannel($settings{Channel}); + } + } +} + +# set the video standard +if ($settings{VideoStandard} ne $curstd) +{ + $changedSettings{standard} = 1; + change_standard(); + + # see if we have to re-program the msp matrix + if ($settings{UsingIvtvDriver}) + { + if ($settings{SetMSPMatrix}) + { + print "Setting msp matrix: input = $settings{MSPInput}, output = $settings{MSPOutput}\n" if $settings{Debug}; + sleep ($settings{MSPSleep}); # sleep for 2 seconds to let card settle down. + $result = $ivtvObj->mspMatrixSet($tunerFD, $settings{MSPInput}, $settings{MSPOutput}); + if (not defined $result) + { + die "Error calling mspMatrixSet!\n"; + } + if (!$result) + { + die "Error in mspMatrixSet ioctl call!\n"; + } + } + } +} + +# set the input +if ($settings{InputNum} != $curinput || $settings{InputName} ne $curinputName) +{ + $changedSettings{InputNum} = 1; + if (!(exists $opts{i} || exists $opts{inputnum} || exists $opts{I} || exists $opts{inputname})) # our defaults are different than the current values! + { + ## print "Warning: Changing input from $curinputName to $settings{InputName}\n"; + &writelog("tvrecording: Changing input from $curinputName to $settings{InputName}"); + } + change_input(); +} + +# set the capture type + +# store the current width,height so we can restore afterwards +my ($oldWidth, $oldHeight) = $ivtvObj->getResolution($tunerFD); +print "oldWidth = '$oldWidth', oldHeight = '$oldHeight'\n" if ($settings{Debug}); + +if ($settings{VideoWidth} != $oldWidth || $settings{VideoHeight} != $oldHeight) +{ + $changedSettings{resolution} = 1; +} + +# specify the width,height to capture +if ($changedSettings{resolution}) +{ + $result = $ivtvObj->setResolution($tunerFD, $settings{VideoWidth}, $settings{VideoHeight}); + if (not defined $result) + { + die "Error calling setResolution!\n"; + } + if (!$result) + { + die "Error in setResolution ioctl call!\n"; + } +} + +if ($settings{UsingIvtvDriver}) +{ + # specify the codec options to capture mpeg's at. + foreach my $codecName (keys %codecMappings) + { + my $codecIndex = $ivtvObj->{codecIndexes}{$codecMappings{$codecName}}; + if ($codecInfo[$codecIndex] != $settings{$codecName}) + { + $changedSettings{codec} = 1; + $newCodecInfo[$codecIndex] = $settings{$codecName}; + print "new $codecName = '$settings{$codecName}', old $codecName = '$codecInfo[$codecIndex]'\n" if $settings{Debug}; + } + } +} + +if ($changedSettings{codec}) +{ + $result = $ivtvObj->setCodecInfo($tunerFD, @newCodecInfo); + if (!$result) + { + die "Error calling setCodecInfo()!\n"; + } +} + +if (!$settings{DontRecord}) +{ + # capture the video/audio to video.mpg + #print "directoryName:$directoryName, RecordDuration:$settings{RecordDuration},OutputFileName:$settings{OutputFileName}:tuner:$tuner ,OutputMPGFileName:$settings{OutputMPGFileName} \n"; + #directoryName:, RecordDuration:60,OutputFileName:/tv/JOAX-20040615-1411-000.MPG:tuner:GLOB(0x8224838) ,OutputMPGFileName: + captureVideo(directoryName => $directoryName, RecordDuration => $settings{RecordDuration}, + OutputFileName => $settings{OutputFileName}, tuner => $tuner ,OutputMPGFileName => $settings{OutputMPGFileName}); +} + +if ($settings{ResetCardSettings} && !$settings{DontRecord}) +{ + # restore Codec values + if ($changedSettings{codec}) + { + $result = $ivtvObj->setCodecInfo($tunerFD, @codecInfo); + if (!$result) + { + die "Error calling setCodecInfo()!\n"; + } + } + + # restore the previous width,height settings + if ($changedSettings{resolution}) + { + $result = $ivtvObj->setResolution($tunerFD, $oldWidth, $oldHeight); + if (not defined $result) + { + die "Error calling setResolution!\n"; + } + if (!$result) + { + die "Error in setResolution ioctl call!\n"; + } + } + + # restore the previous input setting + if ($changedSettings{InputNum}) + { + # reset back to the old input name + $settings{InputName} = $curinputName; + change_input(); + } + + # restore the previous video standard + if ($changedSettings{standard}) + { + $settings{VideoStandard} = $curstd; + change_standard(); + + # see if we have to re-program the msp matrix + if ($settings{UsingIvtvDriver}) + { + if ($settings{SetMSPMatrix}) + { + print "Setting msp matrix: input = $settings{MSPInput}, output = $settings{MSPOutput}\n" if $settings{Debug}; + sleep ($settings{MSPSleep}); # sleep for 2 seconds to let card settle down. + $result = $ivtvObj->mspMatrixSet($tunerFD, $settings{MSPInput}, $settings{MSPOutput}); + if (not defined $result) + { + die "Error calling mspMatrixSet!\n"; + } + if (!$result) + { + die "Error in mspMatrixSet ioctl call!\n"; + } + } + } + } + + # restore the previous channel + if ($changedSettings{Channel}) + { + changeChannel($curChannel); + } + if ($changedSettings{Frequency}) + { + tuneFrequency($curFrequency); + } +} + +# close the tuner device +close($tuner); + + +exit 0; + +# usage(returnValue, ErrorString) +# returnValue = 1 or 0 +# ErrorString = message you want to tell the user, but only if returnValue = 1. +sub usage +{ + my $errorCode = shift; + my $error = shift; + + print $usageStr; + print "\nError: $error\n" if ($errorCode == 1); + print "$error\n" if ($errorCode == 2); + + exit $errorCode; +} + +# error(returnValue, ErrorString) +# returnValue = 1 or 0 +# ErrorString = message you want to tell the user. +sub error +{ + my $errorCode = shift; + my $error = shift; + + print "$versionStr"; + print "\nError: $error\n"; + + exit $errorCode; +} + +# changes the input to $settings{InputNum} as long as it isn't = $curinput +sub change_input { + my $preinput = $name2input{$settings{InputName}}; + if($preinput != $curinput) + { + $curinput = $preinput; + print "input now $settings{InputName}, #$preinput\n" if ($settings{Debug}); + my $result = $ivtvObj->setInput($tunerFD, $preinput); + if (!$result) + { + die "Error: setInput($preinput) failed!\n"; + } + } +} + +# changes the video standard to $settings{VideoStandard} as long as it isn't = $curstd +sub change_standard { + my $standard = $name2std{$settings{VideoStandard}}; + if($standard != $curStandard) + { + $curStandard = $standard; + print "standard now $settings{VideoStandard}, #$standard\n" if ($settings{Debug}); + my $result = $ivtvObj->setStandard($tunerFD, $standard); + if (!$result) + { + die "Error: setStandard($standard) failed!\n"; + } + } +} + +# changes the channel +# takes the channel to change +sub changeChannel +{ + my $ch = shift; + my $freq = $CHANLIST{$settings{FrequencyTable}}->{$ch}; + my $driverf = ($freq * 16)/1000; + + print "Ch.$ch: $freq $driverf\n" if ($settings{Debug}); + + if (!$ivtvObj->setFrequency($tunerFD, $settings{TunerNum}, $driverf)) + { + die "Error: changeChannel($ch) failed!\n"; + } +} + +# tunes to the specified frequency +# takes the frequency to tune to +sub tuneFrequency +{ + my $freq = shift; + my $driverf = ($freq * 16)/1000; + + print "freq: $freq $driverf\n" if ($settings{Debug}); + + if (!$ivtvObj->setFrequency($tunerFD, $settings{TunerNum}, $driverf)) + { + die "Error: tuneFrequency($freq) failed!\n"; + } +} + +my $done = 0; + +sub catch_alarm { + $done = 1; +} +sub get_next_file_name +{ + + my $file_name = shift(@_); + $file_name =~ m/^(.+?)\-(\d{4})(\d{2})(\d{2})\-(\d{2})(\d{2})\-(\d{3})\.(.+?)$/; + + my $station = $1; + my $year = $2; + my $month = $3; + my $day = $4; + my $hour = $5; + my $min = $6; + my $seq = $7; + my $ext = $8; + $seq++; + my $new_file_name = sprintf("%s-%04d%02d%02d-%02d%02d-%03d.%s", + $station,$year,$month,$day,$hour,$min,$seq,$ext); + return $new_file_name +} + +# does the actual video capturing work. +# takes directoryName, RecordDuration, OutputFileName, tuner +sub captureVideo +{ + my %args = ( @_ ); + my $directoryName = $args{directoryName}; + my $RecordDuration = $args{RecordDuration}; + my $OutputFileName = $args{OutputFileName}; + my $tuner = $args{tuner}; + my $fname = "$directoryName/$OutputFileName"; +# "OutputMPGFileName" => "outputmpgfilename", +# my $OutputFileName = $args{OutputMPGFileName}; + my $OutputFileName = $args{OutputFileName}; +# my $fname = "$directoryName/$OutputFileName"; + my $fname = $args{OutputFileName}; + + + # setup global variables, signal handlers, etc. + + $SIG{ALRM} = \&catch_alarm; + $SIG{INT} = \&catch_alarm; # handle Ctrl-C + + # turn off file buffering. + #$|=1; + + # open the file for writing. + + + + sysopen(OUTPUT, "$fname", O_CREAT | O_WRONLY | O_LARGEFILE) or die "Error creating file '$fname': $!\n"; + + alarm($RecordDuration); + my $buf = ""; + my $len = 0; + while (!$done && read($tuner, $buf, 16384)) + { + $len += length($buf); +# if ($len >= $max_file_size ) +# { +# close(OUTPUT); +# $OutputFileName = get_next_file_name($OutputFileName); +## $fname = "$directoryName/$OutputFileName"; +# $fname = "$OutputFileName"; +# &writelog("tvrecording switch next clip.$fname"); +# sysopen(OUTPUT, "$fname", O_CREAT | O_WRONLY | O_LARGEFILE) +# or die "Error creating file '$fname': $!\n"; +# $len = 0; +# } + + # read from the device and write to the file. + print OUTPUT $buf; + } + + # close the file + close(OUTPUT); + + #$|=0; # turn file buffering back on. +} + +# returns the formatted directory string +sub formatDirectoryString +{ + my $temp = $settings{DirectoryFormatString}; + my $result = $settings{OutputDirectory}; + my %lookupTable = ( + "d" => `/bin/date "$settings{DateTimeFormatString}"`, + "I" => $settings{InputName}, + "c" => $settings{Channel}, + ); + + # fixup the InputName value + $lookupTable{I} =~ s/\s/_/g; + # cleanup the trailing slash on the date + chomp $lookupTable{d}; + + foreach my $option ("d", "I", "c") + { + $temp =~ s/\%$option/$lookupTable{$option}/g; + } + + $result .= "/" . ($temp ? "$temp/" : ""); + + return $result; +} + + + + + Index: trunk/install/perl/getxml2db.pl =================================================================== --- trunk/install/perl/getxml2db.pl (リビジョン 109) +++ trunk/install/perl/getxml2db.pl (リビジョン 1) @@ -19,10 +19,8 @@ use DBI; use DBD::Pg; -use DBD::SQLite; -use Digest::MD5 qw(md5_hex); $path = $0; $path =~ s/getxml2db.pl$//i; -if ($path ne "./"){ +if ($pwd ne "./"){ push( @INC, "$path"); } @@ -40,43 +38,28 @@ } -# http://sites.google.com/site/syobocal/spec/cal_chk-php -#if ($ARGV[0] eq "long"){ -# $uri="http://cal.syoboi.jp/cal_chk.php"; -# #$uri="http://syobocal.orz.hm/cal_chk.php"; -# &writelog("getxml2db use long mode."); -#}else{ -# $uri="http://cal.syoboi.jp/cal_chk.xml"; -# #$uri="http://syobocal.orz.hm/cal_chk.xml"; -#} -$uri = "http://cal.syoboi.jp/cal_chk.php?days="; -$uri .= ($ARGV[0] eq "long")? 14: 7; - -$dbh = DBI->connect($DSN,$DBUser,$DBPass) ||die $DBI::error;; - -$dbh->{AutoCommit} = 0; - -# If-Modified-Since使うように変更#2008/11/14 -my $CacheDir = '/tmp/shobocal'; -if (! -e $CacheDir) { - mkdir $CacheDir or die "cannot create $CacheDir: $!"; -} -my $cache = sprintf("%s/%s.xml", $CacheDir, Digest::MD5::md5_hex($uri)); -LWP::Simple::mirror($uri, $cache) or die "cannot get content from $uri"; -open(SHOBO, "<$cache"); -my (@line) = ; -close(SHOBO); -#my ($content) = get("$uri"); -#if ($content eq ""){ -#&writelog("getxml2db no responce from $uri, exit:"); -# exit;#しょぼかるが落ちているなど -#} -#my (@line) = split(/\n/, $content); +if ($ARGV[0] eq "long"){ + $uri="http://cal.syoboi.jp/cal_chk.php"; + &writelog("getxml2db use long mode."); +}else{ + $uri="http://cal.syoboi.jp/cal_chk.xml"; +} + + + my $data_source = sprintf("dbi:%s:dbname=%s;host=%s;port=%d", + $DBDriv,$DBName,$DBHost,$DBPort); + + $dbh = DBI->connect($data_source,$DBUser,$DBPass) ||die $DBI::error;; + +my ($content) = get("$uri"); +if ($content eq ""){ +&writelog("getxml2db no responce from $uri, exit:"); + exit;#しょぼかるが落ちているなど +} + +my (@line) = split(/\n/, $content); foreach(@line){ -s/\xef\xbd\x9e/\xe3\x80\x9c/g; #wavedash -s/\xef\xbc\x8d/\xe2\x88\x92/g; #hyphenminus -s/&#([0-9A-Fa-f]{2,6});/(chr($1))/eg; #'遊戯王5D's'とかの数値参照対応を - -Jcode::convert(\$_,'euc','utf8'); + +Jcode::convert(\$_,'euc'); # @@ -85,9 +68,7 @@ s/\"\/>/\" /i; s/\"[\s]/\";\n/gio; -s/\'/\\'/gio; s/\"/\'/gio; -#s/[\w]*=/\$item{$&}=/gio; -#s/\=}=/}=/gio; -s/(\w+)=/\$item{$1}=/gio;#by foltiaBBS +s/[\w]*=/\$item{$&}=/gio; +s/\=}=/}=/gio; #$item{PID}='21543'; @@ -102,35 +83,37 @@ #$item{ProgComment}=''; eval("$_"); -#Jcode::convert(\$item{Title},'euc'); - +Jcode::convert(\$item{Title},'euc'); $programtitlename = $item{Title}; -$programtitlename =~ s/\<\;//gi; -$programtitlename =~ s/\&\;/\&/gi; -# $programtitle = $dbh->quote($programtitlename); - $programtitle = $programtitlename; - -#Jcode::convert(\$item{ChName},'euc'); -#Jcode::convert(\$item{SubTitle},'euc'); - -#$programSubTitle = $dbh->quote($item{SubTitle}); -$programSubTitle = $item{SubTitle}; +$programtitle = $dbh->quote($item{Title}); +#print "$item{Title}\n"; +#print "$item{TID}\n"; +Jcode::convert(\$item{ChName},'euc'); +#print "$item{ChName}\n"; +Jcode::convert(\$item{SubTitle},'euc'); +$programSubTitle = $dbh->quote($item{SubTitle}); $programSubTitle =~ s/\<\;//gi; -$programSubTitle =~ s/\&\;/\&/gi; -# $programSubTitle = $dbh->quote($programSubTitle); - + +#print "$item{SubTitle}\n"; +#print "$item{Count}\n"; $offsetmin = $item{StOffset}/60; +#print "Offset:$offsetmin (min)\n"; +#print "$item{EdTime}/$item{StTime}\n"; $edtime = &syobocaldate2foltiadate($item{EdTime}); $sttime = &syobocaldate2foltiadate($item{StTime}); +#print "$sttime-$edtime\n"; $length = &calclength($sttime,$edtime); $recstartdate = &calcoffsetdate($sttime ,$offsetmin ); $recenddate = &calcoffsetdate($edtime ,$offsetmin ); +#print "$recstartdate-$recenddate\n"; +#print "Length:$length(min)\n"; $stationid = &getstationid($item{ChName}); +#print "StationID:$stationid \n"; #サブタイトル追加------------------------------------------------- #番組があるか確認 - $sth = $dbh->prepare($stmt{'getxml2db.1'}); - $sth->execute($item{TID}); +$DBQuery = "SELECT count(*) FROM foltia_program WHERE tid = '$item{TID}'"; + $sth = $dbh->prepare($DBQuery); + $sth->execute(); @titlecount= $sth->fetchrow_array; @@ -140,19 +123,23 @@ #200412012359 $nomalstarttime = substr($sttime,8,4); - - $sth = $dbh->prepare($stmt{'getxml2db.2'}); - $oserr = $sth->execute($item{TID}, $programtitle, '', $nomalstarttime, $length, '', '', 3, 1, '', ''); - &writelog("getxml2db ADD TV Progtam:$item{TID}:$programtitle"); +$DBQuery = "insert into foltia_program values ($item{TID},$programtitle,'','$nomalstarttime','$length','','','3','1','')"; + $sth = $dbh->prepare($DBQuery); +$sth->execute(); +&writelog("getxml2db ADD TV Progtam:$item{TID}:$programtitle"); + + }else{ #2006/2/26 #あったら、タイトル確認して - $sth = $dbh->prepare($stmt{'getxml2db.3'}); - $sth->execute($item{TID}); +$DBQuery = "SELECT title FROM foltia_program WHERE tid = '$item{TID}'"; + $sth = $dbh->prepare($DBQuery); + $sth->execute(); @titlearray = $sth->fetchrow_array; #更新などされてたらupdate #print "$titlearray[0] / $programtitle\n"; if ($titlearray[0] ne "$programtitlename" ){ - $sth = $dbh->prepare($stmt{'getxml2db.4'}); - $oserr = $sth->execute($programtitle, $item{TID}); + $DBQuery = "UPDATE foltia_program SET title = $programtitle where tid = '$item{TID}' "; + $sth = $dbh->prepare($DBQuery); + $sth->execute(); &writelog("getxml2db UPDATE TV Progtam:$item{TID}:$programtitle"); }#end if update @@ -161,6 +148,7 @@ #PIDがあるか確認 - $sth = $dbh->prepare($stmt{'getxml2db.5'}); - $sth->execute($item{'TID'}, $item{'PID'}); +$DBQuery = "SELECT count(*) FROM foltia_subtitle WHERE tid = '$item{TID}' AND pid = '$item{PID}' "; + $sth = $dbh->prepare($DBQuery); + $sth->execute(); @subticount= $sth->fetchrow_array; if ($subticount[0] >= 1){ @@ -170,10 +158,30 @@ #UPDATE foltia_subtitle SET stationid = '42',countno = '8',subtitle = '京都行きます' ,startdatetime = '200503010035' ,enddatetime = '200503010050',startoffset = '0' ,lengthmin = '15' WHERE tid = '550' AND pid = '26000' if ($item{Count} == ""){ - $sth = $dbh->prepare($stmt{'getxml2db.6'}); - $oserr = $sth->execute($stationid, undef, $programSubTitle, $recstartdate, $recenddate, $offsetmin, $length, $item{'TID'}, $item{'PID'}); -}else{ - $sth = $dbh->prepare($stmt{'getxml2db.7'}); - $oserr = $sth->execute($stationid, $item{'Count'}, $programSubTitle, $recstartdate, $recenddate, $offsetmin, $length, $item{'TID'}, $item{'PID'}); - } + + $DBQuery = "UPDATE foltia_subtitle SET + stationid = '$stationid', + countno = null, + subtitle = $programSubTitle , + startdatetime = '$recstartdate' , + enddatetime = '$recenddate', + startoffset = '$offsetmin' , + lengthmin = '$length' + WHERE tid = '$item{TID}' AND pid = '$item{PID}' "; + +}else{ + + $DBQuery = "UPDATE foltia_subtitle SET + stationid = '$stationid', + countno = '$item{Count}', + subtitle = $programSubTitle , + startdatetime = '$recstartdate' , + enddatetime = '$recenddate', + startoffset = '$offsetmin' , + lengthmin = '$length' + WHERE tid = '$item{TID}' AND pid = '$item{PID}' "; +} + $sth = $dbh->prepare($DBQuery); + $sth->execute(); + # @subtitledata= $sth->fetchrow_array; }else{ #なければ追加 @@ -182,11 +190,13 @@ #そのままキューに入る形で if ($item{Count} eq ""){ - $sth = $dbh->prepare($stmt{'getxml2db.8'}); - $oserr = $sth->execute($item{'PID'}, $item{'TID'}, $stationid, undef, $programSubTitle, $recstartdate, $recenddate, $offsetmin, $length); + $DBQuery = "insert into foltia_subtitle values ( '$item{PID}','$item{TID}','$stationid',null,$programSubTitle,'$recstartdate','$recenddate','$offsetmin' ,'$length')"; }else{ - $sth = $dbh->prepare($stmt{'getxml2db.9'}); - $oserr = $sth->execute($item{'PID'}, $item{'TID'}, $stationid, $item{'Count'}, $programSubTitle, $recstartdate, $recenddate, $offsetmin, $length); + $DBQuery = "insert into foltia_subtitle values ( '$item{PID}','$item{TID}','$stationid','$item{Count}',$programSubTitle,'$recstartdate','$recenddate','$offsetmin' ,'$length')"; } -} + $sth = $dbh->prepare($DBQuery); + $sth->execute(); + # @subtitledata= $sth->fetchrow_array; +} + #print "$DBQuery\n\n\n"; @@ -198,4 +208,6 @@ }#foreach -$oserr = $dbh->commit; + ## $dbh->disconnect(); + + Index: trunk/install/perl/schedulecheck.pl =================================================================== --- trunk/install/perl/schedulecheck.pl (リビジョン 111) +++ trunk/install/perl/schedulecheck.pl (リビジョン 1) @@ -14,5 +14,4 @@ use DBI; use DBD::Pg; -use DBD::SQLite; use Schedule::At; use Time::Local; @@ -20,5 +19,5 @@ $path = $0; $path =~ s/schedulecheck.pl$//i; -if ($path ne "./"){ +if ($pwd ne "./"){ push( @INC, "$path"); } @@ -30,12 +29,17 @@ #予約番組探し -$now = &epoch2foldate(time()); +$now = &epoch2foldate(`date +%s`); $now = &epoch2foldate($now); $checkrangetime = $now + 15*60;#15分後まで $checkrangetime = &epoch2foldate($checkrangetime); -$dbh = DBI->connect($DSN,$DBUser,$DBPass) ||die $DBI::error;; + my $data_source = sprintf("dbi:%s:dbname=%s;host=%s;port=%d", + $DBDriv,$DBName,$DBHost,$DBPort); + $dbh = DBI->connect($data_source,$DBUser,$DBPass) ||die $DBI::error;; -$sth = $dbh->prepare($stmt{'schedulecheck.1'}); +$DBQuery = "SELECT count(*) FROM foltia_tvrecord "; + + + $sth = $dbh->prepare($DBQuery); $sth->execute(); @titlecount= $sth->fetchrow_array; @@ -44,5 +48,7 @@ exit; }else{ - $sth = $dbh->prepare($stmt{'schedulecheck.2'}); + +$DBQuery = "SELECT tid ,stationid FROM foltia_tvrecord "; + $sth = $dbh->prepare($DBQuery); $sth->execute(); while (($tid,$stationid ) = $sth->fetchrow_array()) { @@ -53,5 +59,4 @@ }#while -#EPG更新 -system("$toolpath/perl/epgimport.pl"); + } Index: trunk/install/perl/addpidatq.pl =================================================================== --- trunk/install/perl/addpidatq.pl (リビジョン 94) +++ trunk/install/perl/addpidatq.pl (リビジョン 1) @@ -14,5 +14,4 @@ use DBI; use DBD::Pg; -use DBD::SQLite; use Schedule::At; use Time::Local; @@ -20,5 +19,5 @@ $path = $0; $path =~ s/addpidatq.pl$//i; -if ($path ne "./"){ +if ($pwd ne "./"){ push( @INC, "$path"); } @@ -37,45 +36,36 @@ #DB検索(PID) -$dbh = DBI->connect($DSN,$DBUser,$DBPass) ||die $DBI::error;; + my $data_source = sprintf("dbi:%s:dbname=%s;host=%s;port=%d", + $DBDriv,$DBName,$DBHost,$DBPort); + $dbh = DBI->connect($data_source,$DBUser,$DBPass) ||die $DBI::error;; -$sth = $dbh->prepare($stmt{'addpidatq.1'}); -$sth->execute($pid); +$DBQuery = "SELECT count(*) FROM foltia_subtitle WHERE pid = '$pid' "; + $sth = $dbh->prepare($DBQuery); + $sth->execute(); @titlecount= $sth->fetchrow_array; if ($titlecount[0] == 1 ){ - $sth = $dbh->prepare($stmt{'addpidatq.2'}); - $sth->execute($pid); + +$DBQuery = "SELECT bitrate FROM foltia_tvrecord , foltia_subtitle WHERE foltia_tvrecord.tid = foltia_subtitle.tid AND pid='$pid' "; + $sth = $dbh->prepare($DBQuery); +$sth->execute(); @titlecount= $sth->fetchrow_array; $bitrate = $titlecount[0];#ビットレート取得 -if ($titlecount[1] >= 1){ - $usedigital = $titlecount[1];#デジタル優先フラグ -}else{ - $usedigital = 0; -} #PID抽出 - $now = &epoch2foldate(time()); +$now = &epoch2foldate(`date +%s`); + +$DBQuery = "SELECT stationrecch FROM foltia_station,foltia_subtitle WHERE foltia_subtitle.pid = '$pid' AND foltia_subtitle.stationid = foltia_station.stationid "; + #stationIDからrecch - $stationh = $dbh->prepare($stmt{'addpidatq.3'}); - $stationh->execute($pid); - @stationl = $stationh->fetchrow_array(); + $stationh = $dbh->prepare($DBQuery); + $stationh->execute(); +@stationl = $stationh->fetchrow_array; $recch = $stationl[0]; -if ($recch eq ""){ - &writelog("addpidatq ERROR recch is NULL:$stmt{'addpidatq.3'}."); - exit 1; -} -if ($stationl[1] => 1){ - $digitalch = $stationl[1]; -}else{ - $digitalch = 0; -} -if ($stationl[2] => 1){ - $digitalstationband = $stationl[2]; -}else{ - $digitalstationband = 0; -} - $sth = $dbh->prepare($stmt{'addpidatq.4'}); - $sth->execute($pid); + +$DBQuery = "SELECT * FROM foltia_subtitle WHERE pid='$pid' "; + $sth = $dbh->prepare($DBQuery); +$sth->execute(); ($pid , $tid , @@ -119,11 +109,11 @@ } -Schedule::At::add (TIME => "$atdateparam", COMMAND => "$toolpath/perl/recwrap.pl $recch $reclength $bitrate $tid $countno $pid $stationid $usedigital $digitalstationband $digitalch" , TAG => "$pid"."_R"); - &writelog("addpidatq TIME $atdateparam COMMAND $toolpath/perl/recwrap.pl $recch $reclength $bitrate $tid $countno $pid $stationid $usedigital $digitalstationband $digitalch"); +Schedule::At::add (TIME => "$atdateparam", COMMAND => "$toolpath/perl/recwrap.pl $recch $reclength $bitrate $tid $countno $pid" , TAG => "$pid"."_R"); + &writelog("addpidatq TIME $atdateparam COMMAND $toolpath/perl/recwrap.pl $recch $reclength $bitrate $tid $countno $pid"); }#end #もし新開始時刻が15分移譲先なら再キュー }else{ -&writelog("addpidatq drop:expire $pid $startafter $now $startdatetime"); +&writelog("addpidatq drop:expire $pid $startafter $now $startdatetime"); }#放送が未来の日付なら Index: trunk/install/perl/xmltv2foltia.pl =================================================================== --- trunk/install/perl/xmltv2foltia.pl (リビジョン 134) +++ trunk/install/perl/xmltv2foltia.pl (リビジョン 1) @@ -4,11 +4,13 @@ # http://www.dcc-jpl.com/soft/foltia/ # -# xmltv2foltia.pl -# -# XMLTV日本語版形式のXMLを受け取り、EPGデータベースに挿入します。 -# アナログ時代はXMLTVを利用していましたが、現在はepgimport.plを使用します。 -# -# usage -# cat /tmp/__27-epg.xml | /home/foltia/perl/xmltv2foltia.pl +#xmltv2foltia.pl +#XMLTV日本語版の出力するXMLを受け取り、EPGデータベースに挿入します。 +#XMLTVは +# http://www.systemcreate-inc.com/gsxr/pc/mythtv.html#patches +#のパッチをあてたものを想定しています。オリジナルと比較して、サブタイトルや内容など +#より秀才な内容を取得できます。 +# +# usage;perl /usr/bin/tv_grab_jp | ./xmltv2foltia.pl +# # # DCC-JPL Japan/foltia project @@ -16,18 +18,17 @@ # -#use LWP::Simple; +use LWP::Simple; #use Encode qw(from_to); #use encoding 'euc-jp', STDIN=>'utf8', STDOUT=>'euc-jp' ; # 標準入力:utf8 # http://www.lr.pi.titech.ac.jp/~abekawa/perl/perl_unicode.html use Jcode; -#use Data::Dumper; +# use Data::Dumper; use Time::Local; use DBI; use DBD::Pg; -use DBD::SQLite; $path = $0; $path =~ s/xmltv2foltia.pl$//i; -if ($path ne "./"){ +if ($pwd ne "./"){ push( @INC, "$path"); } @@ -36,17 +37,14 @@ $currentworkdate = "" ; $currentworkch = "" ; -$today = strftime("%Y%m%d", localtime); -$todaytime = strftime("%Y%m%d%H%M", localtime); -@deleteepgid = (); +$today =`date "+%Y%m%d"`; +$todaytime =`date "+%Y%m%d%H%M"`; # DB Connect -$dbh = DBI->connect($DSN,$DBUser,$DBPass) ||die $DBI::error;; + my $data_source = sprintf("dbi:%s:dbname=%s;host=%s;port=%d", + $DBDriv,$DBName,$DBHost,$DBPort); + $dbh = DBI->connect($data_source,$DBUser,$DBPass) ||die $DBI::error;; while(<>){ #print $_; -s/\xef\xbd\x9e/\xe3\x80\x9c/g; #wavedash -s/\xef\xbc\x8d/\xe2\x88\x92/g; #hyphenminus -s/&#([0-9A-Fa-f]{2,6});/(chr($1))/eg; #'遊戯王5D's'とかの数値参照対応を - Jcode::convert(\$_,'euc','utf8'); # from_to($_, "utf8","euc-jp"); @@ -68,4 +66,12 @@ eval("$_"); #print Dumper($_) ; + +}elsif(/【無】こんなミニ番組があり、タイトル空白になってしまうことがある - $item{title} = $titlebackup; - } #print Dumper($_) ; #print "$result \n"; @@ -150,37 +147,4 @@ chomp(); $item{category} = &removetag($_); - - if ($item{category} =~ /情報/){ - $item{category} = "information"; - }elsif ($item{category} =~ /趣味・実用/){ - $item{category} = "hobby"; - }elsif ($item{category} =~ /教育/){ - $item{category} = "education"; - }elsif ($item{category} =~ /音楽/){ - $item{category} = "music"; - }elsif ($item{category} =~ /演劇/){ - $item{category} = "stage"; - }elsif ($item{category} =~ /映画/){ - $item{category} = "cinema"; - }elsif ($item{category} =~ /バラエティ/){ - $item{category} = "variety"; - }elsif ($item{category} =~ /ニュース・報道/){ - $item{category} = "news"; - }elsif ($item{category} =~ /ドラマ/){ - $item{category} = "drama"; - }elsif ($item{category} =~ /ドキュメンタリー・教養/){ - $item{category} = "documentary"; - }elsif ($item{category} =~ /スポーツ/){ - $item{category} = "sports"; - }elsif ($item{category} =~ /キッズ/){ - $item{category} = "kids"; - }elsif ($item{category} =~ /アニメ・特撮/){ - $item{category} = "anime"; - }elsif ($item{category} =~ /その他/){ - $item{category} = "etc"; - }else{ - $item{category} = "etc"; - } - #print Dumper($_) ; #print "$result \n"; @@ -189,13 +153,13 @@ }elsif(/<\/programme>/){ #登録処理はココで -#&writelog("xmltv2foltia DEBUG call chkerase $item{'start'},$item{'channel'}"); -#旧仕様 #&chkerase($item{'start'}, $item{'channel'}); - &replaceepg($item{'start'}, $item{'channel'},$item{'stop'}); - if ($item{'subtitle'} ne "" ){ - $registdesc = $item{'subtitle'}." ".$item{'desc'}; +#&writelog("xmltv2foltia DEBUG call chkerase $item{start},$item{channel}"); + +&chkerase($item{start},$item{channel}); +if ($item{subtitle} ne "" ){ + $registdesc = $item{subtitle}." ".$item{desc}; }else{ - $registdesc = $item{'desc'}; + $registdesc = $item{desc}; } - ®istdb($item{'start'},$item{'stop'},$item{'channel'},$item{'title'},$registdesc ,$item{'category'}); +®istdb($item{start},$item{stop},$item{channel},$item{title},$registdesc ,$item{category}); # print "$item{start} @@ -217,38 +181,34 @@ }# endif }# while -&commitdb; - - -#end -################ - -sub replaceepg{ -#消すEPGのIDを配列に追加します + +sub chkerase{ +# xmltvからきた日付とチャンネルをfoltia epgと比較 my $foltiastarttime = $_[0]; # 14桁 my $ontvepgchannel = $_[1]; -my $foltiaendtime = $_[2]; # 14桁 -my @data = (); - -$foltiastarttime = substr($foltiastarttime,0,12); # 12桁 200508072254 -$foltiaendtime = substr($foltiaendtime,0,12); # 12桁 200508072355 - -$sth = $dbh->prepare($stmt{'xmltv2foltia.replaceepg.1'}); -my $now = &epoch2foldate(time()); -$sth->execute($foltiastarttime , $foltiaendtime , $ontvepgchannel); -while (@data = $sth->fetchrow_array()) { - push(@deleteepgid,$data[0]); - #&writelog("xmltv2foltia DEBUG push(\@deleteepgid,$data[0]);"); -}#end while - -#上書きを消す -$sth = $dbh->prepare($stmt{'xmltv2foltia.replaceepg.2'}); -$sth->execute($foltiastarttime , $foltiaendtime , $ontvepgchannel); -while (@data = $sth->fetchrow_array()) { - push(@deleteepgid,$data[0]); - #&writelog("xmltv2foltia DEBUG push(\@deleteepgid,$data[0]);"); -}#end while - -}#endsub replaceepg - +my $epgstartdate = substr($foltiastarttime,0,8); # 8桁 20050807 +my @epgcounts = ""; +my $DBQuery = ""; + +#if ($currentworkdate eq "" ){#初回起動なら +if ( $currentworkch ne $ontvepgchannel){ + + +if ($epgstartdate >= $today){# xmltvtvから今日以降のデータが来ていれば +my $epgstartdatetime = $today * 10000 ; # 200508070000 12桁 +# 新規に入る予定の未来の番組表、全部いったん消す +# $DBQuery = "DELETE from foltia_epg where startdatetime > $epgstartdatetime AND ontvchannel = '$ontvepgchannel' "; + $DBQuery = "DELETE from foltia_epg where startdatetime > $todaytime AND ontvchannel = '$ontvepgchannel' "; + $sth = $dbh->prepare($DBQuery); + $sth->execute(); +&writelog("xmltv2foltia DELETE EPG $epgstartdatetime:$DBQuery"); +#$currentworkdate = "$today"; +$currentworkch = $ontvepgchannel ; +}else{ + &writelog("xmltv2foltia ERROR EPG INVALID:$epgstartdate:$today"); + #exit(); +}# endif xmltvtvから今日のデータが来ていれば +}#end if 初回起動なら + +} sub registdb{ my $foltiastarttime = $_[0]; @@ -259,67 +219,54 @@ my $category = $_[5]; -#Encode::JP::H2Z::z2h(\$string); -$title = jcode($title)->tr('A-Za-z0-9!#$%&()*+,−./:;<=>?@[\]^_`{|} ','A-Za-z0-9!#$%&()*+,-./:;<=>?@[\]^_`{|} '); -$desc = jcode($desc)->tr('A-Za-z0-9!#$%&()*+,−./:;<=>?@[\]^_`{|} ','A-Za-z0-9!#$%&()*+,-./:;<=>?@[\]^_`{|} '); -#$title = jcode($title)->tr('A-Za-z0-9!#$%&()*+,−./:;<=>?@[\]^_`{|}','A-Za-z0-9!#$%&()*+,-./:;<=>?@[\]^_`{|}'); -#$desc = jcode($desc)->tr('A-Za-z0-9!#$%&()*+,−./:;<=>?@[\]^_`{|}','A-Za-z0-9!#$%&()*+,-./:;<=>?@[\]^_`{|}'); - #&writelog("xmltv2foltia DEBUG $foltiastarttime:$foltiaendtime"); + + $foltiastarttime = substr($foltiastarttime,0,12); $foltiaendtime = substr($foltiaendtime,0,12); -#if($foltiaendtime > $todaytime){#電波に乗ってきた情報は無条件更新 -# epgidはAUTOINCREMENTに変更した #2010/8/10 -# $sth = $dbh->prepare($stmt{'xmltv2foltia.registdb.1'}); -# $sth->execute(); -# @currentepgid = $sth->fetchrow_array; -# -# if ($currentepgid[0] < 1 ){ -# $newepgid = 1; -# }else{ -# $newepgid = $currentepgid[0]; -# $newepgid++; -# } +if($foltiastarttime > $todaytime){ + + my $DBQuery = "SELECT max(epgid) FROM foltia_epg "; + $sth = $dbh->prepare($DBQuery); + $sth->execute(); + @currentepgid = $sth->fetchrow_array; + + if ($currentepgid[0] < 1 ){ + $newepgid = 1; + }else{ + $newepgid = $currentepgid[0]; + $newepgid++; + } #&writelog("xmltv2foltia DEBUG $currentepgid[0] / $newepgid"); my $lengthmin = &calclength($foltiastarttime , $foltiaendtime); - -#print "xmltv2foltia DEBUG :INSERT INTO foltia_epg VALUES ($newepgid, $foltiastarttime, $foltiaendtime, $lengthmin, $channel, $title, $desc, $category)\n"; -push (@foltiastarttime,$foltiastarttime); -push (@foltiaendtime,$foltiaendtime); -push (@lengthmin,$lengthmin); -push (@channel,$channel); -push (@title,$title); -push (@desc,$desc); -push (@category,$category); -# $sth = $dbh->prepare($stmt{'xmltv2foltia.registdb.2'}); -# $sth->execute($newepgid, $foltiastarttime, $foltiaendtime, $lengthmin, $channel, $title, $desc, $category) || warn "error: $newepgid, $foltiastarttime, $foltiaendtime, $lengthmin, $channel, $title, $desc, $category\n"; +$newepgid = $dbh->quote($newepgid ); +$foltiastarttime = $dbh->quote($foltiastarttime); +$foltiaendtime = $dbh->quote($foltiaendtime ); +$lengthmin = $dbh->quote($lengthmin ); +$channel = $dbh->quote($channel ); +$title = $dbh->quote($title); +$desc = $dbh->quote($desc); +$category = $dbh->quote($category); + +$DBQuery = "insert into foltia_epg values ($newepgid,$foltiastarttime,$foltiaendtime,$lengthmin,$channel,$title,$desc,$category)"; +# $DBQuery = $dbh->quote($DBQuery); + $sth = $dbh->prepare($DBQuery); + $sth->execute(); + + # &writelog("xmltv2foltia DEBUG $DBQuery"); -#}else{ + +}else{ #&writelog("xmltv2foltia DEBUG SKIP $foltiastarttime:$foltiaendtime"); -#}#未来じゃなければ挿入しない - -}#end sub registdb - -sub commitdb{ -$dbh->{AutoCommit} = 0; -#print Dumper(\@dbarray); -my $loopcount = @foltiastarttime; -my $i = 0; - -#削除 -foreach $delid (@deleteepgid){ - $sth = $dbh->prepare($stmt{'xmltv2foltia.commitdb.1'}); - $sth->execute( $delid ) || warn "$delid\n"; - #&writelog("xmltv2foltia DEBUG $stmt{'xmltv2foltia.commitdb.1'}/$delid"); +}#未来じゃなければ挿入しない + } -#追加 -for ($i=0;$i<$loopcount;$i++){ - $sth = $dbh->prepare($stmt{'xmltv2foltia.commitdb.2'}); - $sth->execute( $foltiastarttime[$i],$foltiaendtime[$i], $lengthmin[$i], $channel[$i], $title[$i], $desc[$i], $category[$i]) || warn "error: $foltiastarttime, $foltiaendtime, $lengthmin, $channel, $title, $desc, $category\n"; - #&writelog("xmltv2foltia DEBUG $stmt{'xmltv2foltia.commitdb.2'}/$foltiastarttime[$i],$foltiaendtime[$i], $lengthmin[$i], $channel[$i], $title[$i], $desc[$i], $category[$i]"); -}# end for -$dbh->commit; -$dbh->{AutoCommit} = 1; -}#end sub commitdb + + + + + + + sub removetag(){ Index: trunk/install/perl/mklocalizeddir.pl =================================================================== --- trunk/install/perl/mklocalizeddir.pl (リビジョン 94) +++ trunk/install/perl/mklocalizeddir.pl (リビジョン 1) @@ -16,9 +16,9 @@ use DBI; use DBD::Pg; -use DBD::SQLite; + $path = $0; $path =~ s/mklocalizeddir.pl$//i; -if ($path ne "./"){ +if ($pwd ne "./"){ push( @INC, "$path"); } @@ -43,9 +43,12 @@ #接続 - $dbh = DBI->connect($DSN,$DBUser,$DBPass) ||die $DBI::error;; + my $data_source = sprintf("dbi:%s:dbname=%s;host=%s;port=%d", + $DBDriv,$DBName,$DBHost,$DBPort); + $dbh = DBI->connect($data_source,$DBUser,$DBPass) ||die $DBI::error;; #検索 - $sth = $dbh->prepare($stmt{'mklocalizeddir.1'}); - $sth->execute($tid); +$DBQuery = "select title from foltia_program where tid=$tid "; + $sth = $dbh->prepare($DBQuery); + $sth->execute(); @subticount= $sth->fetchrow_array; $title = $subticount[0] ; Index: trunk/install/perl/addatq.pl =================================================================== --- trunk/install/perl/addatq.pl (リビジョン 94) +++ trunk/install/perl/addatq.pl (リビジョン 1) @@ -16,5 +16,4 @@ use DBI; use DBD::Pg; -use DBD::SQLite; use Schedule::At; use Time::Local; @@ -22,5 +21,5 @@ $path = $0; $path =~ s/addatq.pl$//i; -if ($path ne "./"){ +if ($pwd ne "./"){ push( @INC, "$path"); } @@ -39,13 +38,15 @@ #DB検索(TIDとStationIDからPIDへ) -$dbh = DBI->connect($DSN,$DBUser,$DBPass) ||die $DBI::error;; + $data_source = sprintf("dbi:%s:dbname=%s;host=%s;port=%d", + $DBDriv,$DBName,$DBHost,$DBPort); + $dbh = DBI->connect($data_source,$DBUser,$DBPass) ||die $DBI::error;; if ($station == 0){ - $sth = $dbh->prepare($stmt{'addatq.1'}); - $sth->execute($tid); + $DBQuery = "SELECT count(*) FROM foltia_tvrecord WHERE tid = '$tid' "; }else{ - $sth = $dbh->prepare($stmt{'addatq.2'}); - $sth->execute($tid, $station); + $DBQuery = "SELECT count(*) FROM foltia_tvrecord WHERE tid = '$tid' AND stationid = '$station' "; } + $sth = $dbh->prepare($DBQuery); + $sth->execute(); @titlecount = $sth->fetchrow_array; #件数数える @@ -53,7 +54,8 @@ #2以上だったら if ($titlecount[0] >= 2){ - #全局録りが含まれているか調べる - $kth = $dbh->prepare($stmt{'addatq.3'}); - $kth->execute($tid); + #全曲取りが含まれているか調べる + $DBQuery = "SELECT count(*) FROM foltia_tvrecord WHERE tid = '$tid' AND stationid ='0' "; + $kth = $dbh->prepare($DBQuery); + $kth->execute(); @reservecounts = $kth->fetchrow_array; @@ -61,10 +63,10 @@ if($tid == 0){ #今回の引き数がSID 0だったら - #全局録りだけ予約 -# &writelog("addatq DEBUG; ALL STATION RESERVE. TID=$tid SID=$station $titlecount[0] match:$stmt{'addatq.3'}"); + #全局取りだけ予約 +# &writelog("addatq DEBUG; ALL STATION RESERVE. TID=$tid SID=$station $titlecount[0] match:$DBQuery"); &addcue; }else{ #ほかの全局録画addatqが予約入れてくれるからなにもしない -# &writelog("addatq DEBUG; SKIP OPERSTION. TID=$tid SID=$station $titlecount[0] match:$stmt{'addatq.3'}"); +# &writelog("addatq DEBUG; SKIP OPERSTION. TID=$tid SID=$station $titlecount[0] match:$DBQuery"); exit; }#end if ふくまれていたら @@ -73,5 +75,5 @@ &addcue; }else{ - &writelog("addatq error; reserve impossible . TID=$tid SID=$station $titlecount[0] match:$stmt{'addatq.3'}"); +&writelog("addatq error; reserve impossible . TID=$tid SID=$station $titlecount[0] match:$DBQuery"); } @@ -80,5 +82,5 @@ # & addcue; # }else{ -#&writelog("addatq error record TID=$tid SID=$station $titlecount[0] match:$stmt{'addatq.3'}"); +#&writelog("addatq error record TID=$tid SID=$station $titlecount[0] match:$DBQuery"); #} @@ -86,30 +88,33 @@ if ($station == 0){ - $sth = $dbh->prepare($stmt{'addatq.addcue.1'}); - $sth->execute($tid); + $DBQuery = "SELECT * FROM foltia_tvrecord WHERE tid = '$tid' "; }else{ - $sth = $dbh->prepare($stmt{'addatq.addcue.2'}); - $sth->execute($tid, $station); + $DBQuery = "SELECT * FROM foltia_tvrecord WHERE tid = '$tid' AND stationid = '$station' "; } + $sth = $dbh->prepare($DBQuery); +$sth->execute(); @titlecount= $sth->fetchrow_array; $bitrate = $titlecount[2];#ビットレート取得 #PID抽出 - $now = &epoch2foldate(time()); - $twodaysafter = &epoch2foldate(time() + (60 * 60 * 24 * 2)); +$now = &epoch2foldate(`date +%s`); +$twodaysafter = &epoch2foldate(`date +%s` + (60 * 60 * 24 * 2)); #キュー入れは直近2日後まで if ($station == 0 ){ - $sth = $dbh->prepare($stmt{'addatq.addcue.3'}); - $sth->execute($tid, $now, $twodaysafter); + $DBQuery = " +SELECT * from foltia_subtitle WHERE tid = '$tid' AND startdatetime > '$now' AND startdatetime < '$twodaysafter' "; }else{ + $DBQuery = " +SELECT * from foltia_subtitle WHERE tid = '$tid' AND stationid = '$station' AND startdatetime > '$now' AND startdatetime < '$twodaysafter' "; #stationIDからrecch - $stationh = $dbh->prepare($stmt{'addatq.addcue.4'}); - $stationh->execute($station); +$getrecchquery="SELECT stationid , stationrecch FROM foltia_station where stationid = '$station' "; + $stationh = $dbh->prepare($getrecchquery); + $stationh->execute(); @stationl = $stationh->fetchrow_array; $recch = $stationl[1]; +} - $sth = $dbh->prepare($stmt{'addatq.addcue.5'}); - $sth->execute($tid, $station, $now, $twodaysafter); - } + $sth = $dbh->prepare($DBQuery); + $sth->execute(); while (($pid , @@ -126,6 +131,7 @@ if ($station == 0 ){ #stationIDからrecch - $stationh = $dbh->prepare($stmt{'addatq.addcue.6'}); - $stationh->execute($stationid); +$getrecchquery="SELECT stationid , stationrecch FROM foltia_station where stationid = '$stationid' "; + $stationh = $dbh->prepare($getrecchquery); + $stationh->execute(); @stationl = $stationh->fetchrow_array; $recch = $stationl[1]; Index: trunk/install/perl/cron_foltia_dayly.sh =================================================================== --- trunk/install/perl/cron_foltia_dayly.sh (リビジョン 111) +++ trunk/install/perl/cron_foltia_dayly.sh (リビジョン 1) @@ -10,13 +10,9 @@ # -#デジタル放送から一週間分のEPGを取得 -/home/foltia/perl/epgimport.pl long - -# XMLTVをつかってEPG番組表インポート(アナログ専用旧仕様) +# XMLTVをつかってEPG番組表インポート # -#/usr/bin/perl /usr/bin/tv_grab_jp | /home/foltia/perl/xmltv2foltia.pl -# 2つの局設定使うような場合 -#/usr/bin/perl /usr/bin/tv_grab_jp --config-file ~/.xmltv/tv_grab_jp.conf.jcom | /home/foltia/perl/xmltv2foltia.pl -#/usr/bin/perl /usr/bin/tv_grab_jp --config-file ~/.xmltv/tv_grab_jp.conf.tvk | /home/foltia/perl/xmltv2foltia.pl +# /usr/bin/perl /usr/bin/tv_grab_jp --config-file | /home/foltia/perl/xmltv2foltia.pl +/usr/bin/perl /usr/bin/tv_grab_jp --config-file ~/.xmltv/tv_grab_jp.conf.jcom | /home/foltia/perl/xmltv2foltia.pl +/usr/bin/perl /usr/bin/tv_grab_jp --config-file ~/.xmltv/tv_grab_jp.conf.tvk | /home/foltia/perl/xmltv2foltia.pl #録画ファイルとテーブルの整合性を更新 Index: trunk/install/perl/deletemovie.pl =================================================================== --- trunk/install/perl/deletemovie.pl (リビジョン 124) +++ trunk/install/perl/deletemovie.pl (リビジョン 1) @@ -14,11 +14,8 @@ # # -use DBI; -use DBD::Pg; -use DBD::SQLite; $path = $0; $path =~ s/deletemovie.pl$//i; -if ($path ne "./"){ +if ($pwd ne "./"){ push( @INC, "$path"); } @@ -35,5 +32,5 @@ #ファイル名正当性チェック -if ($fname =~ /.m2p$|.m2t$|.MP4$|.aac$/){ +if ($fname =~ /.m2p\z/){ }else{ @@ -43,14 +40,8 @@ } -#DB初期化 -$dbh = DBI->connect($DSN,$DBUser,$DBPass) ||die $DBI::error;; +#ファイル存在チェック -#ファイル存在チェック -my $tid = &mp4filename2tid($fname); -my $mp4dirname = &makemp4dir($tid); if (-e "$recfolderpath/$fname"){ - $filemovepath = $recfolderpath; -}elsif(-e "$mp4dirname/$fname"){ - $filemovepath = $mp4dirname; + }else{ # print "deletemovie file not found.$recfolderpath/$fname\n"; @@ -61,9 +52,9 @@ #既読削除処理 if ($rapidfiledelete > 0){ #./mita/へ移動 - system ("mv $filemovepath/$fname $recfolderpath/mita/"); - &writelog("deletemovie mv filemovepath/$fname $recfolderpath/mita/."); + system ("mv $recfolderpath/$fname $recfolderpath/mita/"); + &writelog("deletemovie mv $recfolderpath/$fname $recfolderpath/mita/."); }else{ #即時削除 - system ("rm $filemovepath/$fname "); - &writelog("deletemovie rm $filemovepath/$fname "); + system ("rm $recfolderpath/$fname "); + &writelog("deletemovie rm $recfolderpath/$fname "); Index: trunk/install/perl/recwrap.pl =================================================================== --- trunk/install/perl/recwrap.pl (リビジョン 138) +++ trunk/install/perl/recwrap.pl (リビジョン 1) @@ -1,4 +1,4 @@ #!/usr/bin/perl -#usage recwrap.pl ch length(sec) [bitrate(5)] [TID] [NO] [PID] [stationid] [digitalflag] [digitalband] [digitalch] +#usage recwrap.pl ch length(sec) [bitrate(5)] [TID] [NO] [PID] # # Anime recording system foltia @@ -15,5 +15,4 @@ use DBI; use DBD::Pg; -use DBD::SQLite; use Schedule::At; use Time::Local; @@ -22,5 +21,5 @@ $path = $0; $path =~ s/recwrap.pl$//i; -if ($path ne "./"){ +if ($pwd ne "./"){ push( @INC, "$path"); } @@ -30,5 +29,5 @@ $recch = $ARGV[0] ; if ($recch eq "" ){ - #引き数なしで実行されたら、終了 + #引き数なし出実行されたら、終了 print "usage recwrap.pl ch length(sec) [bitrate(5)] [TID] [NO] [PID]\n"; exit; @@ -40,306 +39,273 @@ $tid = $ARGV[3] ; $countno = $ARGV[4] ; -$pid = $ARGV[5] ; -$stationid = $ARGV[6] ; -$usedigital = $ARGV[7] ; -$digitalstationband = $ARGV[8] ; -$digitalch= $ARGV[9] ; - -#DB初期化 -$dbh = DBI->connect($DSN,$DBUser,$DBPass) ||die $DBI::error;; - - -if ($usedigital == 1){ - $extension = ".m2t";#TSの拡張子 -}else{ - $extension = ".m2p";#MPEG2の拡張子 -} -if ($recch == -2 ){ #ラジオ局 - $extension = ".aac";#MPEG2の拡張子 -} - -$outputfile = strftime("%Y%m%d-%H%M", localtime(time + 60)); +$pid = $ARGV[5] ; + +$outputfile = `date +%Y%m%d-%H%M --date "1 min "`; chomp($outputfile); - if ($tid == 0){ - if ($usedigital == 1){ - $outputfilename = "0--".$outputfile."-".$digitalch.$extension; - $mp4newstylefilename = "-0--".$outputfile."-".$digitalch; - }else{ - $outputfilename = "0--".$outputfile."-".$recch.$extension; + $outputfilename = "0--".$outputfile."-".$recch.".m2p"; $mp4newstylefilename = "-0--".$outputfile."-".$recch; - } }else{ if ($countno == 0){ - $outputfilename = $tid ."--".$outputfile.$extension; + $outputfilename = $tid ."--".$outputfile.".m2p"; $mp4newstylefilename = "-" . $tid ."--".$outputfile; }else{ - $outputfilename = $tid ."-".$countno."-".$outputfile.$extension; + $outputfilename = $tid ."-".$countno."-".$outputfile.".m2p"; $mp4newstylefilename = "-" . $tid ."-".$countno."-".$outputfile; } } - -if ($recch == -2 ){ #ラジオ局 -# stationIDからradiko識別子を取得 -$sth = $dbh->prepare($stmt{'recwrap.8'}); -$sth->execute($stationid); - @stationline= $sth->fetchrow_array; -$radikostationname = $stationline[3]; -my $starttime = time(); -my $endepochtime = time() + $reclength; -#録音 -$oserr = system("$toolpath/perl/digitalradiorecording.pl $radikostationname $reclength $outputfilename"); +#リモコン操作 +# $haveirdaunit = 1;リモコンつないでるかどうか確認 +if ($haveirdaunit == 1){ +# 録画チャンネルが0なら + if ($recch == 0){ +# &つけて非同期でchangestbch.pl呼び出し + &writelog("recwrap Call Change STB CH :$pid"); + system ("$toolpath/perl/changestbch.pl $pid &"); + }#end if +}#end if + +if($recch == -10){ +#非受信局なら + &writelog("recwrap Not recordable channel;exit:PID $pid"); + exit; + }#end if + +&writelog("recwrap RECSTART $recch $reclength 0 $outputfilename $bitrate $tid $countno $pid"); +#録画 +#system("$toolpath/perl/tvrecording.pl $recch $reclength 0 $outputfile $bitrate $tid $countno"); +$oserr = system("$toolpath/perl/tvrecording.pl $recch $reclength 0 $outputfilename $bitrate $tid $countno"); $oserr = $oserr / 256; -&writelog("recwrap DEBUG radiko rec finished. $oserr"); -#サーバビジーで即死してないか検出 -$now = time(); -if ($now < $endepochtime){ #終了予定より前に録音プロセスが戻ってきたなら -&writelog("recwrap radiko rec failed,will be retry. NOW:$now PlanedEnd:$endepochtime"); - -my $retrycounter = 0; -my $waitsecsbase = 10; -my $waitsec ; -my $waitsecsrand ; -my $recfilepath; - while($now < $endepochtime){ - if($retrycounter >= 15){ - &writelog("recwrap radiko rec failed,Giving up.Max retry counter over."); - last; - } - $waitsecsrand = int(rand($waitsecsbase/2)); - $waitsec = $waitsecsbase + $waitsecsrand ; - &writelog("recwrap DEBUG radiko rec retry waiting. $waitsec ($waitsecsbase + $waitsecsrand)"); - sleep($waitsec); - &writelog("recwrap DEBUG retry start."); - $recfilepath = "$recfolderpath"."/"."$outputfilename"; - if (-e $recfilepath ){ - unlink("$recfilepath"); - &writelog("recwrap DEBUG delete $recfilepath"); - } - #録音 - $oserr = system("$toolpath/perl/digitalradiorecording.pl $radikostationname $reclength $outputfilename N");#起動waitなしで - $oserr = $oserr / 256; - &writelog("recwrap DEBUG radiko rec retry finished. $oserr"); - - $retrycounter++; - if ($waitsecsbase < 600 ){ - $waitsecsbase = $waitsecsbase * 2; - } - $now = time(); - }# while -} # if - - -# aacファイル名をfoltia_subtitlePIDレコードに書き込み -$sth = $dbh->prepare($stmt{'recwrap.1'}); -$sth->execute($outputfilename, $pid); -&writelog("recwrap DEBUG UPDATEDB $stmt{'recwrap.1'}"); -&changefilestatus($pid,$FILESTATUSTRANSCODEMP4BOX); - -# aacファイル名をfoltia_m2pfilesPIDレコードに書き込み -$sth = $dbh->prepare($stmt{'recwrap.2'}); -$sth->execute($outputfilename); -&writelog("recwrap DEBUG UPDATEDB $stmt{'recwrap.2'}"); - - -}else{#非ラジオ局なら - -if ($usedigital == 1){ -#デジタルなら -&writelog("recwrap RECSTART DIGITAL $digitalstationband $digitalch $reclength $stationid 0 $outputfilename $tid $countno friio"); -#録画 - $starttime = time(); -$oserr = system("$toolpath/perl/digitaltvrecording.pl $digitalstationband $digitalch $reclength $stationid 0 $outputfilename $tid $countno friio"); -$oserr = $oserr / 256; - if ($oserr == 1){ - &writelog("recwrap ABORT recfile exist. [$outputfilename] $digitalstationband $digitalch $reclength $stationid 0 $outputfilename $tid $countno"); - exit; -}elsif ($oserr == 2){ - &writelog("recwrap ERR 2:Device busy;retry."); - &continuousrecordingcheck;#もうすぐ終わる番組をkill - sleep(2); - $oserr = system("$toolpath/perl/digitaltvrecording.pl $digitalstationband $digitalch $reclength $stationid N $outputfilename $tid $countno friio"); - $oserr = $oserr / 256; - if ($oserr == 2){ - &writelog("recwrap ERR 2:Device busy;Giving up digital recording."); - if ($recunits > 0 ){ - }else{ - exit; - } - } -}elsif ($oserr == 3){ -&writelog("recwrap ABORT:ERR 3"); -exit ; -} -}else{ # NOT $usedigital == 1 - if ($recunits > 0 ){ - #リモコン操作 - # $haveirdaunit = 1;リモコンつないでるかどうか確認 - if ($haveirdaunit == 1){ - # 録画チャンネルが0なら - if ($recch == 0){ - # &つけて非同期でchangestbch.pl呼び出し - &writelog("recwrap Call Change STB CH :$pid"); - system ("$toolpath/perl/changestbch.pl $pid &"); - }#end if - }#end if - - if($recch == -10){ - #非受信局なら - &writelog("recwrap Not recordable channel;exit:PID $pid"); - exit; - }#end if - # アナログ録画 - &writelog("recwrap RECSTART $recch $reclength 0 $outputfilename $bitrate $tid $countno $pid $usedigital $digitalstationband $digitalch"); - - #録画 - #system("$toolpath/perl/tvrecording.pl $recch $reclength 0 $outputfile $bitrate $tid $countno"); - $starttime = time(); - - $oserr = system("$toolpath/perl/tvrecording.pl $recch $reclength 0 $outputfilename $bitrate $tid $countno"); - $oserr = $oserr / 256; - if ($oserr == 1){ - &writelog("recwrap ABORT recfile exist. [$outputfilename] $recch $reclength 0 0 $bitrate $tid $countno $pid"); - exit; - } -#デバイスビジーで即死してないか検出 -$now = time(); - if ($now < $starttime + 100){ #録画プロセス起動してから100秒以内に戻ってきてたら - $retrycounter = 0; - while($now < $starttime + 100){ - if($retrycounter >= 5){ - &writelog("recwrap WARNING Giving up recording."); - last; - } - &writelog("recwrap retry recording $now $starttime"); - #アナログ録画 - $starttime = time(); -if($outputfilename =~ /.m2t$/){ - $outputfilename =~ s/.m2t$/.m2p/; -} -$oserr = system("$toolpath/perl/tvrecording.pl $recch $reclength N $outputfilename $bitrate $tid $countno"); - $now = time(); -$oserr = $oserr / 256; - if ($oserr == 1){ - &writelog("recwrap ABORT recfile exist. in resume process.[$outputfilename] $recch $reclength 0 0 $bitrate $tid $countno $pid"); - exit; - }# if - $retrycounter++; - }# while - } # if - + &writelog("recwrap ABORT recfile exist. [$outputfilename] $recch $reclength 0 0 $bitrate $tid $countno $pid"); +}else{ &writelog("recwrap RECEND [$outputfilename] $recch $reclength 0 0 $bitrate $tid $countno $pid"); - - }#end if $recunits > 0 -}#endif #デジタル優先フラグ - +} +#DB初期化 + my $data_source = sprintf("dbi:%s:dbname=%s;host=%s;port=%d", + $DBDriv,$DBName,$DBHost,$DBPort); + $dbh = DBI->connect($data_source,$DBUser,$DBPass) ||die $DBI::error;; # m2pファイル名をPIDレコードに書き込み -$sth = $dbh->prepare($stmt{'recwrap.1'}); -$sth->execute($outputfilename, $pid); -&writelog("recwrap DEBUG UPDATEDB $stmt{'recwrap.1'}"); -&changefilestatus($pid,$FILESTATUSRECEND); + $DBQuery = "UPDATE foltia_subtitle SET + m2pfilename = '$outputfilename' + WHERE pid = '$pid' "; + $sth = $dbh->prepare($DBQuery); + $sth->execute(); +&writelog("recwrap UPDATEDB $DBQuery"); # m2pファイル名をPIDレコードに書き込み -$sth = $dbh->prepare($stmt{'recwrap.2'}); -$sth->execute($outputfilename); -&writelog("recwrap DEBUG UPDATEDB $stmt{'recwrap.2'}"); + $DBQuery = "insert into foltia_m2pfiles values ('$outputfilename')"; + $sth = $dbh->prepare($DBQuery); + $sth->execute(); +&writelog("recwrap UPDATEDB $DBQuery"); # Starlight breaker向けキャプチャ画像作成 if (-e "$toolpath/perl/captureimagemaker.pl"){ &writelog("recwrap Call captureimagemaker $outputfilename"); -&changefilestatus($pid,$FILESTATUSCAPTURE); system ("$toolpath/perl/captureimagemaker.pl $outputfilename"); -&changefilestatus($pid,$FILESTATUSCAPEND); -} -}#非ラジオ局 - -# MPEG4 ------------------------------------------------------ -#MPEG4トラコン必要かどうか -$sth = $dbh->prepare($stmt{'recwrap.3'}); -$sth->execute($tid); +} + + + +# PSP ------------------------------------------------------ +#PSPトラコン必要かどうか +$DBQuery = "SELECT psp,aspect,title FROM foltia_program WHERE tid = '$tid' "; + $sth = $dbh->prepare($DBQuery); + $sth->execute(); @psptrcn= $sth->fetchrow_array; -if ($psptrcn[0] == 1 ){#トラコン番組 - &writelog("recwrap Launch ipodtranscode.pl"); - exec ("$toolpath/perl/ipodtranscode.pl"); - exit; + if ($psptrcn[0] == 1 ){#トラコン番組 + + +#PSPムービーディレクトリがアルかどうか + +#TIDが100以上の3桁の場合はそのまま +my $pspfilnamehd = ""; + + $pspfilnamehd = $tid; +$pspdirname = "$tid.localized/"; +$pspdirname = $recfolderpath."/".$pspdirname; + +#なければ作る +unless (-e $pspdirname ){ + system("$toolpath/perl/mklocalizeddir.pl $tid"); + #&writelog("recwrap mkdir $pspdirname"); +} +$pspdirname = "$tid.localized/mp4/"; +$pspdirname = $recfolderpath."/".$pspdirname; +#なければ作る +unless (-e $pspdirname ){ + mkdir $pspdirname ,0777; + #&writelog("recwrap mkdir $pspdirname"); +} + +#ファイル名決定 +if ($mp4filenamestyle == 1){# 1;よりわかりやすいファイル名 + $pspfilname = $mp4newstylefilename ; + +}else{##0:PSP ファームウェアver.2.80より前と互換性を持つファイル名 +#・フォルダ名[100MNV01]の100の部分は変更可(100〜999)。 +# MP_ROOT ━ 100MNV01 ┳ M4V00001.MP4(動画) +#┃   ┗ M4V00001.THM(サムネイル)※必須ではない + +#ファイル名決定 +#ファイル名決定 #新アルゴリズム +#TID 0000-3599まで[3桁] +#話数 00-999まで[2桁] + +my $pspfilnameft = ""; +my $pspfilnameyearhd = ""; +my $pspfilnameyearft = ""; + +$btid = $tid % 3600; +# print "$btid\n"; + +if($btid >= 0 && $btid < 1000){ + + $pspfilnamehd = sprintf("%03d",$btid); + +}elsif ($btid >= 1000 && $btid < 3600){ + $pspfilnameyearhd = substr($btid, 0, 2); + $pspfilnameyearhd =~ s/10/A/; + $pspfilnameyearhd =~ s/11/B/; + $pspfilnameyearhd =~ s/12/C/; + $pspfilnameyearhd =~ s/13/D/; + $pspfilnameyearhd =~ s/14/E/; + $pspfilnameyearhd =~ s/15/F/; + $pspfilnameyearhd =~ s/16/G/; + $pspfilnameyearhd =~ s/17/H/; + $pspfilnameyearhd =~ s/18/I/; + $pspfilnameyearhd =~ s/19/J/; + $pspfilnameyearhd =~ s/20/K/; + $pspfilnameyearhd =~ s/21/L/; + $pspfilnameyearhd =~ s/22/M/; + $pspfilnameyearhd =~ s/23/N/; + $pspfilnameyearhd =~ s/24/O/; + $pspfilnameyearhd =~ s/25/P/; + $pspfilnameyearhd =~ s/26/Q/; + $pspfilnameyearhd =~ s/27/R/; + $pspfilnameyearhd =~ s/28/S/; + $pspfilnameyearhd =~ s/29/T/; + $pspfilnameyearhd =~ s/30/U/; + $pspfilnameyearhd =~ s/31/V/; + $pspfilnameyearhd =~ s/32/W/; + $pspfilnameyearhd =~ s/33/X/; + $pspfilnameyearhd =~ s/34/Y/; + $pspfilnameyearhd =~ s/35/Z/; + +$pspfilnameyearft = substr($btid, 2, 2); +$pspfilnameyearft = sprintf("%02d",$pspfilnameyearft); +$pspfilnamehd = $pspfilnameyearhd . $pspfilnameyearft; + +} + +# 話数 +if (0 < $countno && $countno < 100 ){ +# 2桁 + $pspfilnameft = sprintf("%02d",$countno); +}elsif(100 <= $countno && $countno < 1000 ){ +# 3桁 + $pspfilnameft = sprintf("%03d",$countno); # 話数3桁 + $pspfilnamehd = substr($pspfilnamehd, 0, 2); # TID 二桁 後ろ1バイト落とし +}elsif(1000 <= $countno && $countno < 10000 ){ +# 4桁 + $pspfilnameft = sprintf("%04d",$countno); # 話数4桁 + $pspfilnamehd = substr($pspfilnamehd, 0, 1); # TID 1桁 後ろ2バイト落とし + + +}elsif($countno == 0){ +#タイムスタンプが最新のMP4ファイル名取得 +my $newestmp4filename = `cd $pspdirname ; ls -t *.MP4 | head -1`; + if ($newestmp4filename =~ /M4V$tid/){ + $nowcountno = $' ; + $nowcountno++; + $pspfilnameft = sprintf("%02d",$nowcountno); + while (-e "$pspdirname/M4V".$pspfilnamehd.$pspfilnameft.".MP4"){ + $nowcountno++; + $pspfilnameft = sprintf("%02d",$nowcountno); + print "File exist:$nowcountno\n"; + } +#print "NeXT\n"; +}else{ +# 0の場合 週番号を100から引いたもの +# week number of year with Monday as first day of week (01..53) +#だったけど常に0に +# my $weeno = `date "+%V"`; +# $weeno = 100 - $weeno ; +# $pspfilnameft = sprintf("%02d",$weeno); + $pspfilnameft = sprintf("%02d",0); +#print "WEEKNO\n"; +} + +} + +my $pspfilname = $pspfilnamehd.$pspfilnameft ; +# print "$pspfilname($pspfilnamehd/$pspfilnameft)\n"; +}# endif MP4ファイル名が新styleなら + +&writelog("recwrap TRCNSTART vfr4psp.sh $recfolderpath/$outputfilename $pspfilname $pspdirname $psptrcn[1]"); +#トラコン開始 +system("$toolpath/perl/transcode/vfr4psp.sh $recfolderpath/$outputfilename $pspfilname $pspdirname $psptrcn[1]"); + +&writelog("recwrap TRCNEND vfr4psp.sh $recfolderpath/$outputfilename $pspfilname $pspdirname $psptrcn[1]"); + +#最適化 + +$DBQuery = "SELECT subtitle FROM foltia_subtitle WHERE tid = '$tid' AND countno = '$countno' "; + $sth = $dbh->prepare($DBQuery); + $sth->execute(); + @programtitle = $sth->fetchrow_array; + +if ( $countno == "0" ){ + $pspcountno = ""; +}else{ + $pspcountno = $countno ; +} +&writelog("recwrap OPTIMIZE mp4psp -p $pspdirname/M4V$pspfilname.MP4 -t '$psptrcn[2] $pspcountno $programtitle[0]' "); +Jcode::convert(\$programtitle[0],'euc'); +system ("/usr/local/bin/mp4psp -p $pspdirname/M4V$pspfilname.MP4 -t '$psptrcn[2] $pspcountno $programtitle[0]'") ; + + +#サムネール + +# mplayer -ss 00:01:20 -vo jpeg:outdir=/home/foltia/php/tv/443MNV01 -ao null -sstep 1 -frames 3 -v 3 /home/foltia/php/tv/443-07-20050218-0030.m2p +#2005/02/22_18:30:05 recwrap TRCNSTART vfr4psp.sh /home/foltia/php/tv/447-21-20050222-1800.m2p 44721 /home/foltia/php/tv/447MNV01 3 +&writelog("recwrap THAMJ mplayer -ss 00:01:20 -vo jpeg:outdir=$pspdirname -ao null -sstep 1 -frames 3 -v 3 $recfolderpath/$outputfilename "); +system ("mplayer -ss 00:01:20 -vo jpeg:outdir=$pspdirname -ao null -sstep 1 -frames 3 -v 3 $recfolderpath/$outputfilename"); +&writelog("recwrap THAMI convert -crop 160x120+1+3 -resize 165x126\! $pspdirname/00000002.jpg $pspdirname/M4V$pspdirname.THM "); + +if (-e "$pspdirname/M4V".$pspfilname.".THM"){ +$timestamp =`date "+%Y%m%d-%H%M%S"`; +chomp $timestamp; + system("convert -crop 160x120+1+3 -resize 165x126\! $pspdirname/00000002.jpg $pspdirname/M4V".$pspfilname.".THM.".$timestamp.".THM"); + +}else{ + system("convert -crop 160x120+1+3 -resize 165x126\! $pspdirname/00000002.jpg $pspdirname/M4V".$pspfilname.".THM"); +} +# rm -rf 00000001.jpg +# convert -resize 160x120\! 00000002.jpg M4V44307.THM +# rm -rf 00000002.jpg +system("rm -rf $pspdirname/0000000*.jpg "); + + + + +# MP4ファイル名をPIDレコードに書き込み + $DBQuery = "UPDATE foltia_subtitle SET + PSPfilename = 'M4V$pspfilname.MP4' + WHERE pid = '$pid' "; + $sth = $dbh->prepare($DBQuery); + $sth->execute(); +&writelog("recwrap UPDATEsubtitleDB $DBQuery"); + +# MP4ファイル名をfoltia_mp4files挿入 + $DBQuery = "insert into foltia_mp4files values ('$tid','M4V$pspfilname.MP4') "; + $sth = $dbh->prepare($DBQuery); + $sth->execute(); +&writelog("recwrap UPDATEmp4DB $DBQuery"); + }#PSPトラコンあり -sub continuousrecordingcheck(){ - my $now = time() + 60 * 2; -&writelog("recwrap DEBUG continuousrecordingcheck() now $now"); -my @processes =`ps ax | grep -e recpt1 -e recfriio`; #foltiaBBS もうすぐ終了する番組のプロセスをkill 投稿日 2010年08月05日03時19分33秒 投稿者 Nis - -my $psline = ""; -my @processline = ""; -my $pid = ""; -my @pid; -my $sth; -foreach (@processes){ - if (/recpt1|friiodetect/) { - if (/^.[0-9]*\s/){ - push(@pid, $&); - }#if - }#if -}#foreach - -if (@pid > 0){ -my @filenameparts; -my $tid = ""; -my $startdate = ""; -my $starttime = ""; -my $startdatetime = ""; -my @recfile; -my $endtime = ""; -my $endtimeepoch = ""; -foreach $pid (@pid){ -#print "DEBUG PID $pid\n"; -&writelog("recwrap DEBUG continuousrecordingcheck() PID $pid"); - - my @lsofoutput = `/usr/sbin/lsof -p $pid`; - my $filename = ""; - #print "recfolferpath $recfolderpath\n"; - foreach (@lsofoutput){ - if (/m2t/){ - @processline = split(/\s+/,$_); - $filename = $processline[8]; - $filename =~ s/$recfolderpath\///; - &writelog("recwrap DEBUG continuousrecordingcheck() FILENAME $filename"); - # 1520-9-20081201-0230.m2t - @filenameparts = split(/-/,$filename); - $tid = $filenameparts[0]; - $startdate = $filenameparts[2]; - $starttime = $filenameparts[3]; - @filenameparts = split(/\./,$starttime); - $startdatetime = $startdate.$filenameparts[0]; - #DBから録画中番組のデータ探す - &writelog("recwrap DEBUG continuousrecordingcheck() $stmt{'recwrap.7'}"); - $sth = $dbh->prepare($stmt{'recwrap.7'}); - &writelog("recwrap DEBUG continuousrecordingcheck() prepare"); - $sth->execute($tid, $startdatetime); - &writelog("recwrap DEBUG continuousrecordingcheck() execute"); - @recfile = $sth->fetchrow_array; - &writelog("recwrap DEBUG continuousrecordingcheck() @recfile $recfile[0] $recfile[1] $recfile[2] $recfile[3] $recfile[4] $recfile[5] $recfile[6] $recfile[7] $recfile[8] $recfile[9] "); - #終了時刻 - $endtime = $recfile[4]; - $endtimeepoch = &foldate2epoch($endtime); - &writelog("recwrap DEBUG continuousrecordingcheck() $recfile[0] $recfile[1] $recfile[2] $recfile[3] $recfile[4] $recfile[5] endtimeepoch $endtimeepoch"); - if ($endtimeepoch < $now){#まもなく終わる番組なら - #kill - system("kill $pid"); - &writelog("recwrap recording process killed $pid/$endtimeepoch/$now"); - }else{ - &writelog("recwrap No processes killed: $endtimeepoch/$now"); - } - }#endif m2t - }#foreach lsofoutput -}#foreach -}else{ -#print "DEBUG fecfriio NO PID\n"; -&writelog("recwrap No recording process killed."); -} -}#endsub - - - + + + Index: trunk/install/perl/epgimport.pl =================================================================== --- trunk/install/perl/epgimport.pl (リビジョン 129) +++ (リビジョン ) @@ -1,255 +1,0 @@ -#!/usr/bin/perl -# -# -# Anime recording system foltia -# http://www.dcc-jpl.com/soft/foltia/ -# -# epgimport.pl -# -# EPG番組表取得 -# tsを取得してepgdump経由でepgテーブルにインポートします。 -# 内部でxmltv2foltia.plを呼んで実際の追加処理を行います。 -# -# usage -# epgimport.pl [long] #longがつくと一週間分 -# epgimport.pl [stationid] #放送局ID指定でそのチャンネルだけ短時間で取得 -# -# DCC-JPL Japan/foltia project -# - -use DBI; -use DBD::Pg; -use DBD::SQLite; -#use Schedule::At; -#use Time::Local; -use Jcode; - -$path = $0; -$path =~ s/epgimport.pl$//i; -if ($path ne "./"){ -push( @INC, "$path"); -} - -require "foltialib.pl"; - -my $ontvcode = ""; -my $channel = ""; -my @date = (); -my $recpt1path = $toolpath . "/perl/tool/recpt1"; #ほかのキャプチャデバイス作ってる人はココを変更 -my $epgdumppath = $toolpath ."/perl/tool"; #epgdumpのあるディレクトリ -my $xmloutpath = "/tmp"; -my %stations; -my $uset = ""; -my $usebs = ""; -my $usecs = ""; -my $stationid = "" ; -my $rectime = 0; -my $bsrectime = 0; -my $cs1rectime = 0; -my $cs2rectime = 0; - - -#引き数がアルか? -if ( $ARGV[0] eq "long" ){ - #長期番組表取得 - $rectime = 60; - $bsrectime = 120; - $cs1rectime = 60; - $cs2rectime = 60; -}elsif( $ARGV[0] > 0 ){ - $stationid = $ARGV[0]; - $rectime = 3; - $bsrectime = 36; - $cs1rectime = 15; - $cs2rectime = 5; -}else{ - #短期番組表取得 - $rectime = 3; - $bsrectime = 36; - $cs1rectime = 15; - $cs2rectime = 5; -} -#データ量比較 -#3秒 16350 Aug 10 16:21 __27-epg-short.xml -#12秒 56374 Aug 10 16:21 __27-epg-long.xml -#60秒 127735 Aug 10 16:23 __27-epg-velylong.xml - -#重複起動確認 -$processes = &processfind("epgimport.pl"); -if ($processes > 1 ){ -&writelog("epgimport processes exist. exit:"); -exit; -} - - -$dbh = DBI->connect($DSN,$DBUser,$DBPass) ||die $DBI::error;; - -#局指定があるなら、単一放送局指定モード -if ($stationid > 0){ - $sth = $dbh->prepare($stmt{'epgimport.1'}); - $sth->execute($stationid); - @data = $sth->fetchrow_array(); - unless($data[0] == 1){#局の数が1でなければ異常終了 - &writelog("epgimport ERROR Invalid station id ($stationid)."); - exit 1; - }else{ - $sth = $dbh->prepare($stmt{'epgimport.2'}); - $sth->execute($stationid); - @data = $sth->fetchrow_array(); - $channel = $data[0]; - $ontvcode = $data[1]; - if ($channel > 0){ - &writelog("epgimport DEBUG Single station mode (ch:$channel / $ontvcode)."); - }else{#ラジオ局などの場合 - &writelog("epgimport ABORT SID $stationid is not Digital TV ch."); - exit; - }#endif ラジオ局かどうか - }#end unless($data[0] == 1 -}#endif $stationid > 0 - -#地デジ---------------------------------------- -#受信局確認 -if ($channel >= 13 && $channel <= 62){#局指定があるなら - $stations{$channel} = $ontvcode; - $uset = 1; -}elsif($channel >= 100){ - $uset = 0; #地デジ範囲外の局 -}else{ - $sth = $dbh->prepare($stmt{'epgimport.3'}); - $sth->execute(); - - while (@data = $sth->fetchrow_array()) { - $stations{$data[0]} = $data[1]; - }#end while - $uset = 1; -}#end if - -if ($uset == 1){ -foreach $channel ( keys %stations ) { - $ontvcode = $stations{$channel}; - #print "$ontvcode $digitalch\n"; - &chkrecordingschedule; - #print "$recpt1path $channel $rectime $recfolderpath/__$channel.m2t\n"; - $oserr = `$recpt1path $channel $rectime $recfolderpath/__$channel.m2t`; - #print "$epgdumppath/epgdump $ontvcode $recfolderpath/__$channel.m2t $xmloutpath/__$channel-epg.xml\n"; - $oserr = `$epgdumppath/epgdump $ontvcode $recfolderpath/__$channel.m2t $xmloutpath/__$channel-epg.xml`; - #print "cat $xmloutpath/__$channel-epg.xml | $toolpath/perl/xmltv2foltia.pl\n"; - $oserr = `cat $xmloutpath/__$channel-epg.xml | $toolpath/perl/xmltv2foltia.pl`; - unlink "$recfolderpath/__$channel.m2t"; - unlink "$xmloutpath/__$channel-epg.xml"; -}#end foreach -}#endif - -#BS---------------------------------------- -#受信局確認 -if ($channel >= 100 && $channel <= 222 ){#局指定があるなら - $usebs = 1; -}elsif($channel >= 13 && $channel <= 62){ - $usebs = 0; #地デジ局指定の場合、スキップ。 -}elsif($channel >= 223){ - $usebs = 0; #CS局指定の場合もスキップ -}else{ - $sth = $dbh->prepare($stmt{'epgimport.4'}); - $sth->execute(); - @data = $sth->fetchrow_array(); - if ($data[0] > 0 ){ - $usebs = 1; - } -}#end if - -if ($usebs == 1){ - #$ontvcode = $stations{$channel}; - $channel = 211; - #print "$ontvcode $digitalch\n"; - &chkrecordingschedule; - #print "$recpt1path $channel $bsrectime $recfolderpath/__$channel.m2t\n"; - $oserr = `$recpt1path $channel $bsrectime $recfolderpath/__$channel.m2t`; - #print "$epgdumppath/epgdump /BS $recfolderpath/__$channel.m2t $xmloutpath/__$channel-epg.xml\n"; - $oserr = `$epgdumppath/epgdump /BS $recfolderpath/__$channel.m2t $xmloutpath/__$channel-epg.xml`; - #print "cat $xmloutpath/__$channel-epg.xml | $toolpath/perl/xmltv2foltia.pl\n"; - $oserr = `cat $xmloutpath/__$channel-epg.xml | $toolpath/perl/xmltv2foltia.pl`; - unlink "$recfolderpath/__$channel.m2t"; - unlink "$xmloutpath/__$channel-epg.xml"; -}else{ - &writelog("epgimport DEBUG Skip BS.$channel:$usebs"); -} - - - -#CS---------------------------------------- -#if ( $ARGV[0] eq "long" ){ #短時間録画なら異常に重くはならないことを発見した -#受信局確認 -if ($channel >= 223 ){#局指定があるなら - $usecs = 1; -}else{ - $sth = $dbh->prepare($stmt{'epgimport.5'}); - $sth->execute(); - @data = $sth->fetchrow_array(); - if ($data[0] > 0 ){ - $usecs = 1; - } -}#end if - -if ($usecs == 1){ -#一気に録画して - $channela = "CS8"; - #print "$ontvcode $digitalch\n"; - &chkrecordingschedule; - #print "$recpt1path $channela $bsrectime $recfolderpath/__$channela.m2t\n"; - $oserr = `$recpt1path $channela $cs1rectime $recfolderpath/__$channela.m2t`; - - $channelb = "CS24"; - &chkrecordingschedule; - #print "$recpt1path $channelb $bsrectime $recfolderpath/__$channelb.m2t\n"; - $oserr = `$recpt1path $channelb $cs2rectime $recfolderpath/__$channelb.m2t`; - -#時間のかかるepgdumpまとめてあとまわし - #print "nice -n 19 $epgdumppath/epgdump /CS $recfolderpath/__$channela.m2t $xmloutpath/__$channela-epg.xml\n"; - $oserr = `$epgdumppath/epgdump /CS $recfolderpath/__$channela.m2t $xmloutpath/__$channela-epg.xml`; - #print "cat $xmloutpath/__$channela-epg.xml | $toolpath/perl/xmltv2foltia.pl\n"; - $oserr = `cat $xmloutpath/__$channela-epg.xml | $toolpath/perl/xmltv2foltia.pl`; - unlink "$recfolderpath/__$channela.m2t"; - unlink "$xmloutpath/__$channela-epg.xml"; - - #print "nice -n 19 $epgdumppath/epgdump /CS $recfolderpath/__$channelb.m2t $xmloutpath/__$channelb-epg.xml\n"; - $oserr = `$epgdumppath/epgdump /CS $recfolderpath/__$channelb.m2t $xmloutpath/__$channelb-epg.xml`; - #print "cat $xmloutpath/__$channelb-epg.xml | $toolpath/perl/xmltv2foltia.pl\n"; - $oserr = `cat $xmloutpath/__$channelb-epg.xml | $toolpath/perl/xmltv2foltia.pl`; - unlink "$recfolderpath/__$channelb.m2t"; - unlink "$xmloutpath/__$channelb-epg.xml"; -}else{ - &writelog("epgimport DEBUG Skip CS."); -}#endif use -#}else{ -# if ($channel >= 223 ){#局指定があるなら -# &writelog("epgimport ERROR CS Station No. was ignored. CS EPG get long mode only."); -# } -#}#end if long - - -sub chkrecordingschedule{ -#放送予定まで近くなったら、チューナー使いつづけないようにEPG取得中断 -my $now = time() ; -my $fiveminitsafter = time() + 60 * 4; -my $rows = -2; -$now = &epoch2foldate($now); -$fiveminitsafter = &epoch2foldate($fiveminitsafter); - -#録画予定取得 -$sth = $dbh->prepare($stmt{'epgimport.6'}); -$sth->execute($now,$fiveminitsafter,$now,$fiveminitsafter); - -while (@data = $sth->fetchrow_array()) { -# -}#end while - -$rows = $sth->rows; - -if ($rows > 0 ){ - &writelog("epgimport ABORT The recording schedule had approached."); - exit ; -}else{ - &writelog("epgimport DEBUG Near rec program is $rows.:$now:$fiveminitsafter"); -}#end if -}#endsub chkrecordingschedule - Index: trunk/install/perl/envpolicyupdate.pl =================================================================== --- trunk/install/perl/envpolicyupdate.pl (リビジョン 94) +++ (リビジョン ) @@ -1,70 +1,0 @@ -#!/usr/bin/perl -# -# Anime recording system foltia -# http://www.dcc-jpl.com/soft/foltia/ -# -# -# envpolicyupdate.pl -# -# 環境ポリシー利用時に.htpasswdを再編する。 -# -# -# DCC-JPL Japan/foltia project -# -# - -use DBI; -use DBD::Pg; -use DBD::SQLite; - -$path = $0; -$path =~ s/envpolicyupdate.pl$//i; -if ($path ne "./"){ -push( @INC, "$path"); -} - -require "foltialib.pl"; - -# 環境ポリシーを使っているかPHPコンフィグファイル解析 -$returnparam = getphpstyleconfig("useenvironmentpolicy"); -eval "$returnparam\n"; - -if ($useenvironmentpolicy == 1){ -$returnparam = getphpstyleconfig("environmentpolicytoken"); -eval "$returnparam\n"; - - $dbh = DBI->connect($DSN,$DBUser,$DBPass) ||die $DBI::error;; - - $envph = $dbh->prepare($stmt{'envpolicyupdate.1'}); - $envph->execute(); - -#なければつくる -unless (-e "$toolpath/.htpasswd"){ - $oserr = `touch $toolpath/.htpasswd`; -}else{ - $oserr = `mv $toolpath/.htpasswd $toolpath/htpasswd_foltia_old`; - $oserr = `touch $toolpath/.htpasswd`; -} - -while (@ref = $envph->fetchrow_array ){ - -if ($ref[0] == 0){ -#ユーザクラス -#0:特権管理者 -#1:管理者:予約削除、ファイル削除が出来る -#2:利用者:EPG追加、予約追加が出来る -#3:ビュアー:ファイルダウンロードが出来る -#4:ゲスト:インターフェイスが見れる - - $htpasswd = "$ref[2]"; -}else{ - $htpasswd = "$ref[2]"."$environmentpolicytoken"; -} - -$oserr = `htpasswd -b $toolpath/.htpasswd $ref[1] $htpasswd`; - - -}#end while -&writelog("envpolicyupdate htpasswd updated."); - -}#endif Index: trunk/install/perl/channelscan.pl =================================================================== --- trunk/install/perl/channelscan.pl (リビジョン 111) +++ (リビジョン ) @@ -1,387 +1,0 @@ -#!/usr/bin/perl -# -# -# Anime recording system foltia -# http://www.dcc-jpl.com/soft/foltia/ -# -# -# チャンネルスキャン -# 初期インストール時に受信可能局をスキャンします -# -# DCC-JPL Japan/foltia project -# - -#use DBI; -#use DBD::Pg; -#use DBD::SQLite; -#use Schedule::At; -#use Time::Local; -#use Jcode; - -#$path = $0; -#$path =~ s/channelscan.pl$//i; -#if ($path ne "./"){ -#push( @INC, "$path"); -#} - -#require "foltialib.pl"; - -my $recpt1path = "/home/foltia/perl/tool/recpt1"; #ほかのキャプチャデバイス作ってる人はココを変更 -my $epgdumppath = "/home/foltia/perl/tool"; #epgdumpのあるディレクトリ -my $recfolderpath = "/home/foltia/php/tv";#tsを出力するディレクトリ -my $xmloutpath = "/tmp"; -my $channel = 13 ; #地デジチャンネルは13-62 -my $oserr = ""; -my $line = ""; - -print "Initialize\n"; -print "Tool path are\n"; -print "REC:$recpt1path\n"; -print "EPGDUMP:$epgdumppath/epgdump\n"; -print "TS OUT:$recfolderpath/\n"; -print "XML OUT:$xmloutpath/\n"; - -#ツールがあるか確認 -unless (-e "$recpt1path"){ - print "Please install $recpt1path.\n"; - exit 1; -} -unless (-e "$epgdumppath/epgdump"){ - print "Please install $epgdumppath/epgdump.\n"; - exit 1; -} -unless (-e "$recfolderpath"){ - print "Please make directory $recfolderpath.\n"; - exit 1; -} -unless (-e "$xmloutpath"){ - print "Please make directory $xmloutpath.\n"; - exit 1; -} - - -#地デジスキャンループ -for ($channel = 13; $channel <= 62 ; $channel++){ - print "\nChannel: $channel\n"; - $oserr = `$recpt1path $channel 4 $recfolderpath/__$channel.m2t`; - $oserr = `$epgdumppath/epgdump $channel $recfolderpath/__$channel.m2t $xmloutpath/__$channel-epg.xml`; - - if (-s "$xmloutpath/__$channel-epg.xml" ){ - print "\t\t This channel can view : $channel \n"; - open(XML, "< $xmloutpath/__$channel-epg.xml"); - while ( $line = ) { - #Jcode::convert(\$line,'euc','utf8'); - if($line =~ ///g; - #Jcode::convert(\$line,'utf8','euc'); - print "\t\t $channel $line\n"; - }#end if - }#end while - close(XML); - }else{ - print "\t\t Not Available : $channel \n"; - }#end if -}#end for - - -#BSデジタル -$channel = 211; - print "\nBS Digital Scan\n"; - $oserr = `$recpt1path $channel 4 $recfolderpath/__$channel.m2t`; - $oserr = `$epgdumppath/epgdump /BS $recfolderpath/__$channel.m2t $xmloutpath/__$channel-epg.xml`; - - if (-s "$xmloutpath/__$channel-epg.xml" ){ - print "\t\t BS Digital can view : \n"; - open(XML, "< $xmloutpath/__$channel-epg.xml"); - while ( $line = ) { - #Jcode::convert(\$line,'euc','utf8'); - if($line =~ ///g; - #Jcode::convert(\$line,'utf8','euc'); - print "\t\t $line\n"; - }#end if - }#end while - close(XML); - }else{ - print "\t\t Not Available : BS Digital \n"; - }#end if - - -# -# NHK BS1 -# -# -# NHK BS2 -# -# -# NHK BSh -# -# -# BS日テレ -# -# -# BS朝日 -# -# -# BS-TBS -# -# -# BSジャパン -# -# -# BSフジ -# -# -# WOWOW -# -# -# WOWOW2 -# -# -# WOWOW3 -# -# -# スター・チャンネル -# -# -# BS11 -# -# -# TwellV -# -# - -#CSデジタル -$channel = "CS8"; - print "\nCS Digital Scan\n"; - $oserr = `$recpt1path $channel 4 $recfolderpath/__$channel.m2t`; - $oserr = `$epgdumppath/epgdump /CS $recfolderpath/__$channel.m2t $xmloutpath/__$channel-epg.xml`; - - if (-s "$xmloutpath/__$channel-epg.xml" ){ - print "\t\t CS Digital can view : \n"; - open(XML, "< $xmloutpath/__$channel-epg.xml"); - while ( $line = ) { - #Jcode::convert(\$line,'euc','utf8'); - if($line =~ ///g; - #Jcode::convert(\$line,'utf8','euc'); - print "\t\t $line\n"; - }#end if - }#end while - close(XML); - }else{ - print "\t\t Not Available : CS Digital \n"; - }#end if - -# -# スターchプラス -# -# -# 日本映画専門chHD -# -# -# フジテレビCSHD -# -# -# ショップチャンネル -# -# -# ザ・シネマ -# -# -# スカチャンHD800 -# -# -# スカチャン801 -# -# -# スカチャン802 -# -# -# e2プロモ -# -# -# インターローカルTV -# -# -# Jスポーツ ESPN -# -# -# FOX -# -# -# スペースシャワーTV -# -# -# カートゥーン ネット -# -# -# トゥーン・ディズニー -# -# -# 東映チャンネル -# -# -# 衛星劇場 -# -# -# チャンネルNECO -# -# -# 洋画★シネフィル -# -# -# スター・クラシック -# -# -# 時代劇専門チャンネル -# -# -# スーパードラマ -# -# -# AXN -# -# -# ナショジオチャンネル -# -# -# ワンテンポータル -# -# -# ゴルフチャンネル -# -# -# テレ朝チャンネル -# -# -# MTV -# -# -# ミュージック・エア -# -# -# 朝日ニュースター -# -# -# BBCワールド -# -# -# CNNj -# -# -# ジャスト・アイ -# -# -# Jスポーツ 1 -# -# -# Jスポーツ 2 -# -# -# JスポーツPlusH -# -# -# GAORA -# -# -# sky・Aスポーツ+ -# -# -# 宝塚プロモチャンネル -# -# -# SKY・STAGE -# -# -# チャンネル銀河 -# -# -# AT-X -# -# -# ヒストリーチャンネル -# -# -# スカチャン803 -# -# -# スカチャン804 -# -# -# ムービープラスHD -# -# -# ゴルフネットワーク -# -# -# LaLa HD -# -# -# フジテレビ739 -# -# -# フジテレビ721 -# -# -# アニマックス -# -# -# ディスカバリー -# -# -# アニマルプラネット -# -# -# C-TBSウエルカム -# -# -# QVC -# -# -# プライム365.TV -# -# -# ファミリー劇場 -# -# -# TBSチャンネル -# -# -# ディズニーチャンネル -# -# -# MUSIC ON! TV -# -# -# キッズステーション -# -# -# TBSニュースバード -# -# -# CS日本番組ガイド -# -# -# 日テレG+ -# -# -# fashion TV -# -# -# 日テレプラス -# -# -# エコミュージックTV -# -# -# Music Japan TV -# -# -# 日テレNEWS24 -# - - -#CATV -# /home/foltia/perl/tool/recpt1 --b25 C13 10 /home/foltia/php/tv/__C13.m2t -# /home/foltia/perl/tool/epgdump /CS /home/foltia/php/tv/__C13.m2t /tmp/__C13-epg.xml Index: trunk/install/perl/digitaltvrecording.pl =================================================================== --- trunk/install/perl/digitaltvrecording.pl (リビジョン 131) +++ (リビジョン ) @@ -1,409 +1,0 @@ -#!/usr/bin/perl -# -# Anime recording system foltia -# http://www.dcc-jpl.com/soft/foltia/ -# -#digitaltvrecording.pl -# PT1,PT2,friioをはじめとするデジタル録画プログラムを呼びだす録画モジュール。 -# -#usage digitaltvrecording.pl bandtype ch length(sec) [stationid] [sleeptype] [filename] [TID] [NO] [unittype] -#引数 -#bandtype : 0:地デジ 1:BSデジタル 2:CSデジタル -#ch :録画チャンネル (地デジはそのまま渡す、BS/CSデジタルは基本的にチャンネル BS1/BS2など同じ数時に) -#length(sec) :録画秒数 [必須項目] -#[stationid] :foltia stationid -#[sleeptype] :0かN Nならスリープなしで録画 -#[filename] :出力ファイル名 -#[TID] :しょぼかるタイトルID -#[NO] :その番組の放送話数 -#[unittype] :friioかfriioBSかユニデンチューナかHDUSかなど(未使用) -# -# DCC-JPL Japan/foltia project -# -# - -$path = $0; -$path =~ s/digitaltvrecording.pl$//i; -if ($path ne "./"){ -push( @INC, "$path"); -} - -#tvConfig.pl ------------------------------- -$extendrecendsec = 10; #recording end second. -#$startupsleeptime = 52; #process wait(MAX60sec) -$startupsleeptime = 32; #process wait(MAX60sec) -#------------------------------- - -require 'foltialib.pl'; - - &writelog("digitaltvrecording: DEBUG $ARGV[0] $ARGV[1] $ARGV[2] $ARGV[3] $ARGV[4] $ARGV[5] $ARGV[6] $ARGV[7] $ARGV[8]"); - - -#準備 -&prepare; -#もし録画が走ってたら、止める -#$reclengthsec = &chkrecprocess(); -#&setbitrate; -#&chkextinput; -#$reclengthsec = $reclengthsec + $extendrecendsec ; - -&calldigitalrecorder; - -&writelog("digitaldigitaltvrecording:RECEND:$bandtype $recch $lengthsec $stationid $sleeptype $filename $tid $countno $unittype -"); - -# -- これ以下サブルーチン ---------------------------- - - -sub prepare{ - -#引数エラー処理 -$bandtype = $ARGV[0] ; -$recch = $ARGV[1] ; -$lengthsec = $ARGV[2] ; -$stationid = $ARGV[3] ; -$sleeptype = $ARGV[4] ; -$filename = $ARGV[5] ; -$tid = $ARGV[6] ; -$countno = $ARGV[7] ; -$unittype = $ARGV[8] ; - -if (($bandtype eq "" )|| ($recch eq "")|| ($lengthsec eq "")){ - print "usage digitaltvrecording.pl bandtype ch length(sec) [stationid] [sleeptype] [filename] [TID] [NO] [unittype]\n"; - exit; -} - -my $intval = $recch % 10; # 0〜9 sec -my $startupsleep = $startupsleeptime - $intval; # 18〜27 sec -$reclengthsec = $lengthsec + (60 - $startupsleep) + 1; # - -if ( $sleeptype ne "N"){ - &writelog("digitaltvrecording: DEBUG SLEEP $startupsleeptime:$intval:$startupsleep:$reclengthsec"); - sleep ( $startupsleep); - #2008/08/12_06:39:00 digitaltvrecording: DEBUG SLEEP 17:23:-6:367 -}else{ - &writelog("digitaltvrecording: DEBUG RAPID START"); -} -## recfriio このへんどうなってるの? -#if ($recunits > 1){ -#my $deviceno = $recunits - 1;#3枚差しのとき/dev/video2から使う -# $recdevice = "/dev/video$deviceno"; -# $recch = $ARGV[0] ; -#}else{ -##1枚差し -# $recdevice = "/dev/video0"; -# $recch = $ARGV[0] ; -#} - -$outputpath = "$recfolderpath"."/"; - -if ($countno eq "0"){ - $outputfile = $outputpath.$tid."--"; -}else{ - $outputfile = $outputpath.$tid."-".$countno."-"; -} -#2番目以降のクリップでファイル名指定があったら - if ($filename ne ""){ - - $outputfile = $filename ; - $outputfile = &filenameinjectioncheck($outputfile); - $outputfilewithoutpath = $outputfile ; - $outputfile = $outputpath.$outputfile ; - &writelog("digitaltvrecording: DEBUG FILENAME ne null \$outputfile $outputfile "); - }else{ - $outputfile .= strftime("%Y%m%d-%H%M", localtime(time + 60)); - chomp($outputfile); - $outputfile .= ".m2t"; - $outputfilewithoutpath = $outputfile ; - &writelog("digitaltvrecording: DEBUG FILENAME is null \$outputfile $outputfile "); - } - - -@wday_name = ("Sun","Mon","Tue","Wed","Thu","Fri","Sat"); -$sleepcounter = 0; -$cmd=""; - -#二重録りなど既に同名ファイルがあったら中断 -if ( -e "$outputfile" ){ - if ( -s "$outputfile" ){ - &writelog("digitaltvrecording :ABORT :recfile $outputfile exist."); - exit 1; - } -} - -}#end prepare - - -#------------------------------------------------------------------------------------ -# -sub calldigitalrecorder{ -# -#白friioと黒friio、PT1対応 -#2008/10/23 recfriio4仕様に変更 -# -my $oserr = 0; -my $originalrecch = $recch; -my $pt1recch = $recch; -my $errorflag = 0; -if ($bandtype == 0){ -# 地デジ friio - -}elsif($bandtype == 1){ -# BS/CS friio - #recfriiobs用チャンネルリマップ - if ($recch == 101) { - $bssplitflag = $recch; - $recch = "b10";#22 : NHK BS1/BS2 - }elsif($recch == 102){ - $bssplitflag = $recch; - $recch = "b10";#22 : NHK BS1/BS2 - }elsif($recch == 103){ - $recch = "b11";#23 : NHK hi - }elsif($recch == 141){ - $recch = "b8";# 20 : BS-NTV - }elsif($recch == 151){ - $recch = "b1";#13 : BS-Asahi - }elsif($recch == 161){ - $recch = "b2";#14 : BS-i - }elsif($recch == 171){ - $recch = "b4";#16 : BS-Japan - }elsif($recch == 181){ - $recch = "b9";#21 : BS-Fuji - }elsif($recch == 191){ - $recch = "b3";#15 : WOWOW - }elsif($recch == 192){ - $recch = "b3";#15 : WOWOW - }elsif($recch == 193){ - $recch = "b3";#15 : WOWOW - }elsif($recch == 200){ - $recch = "b6";# b6 # Star Channel - }elsif($recch == 211){ - $recch = "b5";#17 : BS11 - }else{ - $recch = "b7";#19 : TwellV - } -#PT1はそのまま通る - -}elsif($bandtype == 2){ -# recpt1でのみ動作確認 - if($recch == 335){ - $pt1recch = "CS8";#335ch:キッズステーション HD - }elsif($recch == 237){ - $pt1recch = "CS2";#237ch:スター・チャンネル プラス - }elsif($recch == 239){ - $pt1recch = "CS2";#239ch:日本映画専門チャンネルHD - }elsif($recch == 306){ - $pt1recch = "CS2";#306ch:フジテレビCSHD - }elsif($recch == 100){ - $pt1recch = "CS4";#100ch:e2プロモ - }elsif($recch == 256){ - $pt1recch = "CS4";#256ch:J sports ESPN - }elsif($recch == 312){ - $pt1recch = "CS4";#312ch:FOX - }elsif($recch == 322){ - $pt1recch = "CS4";#322ch:スペースシャワーTV - }elsif($recch == 331){ - $pt1recch = "CS4";#331ch:カートゥーンネットワーク - }elsif($recch == 194){ - $pt1recch = "CS4";#194ch:インターローカルTV - }elsif($recch == 334){ - $pt1recch = "CS4";#334ch:トゥーン・ディズニー - }elsif($recch == 221){ - $pt1recch = "CS6";#221ch:東映チャンネル - }elsif($recch == 222){ - $pt1recch = "CS6";#222ch:衛星劇場 - }elsif($recch == 223){ - $pt1recch = "CS6";#223ch:チャンネルNECO - }elsif($recch == 224){ - $pt1recch = "CS6";#224ch:洋画★シネフィル・イマジカ - }elsif($recch == 292){ - $pt1recch = "CS6";#292ch:時代劇専門チャンネル - }elsif($recch == 238){ - $pt1recch = "CS6";#238ch:スター・チャンネル クラシック - }elsif($recch == 310){ - $pt1recch = "CS6";#310ch:スーパー!ドラマTV - }elsif($recch == 311){ - $pt1recch = "CS6";#311ch:AXN - }elsif($recch == 343){ - $pt1recch = "CS6";#343ch:ナショナルジオグラフィックチャンネル - }elsif($recch == 055){ - $pt1recch = "CS8";#055ch:ショップ チャンネル - }elsif($recch == 228){ - $pt1recch = "CS10";#228ch:ザ・シネマ - }elsif($recch == 800){ - $pt1recch = "CS10";#800ch:スカチャンHD800 - }elsif($recch == 801){ - $pt1recch = "CS10";#801ch:スカチャン801 - }elsif($recch == 802){ - $pt1recch = "CS10";#802ch:スカチャン802 - }elsif($recch == 260){ - $pt1recch = "CS12";#260ch:ザ・ゴルフ・チャンネル - }elsif($recch == 303){ - $pt1recch = "CS12";#303ch:テレ朝チャンネル - }elsif($recch == 323){ - $pt1recch = "CS12";#323ch:MTV 324ch:大人の音楽専門TV◆ミュージック・エア - }elsif($recch == 352){ - $pt1recch = "CS12";#352ch:朝日ニュースター - }elsif($recch == 353){ - $pt1recch = "CS12";#353ch:BBCワールドニュース - }elsif($recch == 354){ - $pt1recch = "CS12";#354ch:CNNj - }elsif($recch == 361){ - $pt1recch = "CS12";#361ch:ジャスト・アイ インフォメーション - }elsif($recch == 251){ - $pt1recch = "CS14";#251ch:J sports 1 - }elsif($recch == 252){ - $pt1recch = "CS14";#252ch:J sports 2 - }elsif($recch == 253){ - $pt1recch = "CS14";#253ch:J sports Plus - }elsif($recch == 254){ - $pt1recch = "CS14";#254ch:GAORA - }elsif($recch == 255){ - $pt1recch = "CS14";#255ch:スカイ・Asports+ - }elsif($recch == 305){ - $pt1recch = "CS16";#305ch:チャンネル銀河 - }elsif($recch == 333){ - $pt1recch = "CS16";#333ch:アニメシアターX(AT-X) - }elsif($recch == 342){ - $pt1recch = "CS16";#342ch:ヒストリーチャンネル - }elsif($recch == 290){ - $pt1recch = "CS16";#290ch:TAKARAZUKA SKYSTAGE - }elsif($recch == 803){ - $pt1recch = "CS16";#803ch:スカチャン803 - }elsif($recch == 804){ - $pt1recch = "CS16";#804ch:スカチャン804 - }elsif($recch == 240){ - $pt1recch = "CS18";#240ch:ムービープラスHD - }elsif($recch == 262){ - $pt1recch = "CS18";#262ch:ゴルフネットワーク - }elsif($recch == 314){ - $pt1recch = "CS18";#314ch:LaLa HDHV - }elsif($recch == 258){ - $pt1recch = "CS20";#258ch:フジテレビ739 - }elsif($recch == 302){ - $pt1recch = "CS20";#302ch:フジテレビ721 - }elsif($recch == 332){ - $pt1recch = "CS20";#332ch:アニマックス - }elsif($recch == 340){ - $pt1recch = "CS20";#340ch:ディスカバリーチャンネル - }elsif($recch == 341){ - $pt1recch = "CS20";#341ch:アニマルプラネット - }elsif($recch == 160){ - $pt1recch = "CS22";#160ch:C-TBSウェルカムチャンネル - }elsif($recch == 161){ - $pt1recch = "CS22";#161ch:QVC - }elsif($recch == 185){ - $pt1recch = "CS22";#185ch:プライム365.TV - }elsif($recch == 293){ - $pt1recch = "CS22";#293ch:ファミリー劇場 - }elsif($recch == 301){ - $pt1recch = "CS22";#301ch:TBSチャンネル - }elsif($recch == 304){ - $pt1recch = "CS22";#304ch:ディズニー・チャンネル - }elsif($recch == 325){ - $pt1recch = "CS22";#325ch:MUSIC ON! TV - #}elsif($recch == 330){ - # $pt1recch = "CS22";#330ch:キッズステーション #HD化により2010/4変更 - }elsif($recch == 351){ - $pt1recch = "CS22";#351ch:TBSニュースバード - }elsif($recch == 257){ - $pt1recch = "CS24";#ch:日テレG+ - }elsif($recch == 291){ - $pt1recch = "CS24";#ch:fashiontv - }elsif($recch == 300){ - $pt1recch = "CS24";#ch:日テレプラス - }elsif($recch == 320){ - $pt1recch = "CS24";#ch:安らぎの音楽と風景/エコミュージックTV - }elsif($recch == 321){ - $pt1recch = "CS24";#ch:MusicJapan TV - }elsif($recch == 350){ - $pt1recch = "CS24";#ch:日テレNEWS24 - }# end if CSリマップ - -}else{ - &writelog("digitaltvrecording :ERROR :Unsupported and type (digital CS)."); - exit 3; -} - -# PT1 -# b25,recpt1があるか確認 - if (-e "$toolpath/perl/tool/recpt1"){ - if ($bandtype >= 1){ #BS/CSなら - &writelog("digitaltvrecording DEBUG recpt1 --b25 --sid $originalrecch $pt1recch $reclengthsec $outputfile "); - $oserr = system("$toolpath/perl/tool/recpt1 --b25 --sid $originalrecch $pt1recch $reclengthsec $outputfile "); - }else{ #地デジ - &writelog("digitaltvrecording DEBUG recpt1 --b25 $originalrecch $reclengthsec $outputfile "); - $oserr = system("$toolpath/perl/tool/recpt1 --b25 $originalrecch $reclengthsec $outputfile "); - } - $oserr = $oserr >> 8; - if ($oserr > 0){ - &writelog("digitaltvrecording :ERROR :PT1 is BUSY.$oserr"); - $errorflag = 2; - } - }else{ # エラー recpt1がありません - &writelog("digitaltvrecording :ERROR :recpt1 not found. You must install $toolpath/tool/b25 and $toolpath/tool/recpt1."); - $errorflag = 1; - } -# friio -if ($errorflag >= 1 ){ -# b25,recfriioがあるか確認 - if (-e "$toolpath/perl/tool/recfriio"){ - - if (! -e "$toolpath/perl/tool/friiodetect"){ - system("touch $toolpath/perl/tool/friiodetect"); - system("chown foltia:foltia $toolpath/perl/tool/friiodetect"); - system("chmod 775 $toolpath/perl/tool/friiodetect"); - &writelog("digitaltvrecording :DEBUG make lock file.$toolpath/perl/tool/friiodetect"); - } - &writelog("digitaltvrecording DEBUG recfriio --b25 --lockfile $toolpath/perl/tool/friiodetect $recch $reclengthsec $outputfile "); - $oserr = system("$toolpath/perl/tool/recfriio --b25 --lockfile $toolpath/perl/tool/friiodetect $recch $reclengthsec $outputfile "); - $oserr = $oserr >> 8; - if ($oserr > 0){ - &writelog("digitaltvrecording :ERROR :friio is BUSY.$oserr"); - exit 2; - } - -#BS1/BS2などのスプリットを -if ($bssplitflag == 101){ - if (-e "$toolpath/perl/tool/TsSplitter.exe"){ - # BS1 - system("wine $toolpath/perl/tool/TsSplitter.exe -EIT -ECM -EMM -OUT \"$outputpath\" -HD -SD2 -SD3 -1SEG -LOGFILE -WAIT2 $outputfile"); - $splitfile = $outputfile; - $splitfile =~ s/\.m2t$/_SD1.m2t/; - if (-e "$splitfile"){ - system("rm -rf $outputfile ; mv $splitfile $outputfile"); - &writelog("digitaltvrecording DEBUG rm -rf $outputfile ; mv $splitfile $outputfile: $?."); - }else{ - &writelog("digitaltvrecording ERROR File not found:$splitfile."); - } - }else{ - &writelog("digitaltvrecording ERROR $toolpath/perl/tool/TsSplitter.exe not found."); - } -}elsif($bssplitflag == 102){ - if (-e "$toolpath/perl/tool/TsSplitter.exe"){ - # BS2 - system("wine $toolpath/perl/tool/TsSplitter.exe -EIT -ECM -EMM -OUT \"$outputpath\" -HD -SD1 -SD3 -1SEG -LOGFILE -WAIT2 $outputfile"); - $splitfile = $outputfile; - $splitfile =~ s/\.m2t$/_SD2.m2t/; - if (-e "$splitfile"){ - system("rm -rf $outputfile ; mv $splitfile $outputfile"); - &writelog("digitaltvrecording DEBUG rm -rf $outputfile ; mv $splitfile $outputfile: $?."); - }else{ - &writelog("digitaltvrecording ERROR File not found:$splitfile."); - } - }else{ - &writelog("digitaltvrecording ERROR $toolpath/perl/tool/TsSplitter.exe not found."); - } -}else{ - &writelog("digitaltvrecording DEBUG not split TS.$bssplitflag"); -}# endif #BS1/BS2などのスプリットを - - }else{ # エラー recfriioがありません - &writelog("digitaltvrecording :ERROR :recfriio not found. You must install $toolpath/perl/tool/b25 and $toolpath/perl/tool/recfriio:$errorflag"); - #exit 1; - exit $errorflag; - } -}#end if errorflag -}#end calldigitalrecorder - - Index: trunk/install/perl/digitalradiorecording.pl =================================================================== --- trunk/install/perl/digitalradiorecording.pl (リビジョン 105) +++ (リビジョン ) @@ -1,143 +1,0 @@ -#!/usr/bin/perl -# -# Anime recording system foltia -# http://www.dcc-jpl.com/soft/foltia/ -# -#digitalradiorecording.pl -# IPサイマルラジオ「radiko」を録音する。 -# -#usage digitalradiorecording.pl stationname length(sec) filename -#引数 -#stationname : radikoの使う曲識別子 例:文化放送 QRR [必須項目] -#length(sec) :録画秒数 [必須項目] -#filename :出力ファイル名 [必須項目] -# -# DCC-JPL Japan/foltia project -# -# - -$path = $0; -$path =~ s/digitalradiorecording.pl$//i; -if ($path ne "./"){ -push( @INC, "$path"); -} - -#tvConfig.pl ------------------------------- -$extendrecendsec = 10; #recording end second. -#$startupsleeptime = 52; #process wait(MAX60sec) -$startupsleeptime = 57; #process wait(MAX60sec) -#------------------------------- - -require 'foltialib.pl'; - -# &writelog("digitalradiorecording.pl: DEBUG $ARGV[0] $ARGV[1] "); - - -#準備 -&prepare; - - -&calldigitalrecorder; - -# &writelog("digitaldigitalradiorecording:RECEND:$bandtype $recch $lengthsec $stationid $sleeptype $filename $tid $countno $unittype"); - -# -- これ以下サブルーチン ---------------------------- - - -sub prepare{ - -#引数エラー処理 -$stationname = $ARGV[0] ; -$lengthsec = $ARGV[1] ; -$filename = $ARGV[2] ; - - -if (($stationname eq "" ) || ($lengthsec eq "") || ($filename eq "")){ - print "usage digitalradiorecording.pl stationname length(sec) filename\n"; - exit; -} - -#my $intval = $recch % 10; # 0〜9 sec -my $intval = 0; -my $startupsleep = $startupsleeptime - $intval; # 18〜27 sec -$reclengthsec = $lengthsec + (60 - $startupsleep) + 10; # - -if ( $sleeptype ne "N"){ - &writelog("digitalradiorecording: DEBUG SLEEP $startupsleeptime:$intval:$startupsleep:$reclengthsec"); - sleep ( $startupsleep); - #2008/08/12_06:39:00 digitalradiorecording: DEBUG SLEEP 17:23:-6:367 -}else{ - &writelog("digitalradiorecording: DEBUG RAPID START"); -} - -$outputpath = "$recfolderpath"."/"; - -if ($countno eq "0"){ - $outputfile = $outputpath.$tid."--"; -}else{ - $outputfile = $outputpath.$tid."-".$countno."-"; -} -#2番目以降のクリップでファイル名指定があったら - if ($filename ne ""){ - - $outputfile = $filename ; - $outputfile = &filenameinjectioncheck($outputfile); - $outputfilewithoutpath = $outputfile ; - $outputfile = $outputpath.$outputfile ; - &writelog("digitalradiorecording: DEBUG FILENAME ne null \$outputfile $outputfile "); - }else{ - $outputfile .= strftime("%Y%m%d-%H%M", localtime(time + 60)); - chomp($outputfile); - $outputfile .= ".aac"; - $outputfilewithoutpath = $outputfile ; - &writelog("digitalradiorecording: DEBUG FILENAME is null \$outputfile $outputfile "); - } - - -@wday_name = ("Sun","Mon","Tue","Wed","Thu","Fri","Sat"); -$sleepcounter = 0; -$cmd=""; - -#二重録りなど既に同名ファイルがあったら中断 -if ( -e "$outputfile" ){ - if ( -s "$outputfile" ){ - &writelog("digitalradiorecording :ABORT :recfile $outputfile exist."); - exit 1; - } -} - -}#end prepare - - - -sub calldigitalrecorder{ - -#if (-e "$toolpath/perl/tool/ffmpeg"){ -#2010/4/7 radikoに対策されたのでffmpeg直接受信できなくなった -#./ffmpeg -i rtmp://radiko.smartstream.ne.jp:1935/QRR/_defInst_/simul-stream -t 180 -acodec copy ~/php/tv/qrr.aac -#&writelog("digitalradiorecording :DEBUG :$toolpath/perl/tool/ffmpeg -y -i rtmp://radiko.smartstream.ne.jp:1935/$stationname/_defInst_/simul-stream -t $reclengthsec -acodec copy $outputfile."); -#system("$toolpath/perl/tool/ffmpeg -y -i rtmp://radiko.smartstream.ne.jp:1935/$stationname/_defInst_/simul-stream -t $reclengthsec -acodec copy $outputfile"); - -if (-e "$toolpath/perl/tool/rtmpdump"){ -#./rtmpdump -y "simul-stream" -n "radiko.smartstream.ne.jp" -c 1935 -p "http://radiko.jp/player/player.html#QRR" -a "QRR/_defInst_" -f "WIN 10,0,45,2" -v -B 180 -o joqr.flv - -&writelog("digitalradiorecording :DEBUG :$toolpath/perl/tool/rtmpdump -r \"rtmpe://radiko.smartstream.ne.jp:1935/$stationname/_defInst_/simul-stream\" -s \"http://radiko.jp/player/player.html#${stationname}\" -f \"WIN 10,0,45,2\" -v -B $reclengthsec -o ${outputfile}.flv"); - -#system("$toolpath/perl/tool/rtmpdump -y \"simul-stream\" -n \"radiko.smartstream.ne.jp\" -c 1935 -p \"http://radiko.jp/player/player.html#${stationname}\" -a \"$stationname/_defInst_\" -f \"WIN 10,0,45,2\" -v -B $reclengthsec -o ${outputfile}.flv"); -system("$toolpath/perl/tool/rtmpdump -r \"rtmpe://radiko.smartstream.ne.jp:1935/$stationname/_defInst_/simul-stream\" -s \"http://radiko.jp/player/player.html#${stationname}\" -f \"WIN 10,0,45,2\" -v -B $reclengthsec -o ${outputfile}.flv"); - -&writelog("digitalradiorecording :DEBUG :ffmpeg -y -i ${outputfile}.flv -vn -acodec copy $outputfile"); - -system("ffmpeg -y -i ${outputfile}.flv -vn -acodec copy $outputfile"); - -unlink("${outputfile}.flv"); -}else{ - &writelog("digitalradiorecording :ABORT :File not found,recordable ffmpeg on $toolpath/perl/tool/ffmpeg. Show http://d.hatena.ne.jp/nazodane/20100315/1268646192 "); - exit 1; -} - - - -}# end sub calldigitalrecorder - - Index: trunk/install/perl/ipodtranscode.pl =================================================================== --- trunk/install/perl/ipodtranscode.pl (リビジョン 125) +++ (リビジョン ) @@ -1,553 +1,0 @@ -#!/usr/bin/perl -#usage ipodtranscode.pl -# -# Anime recording system foltia -# http://www.dcc-jpl.com/soft/foltia/ -# -# iPod MPEG4/H.264トラコン -# ffmpegを呼び出して変換 -# -# DCC-JPL Japan/foltia project -# - -use DBI; -use DBD::Pg; -use DBD::SQLite; -use Jcode; - -$path = $0; -$path =~ s/ipodtranscode.pl$//i; -if ($path ne "./"){ -push( @INC, "$path"); -} -require "foltialib.pl"; - - -# 二重起動の確認! -$processes = &processfind("ipodtranscode.pl"); -#$processes = $processes + &processfind("ffmpeg"); - -if ($processes > 1 ){ -&writelog("ipodtranscode processes exist. exit:"); -exit; -}else{ -#&writelog("ipodtranscode.pl Normal launch."); -} - -#DB初期化 -$dbh = DBI->connect($DSN,$DBUser,$DBPass) ||die $DBI::error;; - -# タイトル取得 -#トラコンフラグがたっていてステータス50以上150未満のファイルを古い順にひとつ探す -# 数数える -#$DBQuery = "SELECT count(*) FROM foltia_subtitle, foltia_program, foltia_m2pfiles -#WHERE filestatus >= $FILESTATUSRECEND AND filestatus < $FILESTATUSTRANSCODECOMPLETE AND foltia_program.tid = foltia_subtitle.TID AND foltia_program.PSP = 1 AND foltia_m2pfiles.m2pfilename = foltia_subtitle.m2pfilename "; -#$sth = $dbh->prepare($DBQuery); -#$sth->execute(); -#@titlecount= $sth->fetchrow_array; -&writelog("ipodtranscode starting up."); - -$counttranscodefiles = &counttranscodefiles(); -if ($counttranscodefiles == 0){ - &writelog("ipodtranscode No MPEG2 files to transcode."); - exit; -} -sleep 30; - -while ($counttranscodefiles >= 1){ - $sth = $dbh->prepare($stmt{'ipodtranscode.1'}); - $sth->execute($FILESTATUSRECEND, $FILESTATUSTRANSCODECOMPLETE, ); -@dbparam = $sth->fetchrow_array; -#print "$dbparam[0],$dbparam[1],$dbparam[2],$dbparam[3],$dbparam[4],$dbparam[5]\n"; -#&writelog("ipodtranscode DEBUG $DBQuery"); -&writelog("ipodtranscode DEBUG $dbparam[0],$dbparam[1],$dbparam[2],$dbparam[3],$dbparam[4],$dbparam[5]"); -$pid = $dbparam[0]; -$tid = $dbparam[1]; -$inputmpeg2 = $recfolderpath."/".$dbparam[2]; # path付き -$mpeg2filename = $dbparam[2]; # pathなし -$filestatus = $dbparam[3]; -$aspect = $dbparam[4];# 16,1 (超額縁),4,3 -$countno = $dbparam[5]; -$mp4filenamestring = &mp4filenamestringbuild($pid); - -if (-e $inputmpeg2){#MPEG2ファイルが存在していれば - -&writelog("ipodtranscode DEBUG mp4filenamestring $mp4filenamestring"); -#展開ディレクトリ作成 -$pspdirname = &makemp4dir($tid); -$mp4outdir = $pspdirname ; -# 実際のトラコン -# タイトル取得 -if ($pid ne ""){ - $sth = $dbh->prepare($stmt{'ipodtranscode.2'}); - $sth->execute($pid); -@programtitle = $sth->fetchrow_array; -$programtitle[0] =~ s/\"/\\"/gi; -$programtitle[2] =~ s/\"/\\"/gi; - - if ($pid > 0){ - if ($programtitle[1] ne ""){ - $movietitle = " -title \"$programtitle[0] 第$programtitle[1]話 $programtitle[2]\" "; - $movietitleeuc = " -t \"$programtitle[0] 第$programtitle[1]話 $programtitle[2]\" "; - }else{ - $movietitle = " -title \"$programtitle[0] $programtitle[2]\" "; - $movietitleeuc = " -t \"$programtitle[0] $programtitle[2]\" "; - } - }elsif($pid < 0){ - #EPG - $movietitle = " -title \"$programtitle[2]\" "; - $movietitleeuc = " -t \"$programtitle[2]\" "; - }else{# 0 - #空白 - $movietitle = ""; - $movietitleeuc = ""; - } -#Jcode::convert(\$movietitle,'utf8');# Title入れるとiTunes7.0.2がクラッシュする - $movietitle = ""; - $movietitleeuc = ""; - -} - -if ($filestatus <= $FILESTATUSRECEND){ -} - -if ($filestatus <= $FILESTATUSWAITINGCAPTURE){ -#なにもしない -} - -if ($filestatus <= $FILESTATUSCAPTURE){ -#unlink -# Starlight breaker向けキャプチャ画像作成 -if (-e "$toolpath/perl/captureimagemaker.pl"){ - &writelog("ipodtranscode Call captureimagemaker $mpeg2filename"); -&changefilestatus($pid,$FILESTATUSCAPTURE); - system ("$toolpath/perl/captureimagemaker.pl $mpeg2filename"); -&changefilestatus($pid,$FILESTATUSCAPEND); -} -} - -if ($filestatus <= $FILESTATUSCAPEND){ -# サムネイル作る -&makethumbnail(); -&changefilestatus($pid,$FILESTATUSTHMCREATE); -} - -if ($filestatus <= $FILESTATUSWAITINGTRANSCODE){ -} - -$filenamebody = $inputmpeg2 ; -$filenamebody =~ s/.m2t$|.ts$|.m2p$|.mpg$|.aac$//gi; - -#デジタルかアナログか -if ($inputmpeg2 =~ /m2t$|ts$|aac$/i){ - -if ($filestatus <= $FILESTATUSTRANSCODETSSPLITTING){ - unlink("${filenamebody}_tss.m2t"); - unlink("${filenamebody}_HD.m2t"); -} -if ($filestatus <= $FILESTATUSTRANSCODEFFMPEG){ - unlink("$filenamebody.264"); - # H.264出力 - $trcnmpegfile = $inputmpeg2 ; - # アスペクト比 - if ($aspect == 1){#超額縁 - $cropopt = " -croptop 150 -cropbottom 150 -cropleft 200 -cropright 200 "; - }elsif($aspect == 4){#SD - $cropopt = " -croptop 6 -cropbottom 6 -cropleft 8 -cropright 8 "; - }else{#16:9 - $cropopt = " -croptop 6 -cropbottom 6 -cropleft 8 -cropright 8 "; - } - # クオリティごとに - if (($trconqty eq "")||($trconqty == 1)){ - $ffmpegencopt = " -threads 0 -s 360x202 -deinterlace -r 24.00 -vcodec libx264 -g 300 -b 330000 -level 13 -loop 1 -sc_threshold 60 -partp4x4 1 -rc_eq 'blurCplx^(1-qComp)' -refs 3 -maxrate 700000 -async 50 -f h264 $filenamebody.264"; - }elsif($trconqty == 2){ -# $ffmpegencopt = " -s 480x272 -deinterlace -r 29.97 -vcodec libx264 -g 300 -b 400000 -level 13 -loop 1 -sc_threshold 60 -partp4x4 1 -rc_eq 'blurCplx^(1-qComp)' -refs 3 -maxrate 700000 -async 50 -f h264 $filenamebody.264"; -# for ffmpeg 0.5 or later - $ffmpegencopt = " -threads 0 -s 480x272 -deinterlace -r 29.97 -vcodec libx264 -vpre default -g 300 -b 400000 -level 13 -sc_threshold 60 -rc_eq 'blurCplx^(1-qComp)' -refs 3 -maxrate 700000 -async 50 -f h264 $filenamebody.264"; - }elsif($trconqty == 3){#640x352 -# $ffmpegencopt = " -s 640x352 -deinterlace -r 29.97 -vcodec libx264 -g 100 -b 600000 -level 13 -loop 1 -sc_threshold 60 -partp4x4 1 -rc_eq 'blurCplx^(1-qComp)' -refs 3 -maxrate 700000 -async 50 -f h264 $filenamebody.264"; -# for ffmpeg 0.5 or later - $ffmpegencopt = " -threads 0 -s 640x352 -deinterlace -r 29.97 -vcodec libx264 -vpre default -g 100 -b 600000 -level 13 -sc_threshold 60 -rc_eq 'blurCplx^(1-qComp)' -refs 3 -maxrate 700000 -async 50 -f h264 $filenamebody.264"; - } - &changefilestatus($pid,$FILESTATUSTRANSCODEFFMPEG); -# &writelog("ipodtranscode ffmpeg $filenamebody.264"); -# system ("ffmpeg -y -i $trcnmpegfile $cropopt $ffmpegencopt"); -#まずTsSplitする →ワンセグをソースにしてしまわないように - if (! -e "$filenamebody.264"){ - &changefilestatus($pid,$FILESTATUSTRANSCODETSSPLITTING); - unlink("${filenamebody}_tss.m2t"); - unlink("${filenamebody}_HD.m2t"); - if (-e "$toolpath/perl/tool/tss.py"){ - &writelog("ipodtranscode tss $inputmpeg2"); - system("$toolpath/perl/tool/tss.py $inputmpeg2"); - }else{ - # TsSplit -# &writelog("ipodtranscode TsSplitter $inputmpeg2"); -# system("wine $toolpath/perl/tool/TsSplitter.exe -EIT -ECM -EMM -SD -1SEG -WAIT2 $inputmpeg2"); - } - if(-e "${filenamebody}_tss.m2t"){ - $trcnmpegfile = "${filenamebody}_tss.m2t"; - }elsif (-e "${filenamebody}_HD.m2t"){ - $trcnmpegfile = "${filenamebody}_HD.m2t"; - }else{ - &writelog("ipodtranscode ERR NOT Exist ${filenamebody}_HD.m2t"); - $trcnmpegfile = $inputmpeg2 ; - } - #Splitファイルの確認 - $trcnmpegfile = &validationsplitfile($inputmpeg2,$trcnmpegfile); - #tss.pyに失敗してたなら強制的にWINEでTsSplit.exe - if($trcnmpegfile eq $inputmpeg2){ - - # TsSplit - &writelog("ipodtranscode WINE TsSplitter.exe $inputmpeg2"); - system("wine $toolpath/perl/tool/TsSplitter.exe -EIT -ECM -EMM -SD -1SEG -WAIT2 $inputmpeg2"); - if (-e "${filenamebody}_HD.m2t"){ - $trcnmpegfile = "${filenamebody}_HD.m2t"; - #Splitファイルの確認 - $trcnmpegfile = &validationsplitfile($inputmpeg2,$trcnmpegfile); -# if($trcnmpegfile ne $inputmpeg2){ -# &changefilestatus($pid,$FILESTATUSTRANSCODEFFMPEG); -# &writelog("ipodtranscode ffmpeg retry ; WINE TsSplitter.exe $trcnmpegfile"); -# system ("ffmpeg -y -i $trcnmpegfile $cropopt $ffmpegencopt"); -# }else{ -# &writelog("ipodtranscode WINE TsSplit.exe fail"); -# } - }else{ - &writelog("ipodtranscode WINE TsSplitter.exe ;Not exist ${filenamebody}_HD.m2t"); - }#endif -e ${filenamebody}_HD.m2t - - }#endif $trcnmpegfile eq $inputmpeg2 - - - #再ffmpeg - &changefilestatus($pid,$FILESTATUSTRANSCODEFFMPEG); - &writelog("ipodtranscode ffmpeg retry $filenamebody.264"); - system ("ffmpeg -y -i $trcnmpegfile $cropopt $ffmpegencopt"); - } - #もしエラーになったらcropやめる - if (! -e "$filenamebody.264"){ - #再ffmpeg - &changefilestatus($pid,$FILESTATUSTRANSCODEFFMPEG); - &writelog("ipodtranscode ffmpeg retry no crop $filenamebody.264"); - system ("ffmpeg -y -i $trcnmpegfile $ffmpegencopt"); - } - #強制的にWINEでTsSplit.exe - if (! -e "$filenamebody.264"){ - } - #それでもエラーならsplitしてないファイルをターゲットに - if (! -e "$filenamebody.264"){ - #再ffmpeg - &changefilestatus($pid,$FILESTATUSTRANSCODEFFMPEG); - &writelog("ipodtranscode ffmpeg retry No splited originalTS file $filenamebody.264"); - system ("ffmpeg -y -i $inputmpeg2 $ffmpegencopt"); - } -} -if ($filestatus <= $FILESTATUSTRANSCODEWAVE){ - # WAVE出力 - unlink("${filenamebody}.wav"); - &changefilestatus($pid,$FILESTATUSTRANSCODEWAVE); - &writelog("ipodtranscode mplayer $filenamebody.wav"); - system ("mplayer $trcnmpegfile -vc null -vo null -ao pcm:file=$filenamebody.wav:fast"); - -} -if ($filestatus <= $FILESTATUSTRANSCODEAAC){ - # AAC変換 - unlink("${filenamebody}.aac"); - &changefilestatus($pid,$FILESTATUSTRANSCODEAAC); - if (-e "$toolpath/perl/tool/neroAacEnc"){ - if (-e "$filenamebody.wav"){ - &writelog("ipodtranscode neroAacEnc $filenamebody.wav"); - system ("$toolpath/perl/tool/neroAacEnc -br 128000 -if $filenamebody.wav -of $filenamebody.aac"); - }else{ - &writelog("ipodtranscode ERR Not Found $filenamebody.wav"); - } - }else{ - #print "DEBUG $toolpath/perl/tool/neroAacEnc\n\n"; - &writelog("ipodtranscode faac $filenamebody.wav"); - system ("faac -b 128 -o $filenamebody.aac $filenamebody.wav "); - } - -} -if ($filestatus <= $FILESTATUSTRANSCODEMP4BOX){ - -unlink("${filenamebody}.base.mp4"); - -#デジタルラジオなら -if ($inputmpeg2 =~ /aac$/i){ - if (-e "$toolpath/perl/tool/MP4Box"){ - &writelog("ipodtranscode MP4Box $filenamebody"); - system ("cd $recfolderpath ;$toolpath/perl/tool/MP4Box -add $filenamebody.aac -new $filenamebody.base.mp4"); - $exit_value = $? >> 8; - $signal_num = $? & 127; - $dumped_core = $? & 128; - &writelog("ipodtranscode DEBUG MP4Box -add $filenamebody.aac -new $filenamebody.base.mp4:$exit_value:$signal_num:$dumped_core"); - }else{ - &writelog("ipodtranscode WARN; Pls. install $toolpath/perl/tool/MP4Box"); - } -}else{ - # MP4ビルド - if (-e "$toolpath/perl/tool/MP4Box"){ - &changefilestatus($pid,$FILESTATUSTRANSCODEMP4BOX); - &writelog("ipodtranscode MP4Box $filenamebody"); - system ("cd $recfolderpath ;$toolpath/perl/tool/MP4Box -fps 29.97 -add $filenamebody.264 -new $filenamebody.base.mp4"); - $exit_value = $? >> 8; - $signal_num = $? & 127; - $dumped_core = $? & 128; - &writelog("ipodtranscode DEBUG MP4Box -fps 29.97 -add $filenamebody.264 -new $filenamebody.base.mp4:$exit_value:$signal_num:$dumped_core"); - if (-e "$filenamebody.base.mp4"){ - system ("cd $recfolderpath ;$toolpath/perl/tool/MP4Box -add $filenamebody.aac $filenamebody.base.mp4"); - $exit_value = $? >> 8; - $signal_num = $? & 127; - $dumped_core = $? & 128; - &writelog("ipodtranscode DEBUG MP4Box -add $filenamebody.aac:$exit_value:$signal_num:$dumped_core"); - }else{ - $filelist = `ls -lhtr $recfolderpath/${filenamebody}*`; - $debugenv = `env`; - &writelog("ipodtranscode ERR File not exist.$debugenv.$filelist ;$filenamebody.base.mp4;$filelist;cd $recfolderpath ;$toolpath/perl/tool/MP4Box -fps 29.97 -add $filenamebody.264 -new $filenamebody.base.mp4"); - } - }else{ - &writelog("ipodtranscode WARN; Pls. install $toolpath/perl/tool/MP4Box"); - } -unlink("$filenamebody.aac"); -}#endif #デジタルラジオなら - -#} - -#if ($filestatus <= $FILESTATUSTRANSCODEATOM){ - if (-e "$toolpath/perl/tool/MP4Box"){ - # iPodヘッダ付加 -# &changefilestatus($pid,$FILESTATUSTRANSCODEATOM); - &writelog("ipodtranscode ATOM $filenamebody"); - #system ("/usr/local/bin/ffmpeg -y -i $filenamebody.base.mp4 -vcodec copy -acodec copy -f ipod ${mp4outdir}MAQ${mp4filenamestring}.MP4"); -# system ("cd $recfolderpath ; MP4Box -ipod $filenamebody.base.mp4"); - system ("cd $recfolderpath ; $toolpath/perl/tool/MP4Box -ipod $filenamebody.base.mp4"); - $exit_value = $? >> 8; - $signal_num = $? & 127; - $dumped_core = $? & 128; - &writelog("ipodtranscode DEBUG MP4Box -ipod $filenamebody.base.mp4:$exit_value:$signal_num:$dumped_core"); - if (-e "$filenamebody.base.mp4"){ - unlink("${mp4outdir}MAQ${mp4filenamestring}.MP4"); - system("mv $filenamebody.base.mp4 ${mp4outdir}MAQ${mp4filenamestring}.MP4"); - &writelog("ipodtranscode mv $filenamebody.base.mp4 ${mp4outdir}MAQ${mp4filenamestring}.MP4"); - }else{ - &writelog("ipodtranscode ERR $filenamebody.base.mp4 Not found."); - } - # ipodtranscode mv /home/foltia/php/tv/1329-21-20080829-0017.base.mp4 /home/foltia/php/tv/1329.localized/mp4/MAQ-/home/foltia/php/tv/1329-21-20080829-0017.MP4 - }else{ - &writelog("ipodtranscode WARN; Pls. install $toolpath/perl/tool/MP4Box"); - } -} -if ($filestatus <= $FILESTATUSTRANSCODECOMPLETE){ - if (-e "${mp4outdir}MAQ${mp4filenamestring}.MP4"){ - # 中間ファイル消す - &changefilestatus($pid,$FILESTATUSTRANSCODECOMPLETE); - &updatemp4file(); - }else{ - &writelog("ipodtranscode ERR ; Fail.Giving up! MAQ${mp4filenamestring}.MP4"); - &changefilestatus($pid,999); - } - unlink("${filenamebody}_HD.m2t"); -# ConfigによってTSファイルは常にsplitした状態にするかどうか選択 -# B25失敗したときにここが走るとファイルぶっ壊れるので検証を入れる -# -# if (-e "${filenamebody}_tss.m2t"){ -# unlink("${filenamebody}.m2t"); -# unless (rename "${filenamebody}_tss.m2t", "${filenamebody}.m2t") { -# &writelog("ipodtranscode WARNING RENAME FAILED ${filenamebody}_tss.m2t ${filenamebody}.m2t"); -# }else{ -# -# } -# } - unlink("${filenamebody}_tss.m2t"); - unlink("$filenamebody.264"); - unlink("$filenamebody.wav"); - unlink("$filenamebody.base.mp4"); - -} - -}else{ #デジタルかアナログか - #print "MPEG2\n"; - # アスペクト比 - if ($aspect == 16){ - $cropopt = " -croptop 70 -cropbottom 60 -cropleft 8 -cropright 14 -aspect 16:9 "; - }else{ - $cropopt = " -croptop 8 -cropbottom 8 -cropleft 8 -cropright 14 "; - } -# クオリティごとに -if (($trconqty eq "")||($trconqty == 1)){ -#$encodeoption = "-y -i $inputmpeg2 -vcodec xvid $cropopt -s 320x240 -b 300 -bt 128 -r 14.985 -bufsize 192 -maxrate 512 -minrate 0 -deinterlace -acodec aac -ab 128 -ar 24000 -ac 2 $movietitle ${mp4outdir}M4V${mp4filenamestring}.MP4"; -$mp4file = "${mp4outdir}M4V${mp4filenamestring}.MP4"; -$encodeoption = "-y -i $inputmpeg2 vcodec libxvid $cropopt -s 320x240 -b 300 -bt 128 -r 14.985 -deinterlace -acodec libfaac -f ipod ${mp4outdir}M4V${mp4filenamestring}.MP4"; -#time ffmpeg -y -i /home/foltia/php/tv/trcntest/nanoha-As-op.mpg -vcodec libxvid -croptop 8 -cropbottom 8 -cropleft 8 -cropright 14 -s 320x240 -b 300 -bt 128 -r 14.985 -deinterlace -acodec libfaac -f ipod M4V-Nanoha-As-OP.MP4 -# 32sec -# 2.1MB -}elsif($trconqty == 2){ -#$encodeoption = "-y -i $inputmpeg2 -target ipod -profile 51 -level 30 $cropopt -s 320x240 -b 300 -r 24 -acodec aac -ar 32000 -ac 2 $movietitle ${mp4outdir}MAQ${mp4filenamestring}.MP4"; -$mp4file = "${mp4outdir}MAQ${mp4filenamestring}.MP4"; -$encodeoption = "-y -i $inputmpeg2 -vcodec libx264 -croptop 8 $cropopt -s 320x240 -b 300 -bt 128 -r 24 -deinterlace -acodec libfaac -f ipod ${mp4outdir}MAQ${mp4filenamestring}.MP4"; -#time ffmpeg -y -i /home/foltia/php/tv/trcntest/nanoha-As-op.mpg -vcodec libx264 -croptop 8 -cropbottom 8 -cropleft 8 -cropright 14 -s 320x240 -b 300 -bt 128 -r 24 -deinterlace -acodec libfaac -f ipod MAQ-Nanoha-As-OP.MP4 -# 2min22sec -# 6.4MB -}elsif($trconqty == 3){ -#$encodeoption = "-y -i $inputmpeg2 -target ipod -profile 51 -level 30 $cropopt -acodec aac -ab 96 -vcodec h264 -maxrate 700 -minrate 0 -deinterlace -b 300 -ar 32000 -mbd 2 -coder 1 -cmp 2 -subcmp 2 -s 320x240 -r 30000/1001 -flags loop -trellis 2 -partitions parti4x4+parti8x8+partp4x4+partp8x8+partb8x8 $movietitle ${mp4outdir}MAQ${mp4filenamestring}.MP4"; -$mp4file = "${mp4outdir}MAQ${mp4filenamestring}.MP4"; -$encodeoption = "-y -i $inputmpeg2 -vcodec libx264 $cropopt -s 320x240 -b 380 -bt 128 -r 29.97 -deinterlace -acodec libfaac -f ipod ${mp4outdir}MAQ${mp4filenamestring}.MP4"; -#time ffmpeg -y -i /home/foltia/php/tv/trcntest/nanoha-As-op.mpg -vcodec libx264 -croptop 8 -cropbottom 8 -cropleft 8 -cropright 14 -s 320x240 -b 380 -bt 128 -r 29.97 -deinterlace -acodec libfaac -f ipod MAQ-Nanoha-As-OP.MP4 -# 2m53.912s -# 7MB -}elsif($trconqty == 4){ -#$encodeoption = "-y -i $inputmpeg2 -target ipod -profile 51 -level 30 $cropopt -s 480x360 -b 400 -r 24 -acodec aac -ar 32000 -ac 2 $movietitle ${mp4outdir}MAQ${mp4filenamestring}.MP4"; -$mp4file = "${mp4outdir}MAQ${mp4filenamestring}.MP4"; -$encodeoption = "-y -i $inputmpeg2 -vcodec libx264 $cropopt -s 640x480 -b 500 -maxrate 700 -bt 128 -r 29.97 -deinterlace -acodec libfaac -f ipod ${mp4outdir}MAQ${mp4filenamestring}.MP4"; -#time ffmpeg -y -i /home/foltia/php/tv/trcntest/nanoha-As-op.mpg -vcodec libx264 -croptop 8 -cropbottom 8 -cropleft 8 -cropright 14 -s 640x480 -b 500 -maxrate 700 -bt 128 -r 29.97 -deinterlace -acodec libfaac -f ipod MAQ-Nanoha-As-OP.MP4 -# 11m0.294s -# 20MB -}elsif($trconqty == 5){ -#$encodeoption = "-y -i $inputmpeg2 -target ipod -profile 51 -level 30 $cropopt -acodec aac -ab 96 -vcodec h264 -maxrate 700 -minrate 0 -deinterlace -b 400 -ar 32000 -mbd 2 -coder 1 -cmp 2 -subcmp 2 -s 480x360 -r 30000/1001 -flags loop -trellis 2 -partitions parti4x4+parti8x8+partp4x4+partp8x8+partb8x8 $movietitle ${mp4outdir}MAQ${mp4filenamestring}.MP4"; -$mp4file = "${mp4outdir}MAQ${mp4filenamestring}.MP4"; -$encodeoption = "-y -i $inputmpeg2 -vcodec libx264 -croptop 8 $cropopt -s 640x480 -b 500 -maxrate 700 -bt 128 -r 29.97 -deinterlace -flags loop -trellis 2 -partitions parti4x4+parti8x8+partp4x4+partp8x8+partb8x8 -acodec libfaac -f ipod ${mp4outdir}MAQ${mp4filenamestring}.MP4"; -#time ffmpeg -y -i /home/foltia/php/tv/trcntest/nanoha-As-op.mpg -vcodec libx264 -croptop 8 -cropbottom 8 -cropleft 8 -cropright 14 -s 640x480 -b 500 -maxrate 700 -bt 128 -r 29.97 -deinterlace -flags loop -trellis 2 -partitions parti4x4+parti8x8+partp4x4+partp8x8+partb8x8 -acodec libfaac -f ipod MAQ-Nanoha-As-OP.MP4 -# 14m14.033s -# 18MB -} - -$encodeoptionlog = $encodeoption; -Jcode::convert(\$encodeoptionlog,'euc'); - -&writelog("ipodtranscode START QTY=$trconqty $encodeoptionlog"); -#print "ffmpeg $encodeoptionlog \n"; -&changefilestatus($pid,$FILESTATUSTRANSCODEFFMPEG); -system ("ffmpeg $encodeoption "); -&writelog("ipodtranscode FFEND $inputmpeg2"); -&changefilestatus($pid,$FILESTATUSTRANSCODECOMPLETE); -#もう要らなくなった #2008/11/14 -#&writelog("ipodtranscode mp4psp -p $mp4file $movietitleeuc"); -#system("/usr/local/bin/mp4psp -p $mp4file '$movietitleeuc' "); -#&writelog("ipodtranscode mp4psp COMPLETE $mp4file "); - -&updatemp4file(); -}#endif #デジタルかアナログか - -$counttranscodefiles = &counttranscodefiles(); -############################ -#一回で終らせるように -#exit; - - -}else{#ファイルがなければ -&writelog("ipodtranscode NO $inputmpeg2 file.Skip."); -}#end if - -}# end while -#残りファイルがゼロなら -&writelog("ipodtranscode ALL COMPLETE"); -exit; - - -#----------------------------------------------------------------------- -sub mp4filenamestringbuild(){ -#ファイル名決定 -#1329-19-20080814-2337.m2t -my @mpegfilename = split(/\./,$dbparam[2]) ; -my $pspfilname = "-".$mpegfilename[0] ; -return("$pspfilname"); -}#end sub mp4filenamestringbuild - - -sub makethumbnail(){ -#サムネール -my $outputfilename = $inputmpeg2 ;#フルパス -my $thmfilename = "MAQ${mp4filenamestring}.THM"; -&writelog("ipodtranscode DEBUG thmfilename $thmfilename"); - -#system ("mplayer -ss 00:01:20 -vo jpeg:outdir=$pspdirname -ao null -sstep 1 -frames 3 -v 3 $outputfilename"); -# -#&writelog("ipodtranscode DEBUG mplayer -ss 00:01:20 -vo jpeg:outdir=$pspdirname -ao null -sstep 1 -frames 3 -v 3 $outputfilename"); -if($outputfilename =~ /.m2t$/){ -#ハイビジョンTS -system ("mplayer -ss 00:01:20 -vo jpeg:outdir=$pspdirname -ao null -vf framestep=300step,scale=160:90,expand=160:120 -frames 1 $outputfilename"); -&writelog("ipodtranscode DEBUG mplayer -ss 00:01:20 -vo jpeg:outdir=$pspdirname -ao null -vf framestep=300step,scale=160:90,expand=160:120 -frames 1 $outputfilename"); -}else{ -#アナログ -system ("mplayer -ss 00:01:20 -vo jpeg:outdir=$pspdirname -ao null -vf framestep=300step,scale=165:126,crop=160:120 -frames 1 $outputfilename"); -&writelog("ipodtranscode DEBUG mplayer -ss 00:01:20 -vo jpeg:outdir=$pspdirname -ao null -vf framestep=300step,scale=165:126,crop=160:120 -frames 1 $outputfilename"); -} -#if (-e "$pspdirname/$thmfilename"){ -# $timestamp = strftime("%Y%m%d-%H%M%S", localtime); -#chomp $timestamp; -# system("convert -crop 160x120+1+3 -resize 165x126\! $pspdirname/00000002.jpg $pspdirname/$thmfilename".$timestamp.".THM"); -#}else{ -# system("convert -crop 160x120+1+3 -resize 165x126\! $pspdirname/00000002.jpg $pspdirname/$thmfilename"); -#} -#&writelog("ipodtranscode DEBUG convert -crop 160x120+1+3 -resize 165x126\! $pspdirname/00000002.jpg $pspdirname/$thmfilename"); - -#system("rm -rf $pspdirname/0000000*.jpg "); -#&writelog("ipodtranscode DEBUG rm -rf $pspdirname/0000000*.jpg"); -system("mv $pspdirname/00000001.jpg $pspdirname/$thmfilename"); - -}#endsub makethumbnail - -sub updatemp4file(){ -my $mp4filename = "MAQ${mp4filenamestring}.MP4"; - -if (-e "${mp4outdir}MAQ${mp4filenamestring}.MP4"){ -# MP4ファイル名をPIDレコードに書き込み - $sth = $dbh->prepare($stmt{'ipodtranscode.updatemp4file.1'}); - $sth->execute($mp4filename, $pid); - &writelog("ipodtranscode UPDATEsubtitleDB $stmt{'ipodtranscode.updatemp4file.1'}"); - -# MP4ファイル名をfoltia_mp4files挿入 - $sth = $dbh->prepare($stmt{'ipodtranscode.updatemp4file.2'}); - $sth->execute($tid, $mp4filename); - &writelog("ipodtranscode UPDATEmp4DB $stmt{'ipodtranscode.updatemp4file.2'}"); - -&changefilestatus($pid,$FILESTATUSALLCOMPLETE); -}else{ -&writelog("ipodtranscode ERR MP4 NOT EXIST $pid/$mp4filename"); -} - - -}#updatemp4file - -sub counttranscodefiles(){ - $sth = $dbh->prepare($stmt{'ipodtranscode.counttranscodefiles.1'}); - $sth->execute($FILESTATUSRECEND, $FILESTATUSTRANSCODECOMPLETE); -my @titlecount= $sth->fetchrow_array; - -return ($titlecount[0]); - - -}#end sub counttranscodefiles - - -sub validationsplitfile{ -my $inputmpeg2 = $_[0]; -my $trcnmpegfile = $_[1]; - - #Split結果確認 - my $filesizeoriginal = -s $inputmpeg2 ; - my $filesizesplit = -s $trcnmpegfile; - my $validation = 0; - if ($filesizesplit > 0){ - $validation = $filesizeoriginal / $filesizesplit ; - if ($validation > 2 ){ - #print "Fail split may be fail.\n"; - &writelog("ipodtranscode ERR File split may be fail: $filesizeoriginal:$filesizesplit"); - $trcnmpegfile = $inputmpeg2 ; - unlink("${filenamebody}_tss.m2t"); - unlink("${filenamebody}_HD.m2tt"); - return ($trcnmpegfile); - }else{ - #print "Fail split may be good.\n"; - return ($trcnmpegfile); - } - }else{ - #Fail - &writelog("ipodtranscode ERR File split may be fail: $filesizeoriginal:$filesizesplit"); - $trcnmpegfile = $inputmpeg2 ; - unlink("${filenamebody}_tss.m2t"); - unlink("${filenamebody}_HD.m2tt"); - return ($trcnmpegfile); - } -}#end sub validationsplitfile - Index: trunk/install/perl/record-v4l2.pl =================================================================== --- trunk/install/perl/record-v4l2.pl (リビジョン 83) +++ (リビジョン ) @@ -1,1617 +1,0 @@ -#!/usr/bin/perl -# record-v4l2.pl created by James A. Pattie 04/10/2003 -# Copyright 2003-2004 -# Purpose: to record from the specified channel for the specified amount -# of time to the video OutputDirectory under the channel-start time name as video.mpg. - -# -# You can always get the latest version of this script at -# http://www.pcxperience.org/ -# - -# 20071016 Patched by DCC-JPL Japan / foltia project / http://www.dcc-jpl.com/soft/foltia/ - -# 20030425 - 1.4 - Added devfs support based upon patch submitted by -# Jonathan Kolb -# 20030426 - 1.5 - Imported the ptune.pl functionality -# 20030426 - 1.6 - moved -F -> -L, -F now lets you specify the frequency to tune to. -# 20030427 - 1.7 - renamed to record_ivtv.pl per Kevin's request. Added -R option. -# 20030430 - 1.8 - fixing some comparisons that needed to be strings, etc. -# 20030504 - 1.9 - Migrating to Video::ivtv for video resolution support. -# 20030505 - 1.10- Replaced open w/ sysopen but it doesn't make a difference. -# Starting to replace the Standard code w/ Video::ivtv methods. -# Added the version numbers that I require to the use statements. -# 20030507 - 1.11- Migrated to using get/setFrequency from Video::ivtv 0.03. -# 20030510 - 1.12- Migrated to using get/setInput from Video::ivtv 0.04. Moved to using -# the exported method names rather than Video::ivtv::method(). -# Converted to using enumerateStandard(). -# Fixed the condition where switching Video Standards will most likely -# not get the correct channel and so would switch back with channel = 0 -# which is invalid. In this case I store the previous frequency, do the -# channel change but signal to restore the previous frequency on cleanup. -# Converted to using enumerateInput(). -# 20030512 - 1.13- Added initial support for setting the bitrate/bitrate_peak values. -# 20030513 - 1.14- Tweaked the bitrate values to be closer to real DVD bitrates. -# Added support for the .ivtvrc config file and User Profiles. -# 20030516 - 1.15- Updated to the OO interface that Video::ivtv 0.06 now requires. -# Cleaned up a lot of the global variables into a settings hash. -# Made the -S command add any config items you specified on the command line -# that were not in the Profile being updated. This way you can add new items. -# Made the config file work from a mapping hash so that we can easily add/remove -# config items in the future. -# 20030518 - 1.16- Fixed a Frequency bug that happened when changing Video Standards and the -# Frequency came from a user specified Profile. -# 20030519 - 1.17- Adding the rest of the Codec related options to the config file / defaults. -# Switched to using Getopt::Long. You can specify all config file options at -# least by a --long version and still by the original -X command option. -# Cleaned up the option parsing code to take advantage of the mappings hash. -# 20030520 - 1.18- Fixing the handling of the Profile command line option. -# 20030524 - 1.19- Cleaned up the output for -L/--list-freqtable. Changed --list -> --list-freqtable. -# Added support to detect the v4l2 driver in use and disable the ivtv "enhancements" -# if driver != "ivtv". -# Renamed to record-v4l2.pl to reflect the ability of this program to record from any -# v4l2 device but with special support for the ivtv driver. -# 20030524 - 1.20- Improving the Ctrl-C handling (cleanup before dying). It may take a second or two -# before the program exits, but it should exit after resetting anything it changed, unless -# you had specified not to reset the card. -# Allow layering of profiles by calling -P/--profile multiple times. Each profile will -# be layered over the last. You will not be able to create/update a profile if you -# specify more than one though. -# Fixed a bug that would cause a parameter from the profile to be set n times, where n was -# the number of characters in the mapping string that consisted of the single letter | and -# the long command option name. Ex: Channel has 'c|channel' so the Channel value was being -# set 9 times instead of just the first time if it was in the profile. -# 20030525 - 1.21- Fixed devfsd detection code as it was overriding what came from the config file. -# Adding --no-record option so that we can start to implement the replacement functionality for -# ptune.pl (ie. Set all values and then exit, do not reset the card and do not capture) -# 20030607 - 1.22- Adding --directory-format and --date-format options so that the user can specify the -# naming convention to use when specifying the directory the output file should be put in. -# Tweaked some of the defaults. -# Create the config file if it doesn't exist, regardless of the --save flag being specified. -# Added method error() to output an error condition that doesn't warrant the whole usage and -# converted all relevant usage() calls to error() calls. -# Added option --debug to dynamically on the fly enable debug output. -# 20030609 - 1.23- Added option --list-channels to display the currently selected frequency tables contents. -# Changed the default output directory to '.'. -# Moved $debug -> $settings{Debug} so it can be stored in the config file. This allows you to -# turn debugging on for only certain profiles, etc. -# Restructured some of the validity tests to only happen as long as we are recording since they -# do not need to be validated when we are not recording. Mainly to do with the output stuff. -# 20030610 - 1.24- Moved the tunerNum variable into the config file: TunerNum -# Added --tuner-num option to dynamically set it. -# 20030614 - 1.25- I now require Video::ivtv 0.09 to make sure everyone is using the version that fixes the known -# reported segfault issues. -# Added freqtable "custom" support so that people using the new feature in ptune-ui.pl and have -# set their default frequency table to be "custom" will just work when they specify channel X, etc. -# I'm now sorting the command line input since otherwise I can't guarantee the order options get -# processed in, but even that is wrong. I need to use Tie::IxHash, but that isn't standard. -# 20030626 - 1.26- Updated to cover the audio -> audio_bitmask changes that Video::ivtv 0.11 implemented to cover -# the ivtv_ioctl_codec structure changes. -# Implemented config file versioning so that I know when the Audio entry needs to be updated in case it -# comes back in a future version of the ivtv_ioctl_codec structure. -# 20030628 - 1.27- Adding --list-inputs and --list-standards to display the available inputs and video standards. -# 20030713 - 1.28- Added code to make sure the codec properties are proper when switching standard to PAL/SECAM. -# Added config options SetMSPMatrix, MSPInput, MSPOutput, MSPSleep to allow the user to specify if they -# want the msp matrix updated any time the Video Standard is changed and to specify what they want programmed. -# Bumping the config file version to 2 to account for the new options. -# 20030715 - 1.29- Adding the missing msp matrix reset code in the reset section. -# Adding codec checks to make sure that they are right for NTSC. -# Made it legal to specify the channel by itself without -c/--channel. -# 20030822 - 1.30- Adding the missing codec value BitrateMode -# 20030927 - 1.31- Adding support to export the settings used as a shell or perl snippet for inclusion -# by scripts working with the recorded video files. -# Changing the default value of StreamType to 14 since that is near DVD quality. -# 20040306 - 1.32- Creating the parent directory if it doesn't exist. -# Making sure to update the InputName if the config specified a number so that input switching works 100%. -# Command line arguments now take precedence over Profile values, should have been this way always. :( -# 20040613 - 1.33- Removing the MSPMatrix related options and code. -# Adding a check for the 0.1.10 driver and not using the GOP_END ioctl if it is not that version. -# Brought it upto speed in regards to the 0.2.00rc1g driver - all known issues are now fixed. -# Added code to determine the version of the ivtv driver being used (0.1.10, 0.2.0, etc.) and -# output it in the video.settings file so we know what driver the capture was done with. - - -use strict; -use Getopt::Long qw(:config no_ignore_case bundling); -use Fcntl; -use Video::Frequencies 0.03; -use Video::ivtv 0.13; -use Config::IniFiles; - -my $version="1.33"; -my $cfgVersion = "3"; -my $cfgVersionStr = "_configVersion_"; # hopefully unique [defaults] value to let me know what version the config file is. -my $ivtvVersion = 0; # used to store the detected version of the driver. Needed for the CaptureLastGOP feature. - -my @capabilities = (); # The cards capabilities - -my %settings = ( - Channel => 4, # default to the ivtv default channel - RecordDuration => 3595, # default to 59 minutes 55 seconds (in seconds) - This lets 2 back to back cron jobs work! - InputNum => 0, # TV-Tuner 1 - InputName => "Tuner 1", - OutputDirectory => ".", - VideoDevice => "/dev/video0", - VideoWidth => "720", # 720x480-fullscreen NTSC - VideoHeight => "480", - VideoStandard => "NTSC-M", # L135 v060406.pl MMM "NTSC", # NTSC, PAL or SECAM - VideoType => "mpeg", # mpeg, yuv - BitrateMode => 0, # 0 = VBR, 1 = CBR - Bitrate => "6500000", - PeakBitrate => "8000000", # peak bitrate - Aspect => 2, - AudioBitmask => 0x00e9, - BFrames => 3, - DNRMode => 0, - DNRSpatial => 0, - DNRTemporal => 0, - DNRType => 0, - Framerate => 0, - FramesPerGOP => 15, - GOPClosure => 1, - Pulldown => 0, - StreamType => 14, # 0 = PS, 1 = TS, 2 = MPEG1, 3 = PES_AV, 5 = PES_V, 7 = PES_A, 10 = DVD, 11 = VCD, 12 = SVCD, 13 = DVD-Special 1, 14 = DVD-Special 2 - OutputFileName => "video.mpg", - FrequencyTable => "ntsc-cable", # default to NTSC_CABLE mapping. - Frequency => "", # user specified frequency. - ResetCardSettings => 1, - ConfigFileName => "$ENV{HOME}/.ivtvrc", - UpdateConfigFile => 0, - UseConfigFile => 0, - UsingIvtvDriver => 1, # default to being able to use the ivtv "enhancements". - DontRecord => 0, # default to always recording data. - DirectoryFormatString => "%I-%c-%d", # format string used to define the sub directory under OutputDirectory - DateTimeFormatString => "+%Y%m%d-%H%M", # format string used to represent the date/time if the user wants it in their DirectoryFormatString - # define the Codec related min/max values - minBitrate => 1, - maxBitrate => 14500000, - minPeakBitrate => 1150, - maxPeakBitrate => 16000000, - # output settings file settings - OutputSettings => 1, # bool 0 or 1 - OutputSettingsName => "video.settings", - OutputSettingsType => "shell", # shell or perl - # other settings - CaptureLastGOP => 1, # default to trying to Capture the Last GOP of the encoder stream. - Debug => 0, - TunerNum => 1, - v4l2DriverVersion => 0, - v4l2DriverVersionStr => "", - v4l2Driver => "", -); - -my $result=""; -my @profileNames=(); # list of user defined sections to work with in the config file. -my %profileOverloads = (); # hash of entries the Profiles overloaded so InputName <-> InputNum works properly. -my %configIni; # config hash we tie to for Config::IniFiles. -my $ivtvObj = Video::ivtv->new(); - -# map the Settings/Config file parameter to the command line variable that specifies it. -my %mappings = ( - "Channel" => "c|channel", - "RecordDuration" => "t|duration", - "InputNum" => "i|inputnum", - "InputName" => "I|inputname", - "OutputDirectory" => "D|directory", - "VideoDevice" => "d|input", - "VideoWidth" => "W|width", - "VideoHeight" => "H|height", - "VideoStandard" => "s|standard", - "VideoType" => "T|type", - "BitrateMode" => "bitrate-mode", - "Bitrate" => "b|bitrate", - "PeakBitrate" => "B|peakbitrate", - "Aspect" => "aspect", - "AudioBitmask" => "audio-bitmask", - "BFrames" => "bframes", - "DNRMode" => "dnrmode", - "DNRSpatial" => "dnrspatial", - "DNRTemporal" => "dnrtemporal", - "DNRType" => "dnrtype", - "Framerate" => "framerate", - "FramesPerGOP" => "framespergop", - "GOPClosure" => "gopclosure", - "Pulldown" => "pulldown", - "StreamType" => "streamtype", - "OutputFileName" => "o|output", - "FrequencyTable" => "f|freqtable", - "Frequency" => "F|frequency", - "ResetCardSettings" => "R|noreset", - "DirectoryFormatString" => "directory-format", - "DateTimeFormatString" => "date-format", - "Debug" => "debug", - "TunerNum" => "tuner-num", - "OutputSettings" => "output-settings", - "OutputSettingsName" => "output-settings-name", - "OutputSettingsType" => "output-settings-type", - "CaptureLastGOP" => "capture-last-gop", - ); - -my %codecMappings = ( - "Aspect" => "aspect", - "AudioBitmask" => "audio_bitmask", - "BFrames" => "bframes", - "BitrateMode" => "bitrate_mode", - "Bitrate" => "bitrate", - "PeakBitrate" => "bitrate_peak", - "DNRMode" => "dnr_mode", - "DNRSpatial" => "dnr_spatial", - "DNRTemporal" => "dnr_temporal", - "DNRType" => "dnr_type", - "Framerate" => "framerate", - "FramesPerGOP" => "framespergop", - "GOPClosure" => "gop_closure", - "Pulldown" => "pulldown", - "StreamType" => "stream_type", - ); - -# check for devfs support -if ( -e "/dev/.devfsd" ) -{ - $settings{VideoDevice} = "/dev/v4l/video0"; -} - -# check for the config file -if (-f $settings{ConfigFileName}) -{ - $settings{UseConfigFile} = 1; - - # tie to it. - tie %configIni, 'Config::IniFiles', (-file => $settings{ConfigFileName}) or die "Error: Opening config file '$settings{ConfigFileName}' failed! $!\n"; - - my $profile = "defaults"; - if (exists $configIni{$profile}) - { - my $saveFile = 0; - # check version of the config file. - if (!exists $configIni{$profile}{$cfgVersionStr}) - { - print "Updating config file to version 1...\n"; - - # first version config file! Update the Audio -> AudioBitmask entries. - $configIni{$profile}{$cfgVersionStr} = 1; - - # find all entries that have Audio and move to AudioBitmask. - foreach my $p (keys %configIni) - { - if (exists $configIni{$p}{Audio}) - { - $configIni{$p}{AudioBitmask} = $configIni{$p}{Audio}; - delete $configIni{$p}{Audio}; - } - } - - $saveFile = 1; # signal we need to save the config changes. - } - if ($configIni{$profile}{$cfgVersionStr} != $cfgVersion) - { - # we need to upgrade - if ($configIni{$profile}{$cfgVersionStr} == 1) - { - print "Updating config file to version 2...\n"; - # add the MSP Matrix related options. - $configIni{$profile}{SetMSPMatrix} = $settings{SetMSPMatrix}; - $configIni{$profile}{MSPInput} = $settings{MSPInput}; - $configIni{$profile}{MSPOutput} = $settings{MSPOutput}; - $configIni{$profile}{MSPSleep} = $settings{MSPSleep}; - $configIni{$profile}{$cfgVersionStr} = 2; - $saveFile = 1; - } - if ($configIni{$profile}{$cfgVersionStr} == 2) - { - print "Updating config file to version 3...\n"; - # remove the MSP Matrix related options from all profiles. - foreach my $p (keys %configIni) - { - foreach my $k (qw(SetMSPMatrix MSPInput MSPOutput MSPSleep)) - { - if (exists $configIni{$p}{$k}) - { - delete $configIni{$p}{$k}; - } - } - } - $configIni{$profile}{CaptureLastGOP} = 1; - $configIni{$profile}{$cfgVersionStr} = 3; - $saveFile = 1; - } - } - - if ($saveFile) - { - # now save the updated config file before we continue. - tied(%configIni)->RewriteConfig or die "Error: Writing config file '$settings{ConfigFileName}' failed! $!\n"; - } - - # update the defaults stored. - foreach my $arg (keys %mappings) - { - if (exists $configIni{$profile}{$arg}) - { - $settings{$arg} = $configIni{$profile}{$arg}; - #print "settings{$arg} = '" . $settings{$arg} . "'\n"; - } - } - } - else - { - print "Warning: config file '$settings{ConfigFileName}' exists but does not have the\n[$profile] section! Use -S to create it without specifying -P.\n\n"; - } -} -else # create the config file -{ - print "Auto Creating config file $settings{ConfigFileName}...\n"; - my $profile = "defaults"; - - # we have to create the config file and tie to it. - tie %configIni, 'Config::IniFiles', () or die "Error: Initializing config file '$settings{ConfigFileName}' failed! $!\n"; - - # now set the name to work with. - tied(%configIni)->SetFileName($settings{ConfigFileName}) or die "Error: Setting config file to '$settings{ConfigFileName}' failed! $!\n"; - - $configIni{$profile} = {}; # make sure the section exists. - - foreach my $arg (keys %mappings) - { - $configIni{$profile}{$arg} = $settings{$arg}; - print "configIni{$profile}{$arg} = '" . $settings{$arg} . "'\n" if $settings{Debug}; - } - - # set the config file version - $configIni{$profile}{$cfgVersionStr} = $cfgVersion; - - # write the config file out. - tied(%configIni)->RewriteConfig or die "Error: Writing config file '$settings{ConfigFileName}' failed! $!\n"; -} - -# build up the "custom" frequency table -my %customMap = (); -foreach my $profileName (keys %configIni) -{ - next if $profileName =~ /^(defaults)$/; - - if (exists $configIni{$profileName}{Frequency}) - { - $customMap{$profileName} = $configIni{$profileName}{Frequency}; - } -} -$CHANLIST{custom} = \%customMap; - -# enumerations -my @standards; -my %name2std; -my @inputs; -my %name2input; -my @codecInfo; # stores the Codec Info -my @newCodecInfo; # the version we mess with. -# Current settings (Input, Channel, Standard) -my $curinput; -my $curinputName; -my $std; -my $curstd = "???"; -my $curStandard = 0; # numeric representation. -my $curChannel = 0; -my $curFrequency = 0; - -my $tuner; -my $settingsFH; # File Handle for output settings. -my $err; -my $v4l2input; - -my $tmpDirectoryStr = formatDirectoryString(); -my $versionStr = "record-v4l2.pl $version for use with http://ivtv.sf.net/"; -my $usageStr = <<"END_OF_USAGE"; -$versionStr - -Usage: record-v4l2.pl [--channel CHANNEL] [--duration TIME] - [--directory DIRECTORY] [--output OUTPUT] - [--directory-format FORMAT] [--date-format FORMAT] - [--input VIDEO_DEV][--width WIDTH --height HEIGHT] - [--standard STANDARD] [--type TYPE] - [--inputnum INPUT#] [--inputname INPUT NAME] - [--freqtable FREQENCY MAP] [--frequency FREQUENCY] - [--bitrate-mode MODE] - [--bitrate BITRATE] [--peakbitrate PEAK_BITRATE] - [--profile PROFILE] [--list-freqtable] [--list-channels] - [--no-record] [--noreset] [--save] [--help] [--version] - [--aspect ASPECT] [--audio-bitmask AUDIO-BITMASK] [--bframes BFRAMES] - [--dnrmode DNRMODE] [--dnrspatial DNRSPATIAL] - [--dnrtemporal DNRTEMPORAL] [--dnrtype DNRTYPE] - [--framerate FRAMERATE] [--framespergop FRAMESPERGOP] - [--gopclosure GOPCLOSURE] [--capture-last-gop GOP_END] - [--pulldown PULLDOWN] [--streamtype STREAMTYPE] [--debug] - [--tuner-num TUNERNUM] [--output-settings BOOL] - [--output-settings-name FNAME] [--output-settings-type TYPE] - [--list-inputs] [--list-standards] [CHANNEL] - - -c/--channel CHANNEL: channel number to switch to - NOTE: You can also specify the channel by itself. - Ex. record-v4l2.pl 73 - would change to channel 73 using the default settings - or the settings from your ~/.ivtvrc config file. - -t/--duration TIME: number of seconds to record - -D/--directory DIRECTORY: Base directory to record into - --directory-format FORMAT: format string that specifies the - sub-directory to create under the base directory that - the output file will be created in. This can be empty - to indicate no sub-directory should be created. - - Available tokens are: - %d - date formatted by --date-format - %I - input name recorded from - Any white space in the name is converted to - underscores (_). Ex. 'Tuner 0' => 'Tuner_0' - - %c - channel or "freq-#" frequency - - --date-format FORMAT: format string that specifies the - date format string to generate and substitute for - %d in the --directory-format string. - - Available tokens: see the date commands man page. - The string must start with a + (plus). - - -o/--output OUTPUT: name of file to create - -d/--input VIDEO_DEV: video device to capture from - -W/--width WIDTH: width of screen (720 for NTSC fullscreen) - -H/--height HEIGHT: height of screen (480 for NTSC fullscreen) - -s/--standard STANDARD: NTSC, PAL or SECAM - video standard to record in - -T/--type TYPE: mpeg or yuv output - -i/--inputnum INPUT#: - The index number of the input you want to use (0 -> n-1) - -I/--inputname INPUT NAME: The name of the input you want to use. - -f/--freqtable FREQUENCY MAP: Specify the frequency mapping to use. - -F/--frequency FREQUENCY: Specify the frequency to tune to. - ex. 517250 = NTSC Cable 73 (SCiFi) - --tuner-num TUNERNUM: Specify the tuner to use. - -L/--list-freqtable: - list all available frequency mappings that Video::Frequencies knows - --list-channels: lists all channels and their frequencies for the - specified frequency table being used. - --list-inputs: lists all inputs the v4l2 driver reports. - --list-standards: lists all Video Standards the v4l2 driver supports. - -R/--noreset: Do not Reset anything that was changed - (standard, channel, resolution, etc.) - --no-record: Do not create any directories, capture data or reset the card - back to original settings. This is the ptune.pl mode. - -h/--help: display this help - -v/--version: display the version of this program - --debug: turns on debug output - --output-settings BOOL: Turns on or off the creation of the settings - file that contains perl or shell variables that - represent the settings used to record the video file. - This feature is ignored if --no-record specified. - --output-settings-name FNAME: The name of the file to write the settings to. - It must end in .settings. - --output-settings-type TYPE: Either 'shell' or 'perl'. - If 'shell', then all variables output are prefixed with REC_ - and are upper cased. Ex: StreamType => REC_STREAMTYPE="14" - If 'perl', then all variables output are created in the - %settings hash. Ex: StreamType => $settings{StreamType} = "14"; - - Codec related options: - --bitrate-mode MODE: 0 = VBR, 1 = CBR - -b/--bitrate BITRATE: Specify the Bitrate to capture at in Mbps - -B/--peakbitrate PEAK_BITRATE: Specify the Peak Bitrate to capture at in Mbps - --aspect ASPECT: Specify the aspect ratio - --audio-bitmask AUDIO-BITMASK: Specify the audio bitmask value - --bframes BFRAMES: Specify the number of B frames value - --dnrmode DNRMODE: Specify the dnr_mode value - --dnrspatial DNRSPATIAL: Specify the dnr_spatial value - --dnrtemporal DNRTEMPORAL: Specify the dnr_temporal value - --dnrtype DNRTYPE: Specify the dnr_type value - --framerate FRAMERATE: Specify the framerate value. 0 = 30fps, 1 = 25fps - --framespergop FRAMESPERGOP: Specify the GOP size - --gopclosure GOPCLOSURE: Specify if you want open/closed GOP's. - --capture-last-gop GOP_END: Specify if you want the encoder stream to try and - capture the last GOP, thus generating a 100% valid mpeg2 file. - 1 = yes (default), 0 = no. - --pulldown PULLDOWN: 1 = Inverse telecine on, 0 = off - --streamtype STREAMTYPE: Specify the stream_type value - Valid Values are: - 0 - PS - 1 - TS - 2 - MPEG1 - 3 - PES_AV - 5 - PES_V - 7 - PES_A - 10 - DVD - 11 - VCD - 12 - SVCD - 13 - DVD-Special 1 - 14 - DVD-Special 2 - - Config file related options: - -P/--profile PROFILE: Override defaults and command line values with the - config entries in the section labeled [PROFILE] from the - config file $settings{ConfigFileName}. - Examples: -P NTSC-DVD, -P PAL-DVD, --profile MY-SETTINGS - - You can specify this option multiple times and each successive - profile will overlay the defaults and any previous profiles. - You will not be able to create/update a profile if you do - specify multiple profiles. - -S/--save: save the current values as the defaults in - $settings{ConfigFileName}. - If -P/--profile PROFILE is specified, then those values that exist in - the specified profile will be updated. If the profile doesn't exist, - then it will be created, but will have all possible config items - defined in it. It will be your responsibility to hand check the - config file and remove any config items you do not want set for - that profile. - Any options specified on the command line will override options - defined in the config file. - -Notes: - If you specify both -i/--inputnum and -I/--inputname then - -i/--inputnum will take precedence. - - If you specify both -c/--channel and -F/--frequency then - -F/--frequency will take precedence. - - If you use a Profile, it has the ability to override all command line - arguments, so check your Profile first if things seem to be ignored. - -Defaults: - --duration $settings{RecordDuration} --input $settings{VideoDevice} --width $settings{VideoWidth} --height $settings{VideoHeight} --standard $settings{VideoStandard} - --type $settings{VideoType} --directory $settings{OutputDirectory} --output $settings{OutputFileName} - --directory-format "$settings{DirectoryFormatString}" --date-format "$settings{DateTimeFormatString}" - --inputnum $settings{InputNum} --inputname '$settings{InputName}' --freqtable $settings{FrequencyTable} --capture-last-gop $settings{CaptureLastGOP} - --bitrate $settings{Bitrate} --peakbitrate $settings{PeakBitrate} --aspect $settings{Aspect} --audio-bitmask $settings{AudioBitmask} --bframes $settings{BFrames} - --dnrmode $settings{DNRMode} --dnrspatial $settings{DNRSpatial} --dnrtemporal $settings{DNRTemporal} --dnrtype $settings{DNRType} - --framerate $settings{Framerate} --framespergop $settings{FramesPerGOP} --gopclosure $settings{GOPClosure} --pulldown $settings{Pulldown} --streamtype $settings{StreamType} - --tuner-num $settings{TunerNum} --output-settings $settings{OutputSettings} --output-settings-name $settings{OutputSettingsName} --output-settings-type $settings{OutputSettingsType} - - config file = '$settings{ConfigFileName}' - - If Channel = $settings{Channel}, this would create: - $tmpDirectoryStr$settings{OutputFileName} - - Note: This script relies on Perl Modules: Video::Frequencies, Video::ivtv, - Config::IniFiles and Getopt::Long. -END_OF_USAGE - -# handle user input here -my %opts; -#getopts('c:t:o:hd:W:H:s:T:D:vi:I:f:F:LRb:B:P:S', \%opts); -GetOptions(\%opts, "channel|c=s", "duration|t=i", "output|o=s", "help|h", "input|d=s", "width|W=i", "height|H=i", "standard|s=s", - "type|T=s", "directory|D=s", "version|v", "inputnum|i=i", "inputname|I=s", "freqtable|f=s", "frequency|F=i", "list-freqtable|L", - "noreset|R", "bitrate|b=i", "peakbitrate|B=i", "profile|P=s@", "save|S", "aspect=i", "audio-bitmask=s", "bframes=i", "dnrmode=i", "dnrspatial=i", - "dnrtemporal=i", "dnrtype=i", "framerate=i", "framespergop=i", "gopclosure=i", "pulldown=i", "capture-last-gop=i", - "streamtype=i", "no-record", "directory-format=s", "date-format=s", "debug", "list-channels", - "tuner-num=i", "list-inputs", "list-standards", "bitrate-mode=i", "output-settings=i", "output-settings-name=s", "output-settings-type=s"); -if (scalar keys %opts == 0 && @ARGV == 0) -{ - usage(0, ""); -} -foreach my $option (sort keys %opts) -{ - my $found = 0; - foreach my $mapName (keys %mappings) - { - if ($option =~ /^($mappings{$mapName})$/) - { - $settings{$mapName} = $opts{$option}; - $found = 1; - print "$mapName = '$opts{$option}'\n" if $settings{Debug}; - } - } - if (!$found) - { - # handle the non-settings cases. - if ($option =~ /^(L|list-freqtable)$/) - { - my $errStr = "\nAvailable Frequency Mappings:\n"; - foreach my $name (sort keys %CHANLIST) - { - $errStr .= "$name\n"; - } - print "$versionStr\n$errStr"; - exit 0; - } - elsif ($option eq "list-channels") - { - my $errStr = "\nAvailable Channels for $settings{FrequencyTable}:\n"; - foreach my $name (sort { $a <=> $b } keys %{$CHANLIST{$settings{FrequencyTable}}}) - { - $errStr .= "$name\t= $CHANLIST{$settings{FrequencyTable}}->{$name}\n"; - } - print "$versionStr\n$errStr"; - exit 0; - } - elsif ($option =~ /^(no-record)$/) - { - $settings{DontRecord} = 1; - } - elsif ($option =~ /^(S|save)$/) - { - $settings{UpdateConfigFile} = 1; - } - elsif ($option =~ /^(P|profile)$/) - { - @profileNames = @{$opts{$option}}; - } - elsif ($option =~ /^(v|version)$/) - { - print "$versionStr\n"; - exit 0; - } - elsif ($option =~ /^(h|help)$/) - { - usage(0, ""); - } - elsif ($option =~ /^(list-inputs|list-standards)$/) - { - # do nothing for now since they will be handled later. - } - else - { - usage(1, "-$option is an unknown option!"); - } - } -} - -if (@profileNames) -{ - # loop over all profiles the user specified. - foreach my $profileName (@profileNames) - { - print "profile = '$profileName'\n" if $settings{Debug}; - # for now the profile can not be "defaults". - if ($profileName eq "defaults") - { - error(1, "Profile = '$profileName' is invalid!"); - } - if (exists $configIni{$profileName}) - { - # update defaults that exist in this profile as long as the entry wasn't specified on the command line. - my $profile = $profileName; - - foreach my $arg (keys %mappings) - { - # handle the long/short command option versions - my $cmdSpecified = 0; - foreach my $option (split(/\|/, $mappings{$arg})) - { - if (exists $opts{$option}) - { - $cmdSpecified = 1; - last; - } - } - #print "arg = '$arg', option = '$option'\n" if $settings{Debug}; - if (exists $configIni{$profile}{$arg} && !$cmdSpecified) - { - $profileOverloads{$arg} = $settings{$arg}; # preserve the old value. - $settings{$arg} = $configIni{$profile}{$arg}; - print "settings{$arg} = '" . $settings{$arg} . "'\n" if $settings{Debug}; - } - } - } - else - { - if ($settings{UpdateConfigFile} && @profileNames == 1) - { - print "Warning: Profile = '$profileName' will be created.\n" if ($settings{Debug}); - } - else - { - error(1, "Profile = '$profileName' does not exist! You must specify -S/--save to create it."); - } - } - } -} - -# verify input - -if (@ARGV) -{ - if (exists $opts{c} || exists $opts{channel}) - { - print "Warning: ignoring channel argument and using '$ARGV[0]' instead.\n"; - } - $settings{Channel} = $ARGV[0]; -} - -my $directoryName; -if (!$settings{DontRecord}) -{ - print "RecordDuration = $settings{RecordDuration}\n" if $settings{Debug}; - - if ($settings{VideoType} !~ /^(mpeg|yuv)$/) - { - error(1, "Video Type = '$settings{VideoType}' is invalid!"); - } - if ($settings{VideoType} eq "yuv") - { - # see if we need to change our defaults. - if (!exists $opts{o} && !exists $opts{output}) - { - $settings{OutputFileName} = "video.yuv"; - } - if (!exists $opts{d} && !exists $opts{input}) - { - if ( -e "/dev/.devfsd" ) - { - $settings{VideoDevice} = "/dev/v4l/yuv0"; - } - else - { - $settings{VideoDevice} = "/dev/yuv0"; - } - } - } - - if ( ! -d "$settings{OutputDirectory}") - { - $result = `mkdir -p $settings{OutputDirectory}`; - } - # make directory - $directoryName = formatDirectoryString(); - $result=`mkdir -p $directoryName`; -} - -# verify the output-settings options -if ($settings{OutputSettings} !~ /^[01]$/) -{ - error(1, "OutputSettings = '$settings{OutputSettings}' is invalid!"); -} -if ($settings{OutputSettings} && $settings{DontRecord}) -{ - $settings{OutputSettings} = 0; # turn off feature since we are not recording. -} -if ($settings{OutputSettings}) -{ - if ($settings{OutputSettingsName} !~ /^(.+\.settings)$/) - { - error(1, "OutputSettingsName = '$settings{OutputSettingsName}' is invalid! It must end in .settings."); - } - if ($settings{OutputSettingsType} !~ /^(shell|perl)$/) - { - error(1, "OutputSettingsType = '$settings{OutputSettingsType}' is invalid! It must be either 'shell' or 'perl'."); - } - sysopen($settingsFH, "$directoryName/$settings{OutputSettingsName}", O_CREAT | O_WRONLY) or die "Error creating file '$settings{OutputSettingsName}': $!\n"; - outputSettingSetup(); -} - -if ( ! -c "$settings{VideoDevice}") -{ - error(1, "Video Dev = '$settings{VideoDevice}' is invalid! $!"); -} - -# now that the video device has been semi validated, we can use it to lookup -# the inputs, standards, etc. and use that for validating some of the following -# pieces of user input. -sysopen($tuner, $settings{VideoDevice}, O_RDWR) or die "Error unable to open '$settings{VideoDevice}': $!"; -my $tunerFD = fileno($tuner); - -outputSetting("VideoDevice"); - -# get the current capabilities. -@capabilities = $ivtvObj->getCapabilities($tunerFD); -if (@capabilities != keys %{$ivtvObj->{capIndexes}}) -{ - error(1, "getCapabilities() failed!"); -} -# calculate the driver version info. -my $driverVersionHex = sprintf("%08x", $capabilities[$ivtvObj->{capIndexes}{version}]); -$driverVersionHex =~ /^(\d{4})(\d{2})(\d{2})$/; -my $driverVersionMajor = int($1); -my $driverVersionMinor = int($2); -my $driverVersionPatch = int($3); -my $driverVersionStr = $driverVersionMajor . "." . $driverVersionMinor . "." . $driverVersionPatch; - -$settings{v4l2DriverVersion} = $capabilities[$ivtvObj->{capIndexes}{version}]; -$settings{v4l2DriverVersionStr} = $driverVersionStr; -$settings{v4l2Driver} = $capabilities[$ivtvObj->{capIndexes}{driver}]; -outputSetting("v4l2Driver"); -outputSetting("v4l2DriverVersion"); -outputSetting("v4l2DriverVersionStr"); - -if ($settings{Debug}) -{ - print "V4l2 Capabilities: driver='$capabilities[$ivtvObj->{capIndexes}{driver}]', version='$capabilities[$ivtvObj->{capIndexes}{version}]', '$driverVersionStr'\n"; -} -if ($capabilities[$ivtvObj->{capIndexes}{driver}] ne "ivtv") -{ - $settings{UsingIvtvDriver} = 0; # we can't use the ivtv "enhancements". - print "Warning: V4l2 driver = '$capabilities[$ivtvObj->{capIndexes}{driver}]' does not support the ivtv \"enhancements\"!\n"; - print " All codec and ivtv specific options will be ignored.\n\n"; -} -elsif ($capabilities[$ivtvObj->{capIndexes}{version}] <= 265) -{ - $settings{CaptureLastGOP} = 0; # we can't use the ivtv GOP_END feature. - print "Warning: ivtv driver is not new enough to use the GOP_END feature!\n"; -} -$ivtvVersion = $capabilities[$ivtvObj->{capIndexes}{version}]; - -my $i; - -# get the current video standard -$std = $ivtvObj->getStandard($tunerFD); -if ($std > 0) -{ - printf("Standard: 0x%08x\n",$std) if ($settings{Debug}); -} -else -{ - die "Error: getStandard() failed!\n"; -} - -# get the current input -$curinput = $ivtvObj->getInput($tunerFD); -if ($curinput < 0) -{ - die "Error: getInput() failed!\n"; -} -printf("Input: 0x%08x\n",$curinput) if ($settings{Debug}); - -# flags to indicate when we should stop reading from the card. -my $done=0; -my $stopGOP=0; # indicates if we are asking for the Last GOP -my $endStream=0; # indicates if we are in the final read state. -# Standards -for ($i=0; !$done; ++$i) -{ - my($index,$std_id,$name,$frameperiod_n,$frameperiod_d,$framelines) = $ivtvObj->enumerateStandard($tunerFD, $i); - if ($index == -1) - { - $done = 1; - } - else - { - printf("%d 0x%08x %s %d/%d %d\n",$index,$std_id,$name,$frameperiod_n,$frameperiod_d,$framelines) if ($settings{Debug}); - push @standards, [($name,$std_id)]; - $name2std{$name} = $std_id; - if( (($std_id & $std) == $std)) - { - $curstd = $name; - $curStandard = $std; - } - } -} - -if (exists $opts{'list-standards'}) -{ - print "$versionStr\n"; - print "Available Video Standards:\n"; - foreach my $standard (@standards) - { - print "$standard->[0]\n"; - } - exit 0; -} - -$done=0; -# Inputs -for ($i=0; !$done; ++$i) -{ - my($index,$name,$type,$audioset,$tuner,$std,$status) = $ivtvObj->enumerateInput($tunerFD, $i); - if ($index == -1) - { - $done = 1; - } - else - { - push @inputs, $name; - $name2input{$name} = $index; - } -} -$curinputName = $inputs[$curinput]; - -if (exists $opts{'list-inputs'}) -{ - print "$versionStr\n"; - print "Available Inputs:\n"; - my $counter = 0; - foreach my $input (@inputs) - { - print "$counter: $input\n"; - $counter++; - } - exit 0; -} - -if ($settings{UsingIvtvDriver}) -{ - # get the current Codec Info - @codecInfo = $ivtvObj->getCodecInfo($tunerFD); - if (@codecInfo != keys %{$ivtvObj->{codecIndexes}}) - { - error(1, "getCodecInfo() failed!"); - } - @newCodecInfo = $ivtvObj->getCodecInfo($tunerFD); - if (@newCodecInfo != keys %{$ivtvObj->{codecIndexes}}) - { - error(1, "getCodecInfo() failed!"); - } -} - -# finish validating the user input. - -if (!$settings{DontRecord}) -{ - if ($settings{RecordDuration} !~ /^(\d+)$/) - { - error(1, "Time = '$settings{RecordDuration}' is invalid!"); - } - - outputSetting("RecordDuration"); - outputSetting("OutputDirectory"); - - # assume for now we are only generating mpeg files. -# if (($settings{VideoType} eq "mpeg" && $settings{OutputFileName} !~ /^.+\.mpg$/) || ($settings{VideoType} eq "yuv" && $settings{OutputFileName} !~ /^.+\.yuv$/)) -# { -# error(1, "Output = '$settings{OutputFileName}' is invalid!"); -# } - - outputSetting("VideoType"); - outputSetting("OutputFileName"); - - if ($settings{DateTimeFormatString} !~ /^(\+((\%.)|.)+)$/) - { - usage(1, "Date Format String = '$settings{DateTimeFormatString}' is invalid!"); - } - - outputSetting("DateTimeFormatString"); -} - -if ($settings{VideoWidth} !~ /^(\d+)$/) -{ - error(1, "Width = '$settings{VideoWidth}' is invalid!"); -} - -outputSetting("VideoWidth"); - -if ($settings{VideoHeight} !~ /^(\d+)$/) -{ - error(1, "Height = '$settings{VideoHeight}' is invalid!"); -} - -outputSetting("VideoHeight"); - -if (!exists $name2std{$settings{VideoStandard}}) -{ - my $validStandards = join(", ", keys(%name2std)); - error(1, "Video Standard = '$settings{VideoStandard}' is invalid!\nValid Standards are: $validStandards"); -} - -outputSetting("VideoStandard"); - -if (exists $opts{i} || exists $opts{inputnum} || ($settings{InputNum} != $name2input{$settings{InputName}} && exists $profileOverloads{InputNum})) -{ - if ($settings{InputNum} < 0 || $settings{InputNum} >= scalar(@inputs)) - { - error(1, "Video Input = '$settings{InputNum}' is invalid!\nValid Inputs are from 0 - " . int(scalar(@inputs) - 1)); - } - $settings{InputName} = $inputs[$settings{InputNum}]; -} - -if ((exists $opts{I} || exists $opts{inputname} || $settings{InputNum} != $name2input{$settings{InputName}}) && !(exists $opts{i} || exists $opts{inputnum})) -{ - if (!exists $name2input{$settings{InputName}}) - { - my $validInputs = join(", ", @inputs); - error(1, "Video Input Name = '$settings{InputName}' is invalid!\nValid Input Names are: $validInputs"); - } - $settings{InputNum} = $name2input{$settings{InputName}}; -} - -outputSetting("InputName"); -outputSetting("InputNum"); - -if (!exists $CHANLIST{$settings{FrequencyTable}}) -{ - error(1, "Frequency Table = '$settings{FrequencyTable}' is invalid!"); -} - -outputSetting("FrequencyTable"); - -# only validate the channel if the input is a tuner. -if ($inputs[$settings{InputNum}] =~ /Tuner/) -{ - if ($settings{TunerNum} !~ /^(\d)$/) - { - error(1, "TunerNum = '$settings{TunerNum}' is invalid!"); - } - if (exists $opts{F} || exists $opts{frequency} || $settings{Frequency}) # the user may have specified a Frequency in their config file - { - if ($settings{Frequency} !~ /^(\d+)$/) - { - error(1, "Frequency = '$settings{Frequency}' is invalid!"); - } - $settings{Channel} = "freq-$settings{Frequency}"; # make sure we output the channel part. - } - # now verify that the channel exists in the frequency table! - else - { - if (!$settings{Channel}) - { - error(1, "channel = '$settings{Channel}' is invalid!"); - } -## start new MMM # first verify the freqency table is appropriate for the standard (NTSC, PAL, SECAM), - # unless they specified the frequency to tune to. - if ($settings{FrequencyTable} !~ /^(custom|$settings{VideoStandard})/i) - { - error(1, "You specified Video Standard '$settings{VideoStandard}' which is incompatible with Frequency Table '$settings{FrequencyTable}'!"); - } ## end new MMM - if (!exists $CHANLIST{$settings{FrequencyTable}}->{$settings{Channel}}) - { - error(1, "Channel = '$settings{Channel}' does not exist in Frequency Table '$settings{FrequencyTable}'!"); - } - } - - outputSetting("Channel"); - outputSetting("Frequency"); - - # get the current channel/frequency value. - my $Frequency; - if(($Frequency = $ivtvObj->getFrequency($tunerFD, $settings{TunerNum})) > 0) - { - my $freq = ($Frequency * 1000) / 16; - print "freq = $freq\n" if ($settings{Debug}); - # find the associated channel. - if ((!exists $opts{F} && !exists $opts{frequency} && !$settings{Frequency}) && ($curstd eq $settings{VideoStandard}) ) - { - foreach my $chan (keys %{$CHANLIST{$settings{FrequencyTable}}}) - { - if ($CHANLIST{$settings{FrequencyTable}}->{$chan} == $freq) - { - $curChannel = $chan; - } - } - print "curChannel = $curChannel\n" if ($settings{Debug}); - } - else - { - $curFrequency = $freq; - } - } - elsif ($Frequency < 0) - { - die "Error: getFrequency() failed!\n"; - } -} -else -{ - # set the channel = "" so we know to ignore it. - $settings{Channel} = ""; -} - -if ($settings{UsingIvtvDriver}) -{ - # validate the Codec related stuff. - if ($settings{BitrateMode} !~ /^(0|1)$/) - { - error(1, "BitrateMode = '$settings{BitrateMode}' is invalid!"); - } - if ($settings{Bitrate} < $settings{minBitrate} || $settings{Bitrate} > $settings{maxBitrate}) - { - error(1, "Bitrate = '$settings{Bitrate}' is invalid!"); - } - if ($settings{PeakBitrate} < $settings{Bitrate}) - { - error(1, "PeakBitrate can not be less than Bitrate!"); - } - elsif ($settings{PeakBitrate} == $settings{Bitrate} && !$settings{BitrateMode} == 1) - { - error(1, "PeakBitrate can not be equal to Bitrate in VBR Mode!"); - } - elsif ($settings{PeakBitrate} < $settings{minPeakBitrate} || $settings{PeakBitrate} > $settings{maxPeakBitrate}) - { - error(1, "PeakBitrate = '$settings{PeakBitrate}' is invalid!"); - } - - if ($settings{VideoStandard} !~ /^(NTSC)/) - { - my $warn = 0; - if ($settings{Framerate} == 0) - { - $settings{Framerate} = 1; - $warn = 1; - } - if ($settings{FramesPerGOP} == 15) - { - $settings{FramesPerGOP} = 12; - $warn = 1; - } - if ($warn) - { - print "Warning: Setting Framerate/FramesPerGOP to PAL settings for Video Standard '$settings{VideoStandard}'!\n\nYou should either specify on the command line or in the ~/.ivtvrc config file.\n"; - } - } - elsif ($settings{VideoStandard} =~ /^(NTSC)/) - { - my $warn = 0; - if ($settings{Framerate} == 1) - { - $settings{Framerate} = 0; - $warn = 1; - } - if ($settings{FramesPerGOP} == 12) - { - $settings{FramesPerGOP} = 15; - $warn = 1; - } - if ($warn) - { - print "Warning: Setting Framerate/FramesPerGOP to NTSC settings for Video Standard '$settings{VideoStandard}'!\n\nYou should either specify on the command line or in the ~/.ivtvrc config file.\n"; - } - } - - if ($settings{StreamType} < 0 || $settings{StreamType} > 14) - { - error(1, "StreamType = '$settings{StreamType}' is invalid!"); - } - - if ($settings{CaptureLastGOP} < 0 || $settings{CaptureLastGOP} > 1) - { - error(1, "CaptureLastGOP = '$settings{CaptureLastGOP}' is invalid!"); - } - - outputSetting("BitrateMode"); - outputSetting("Bitrate"); - outputSetting("PeakBitrate"); - outputSetting("SetMSPMatrix"); - outputSetting("MSPInput"); - outputSetting("MSPOutput"); - outputSetting("Framerate"); - outputSetting("FramesPerGOP"); - outputSetting("Aspect"); - outputSetting("AudioBitmask"); - outputSetting("BFrames"); - outputSetting("DNRMode"); - outputSetting("DNRSpatial"); - outputSetting("DNRTemporal"); - outputSetting("DNRType"); - outputSetting("GOPClosure"); - outputSetting("Pulldown"); - outputSetting("StreamType"); - outputSetting("CaptureLastGOP"); -} - -# update the config file if the user wants us to. -if ($settings{UpdateConfigFile}) -{ - my $profile; - if (@profileNames > 1) - { - print "Warning: Not updating config file as you have more than 1 profile specified!\n"; - } - elsif (@profileNames == 1) - { - $profile = $profileNames[0]; - } - else - { - $profile = "defaults"; - } - if ($profile) - { - my $createProfile = (exists $configIni{$profile} ? 0 : 1); - print "Creating Profile = '$profile': $createProfile\n" if ($settings{Debug}); - - if (!$settings{UseConfigFile}) - { - # we have to create the config file and tie to it. - tie %configIni, 'Config::IniFiles', () or die "Error: Initializing config file '$settings{ConfigFileName}' failed! $!\n"; - - # now set the name to work with. - tied(%configIni)->SetFileName($settings{ConfigFileName}) or die "Error: Setting config file to '$settings{ConfigFileName}' failed! $!\n"; - - $configIni{$profile} = {}; # make sure the section exists. - } - - foreach my $arg (keys %mappings) - { - foreach my $option (split(/\|/, $mappings{$arg})) # handle the long/short command option versions - { - if (exists $configIni{$profile}{$arg} || $createProfile || exists $opts{$option}) - { - $configIni{$profile}{$arg} = $settings{$arg}; - print "configIni{$profile}{$arg} = '" . $settings{$arg} . "'\n" if $settings{Debug}; - last; - } - } - } - - # write the config file out. - tied(%configIni)->RewriteConfig or die "Error: Writing config file '$settings{ConfigFileName}' failed! $!\n"; - } -} - -# this hash keeps track of those values I have to set back. -my %changedSettings = ( - resolution => 0, - standard => 0, - VideoType => 0, - InputNum => 0, - Channel => 0, - Frequency => 0, - codec => 0, - ); - -# change the channel -if ($inputs[$settings{InputNum}] =~ /Tuner/) -{ - if (exists $opts{F} || exists $opts{frequency} || $settings{Frequency}) - { - if ($settings{Frequency} != $curFrequency) - { - $changedSettings{Frequency} = 1; - tuneFrequency($settings{Frequency}); - } - } - else - { - if ($curstd ne $settings{VideoStandard}) - { - # we have to set the channel regardless. - # but we want to tune back to the previous frequency. - $changedSettings{Frequency} = 1; - changeChannel($settings{Channel}); - } - elsif ($settings{Channel} ne $curChannel) - { - # otherwise we just changeChannel and restore the previous channel. - $changedSettings{Channel} = 1; - changeChannel($settings{Channel}); - } - } -} - -# set the video standard -if ($settings{VideoStandard} ne $curstd) -{ - $changedSettings{standard} = 1; - change_standard(); -} - -# set the input -if ($settings{InputNum} != $curinput || $settings{InputName} ne $curinputName) -{ - $changedSettings{InputNum} = 1; - if (!(exists $opts{i} || exists $opts{inputnum} || exists $opts{I} || exists $opts{inputname} || exists $profileOverloads{InputNum} || exists $profileOverloads{InputName})) # our defaults are different than the current values! - { - print "Warning: Changing input from '$curinputName' to'$settings{InputName}'.\n"; - } - change_input(); -} - -# set the capture type - -# store the current width,height so we can restore afterwards -my ($oldWidth, $oldHeight) = $ivtvObj->getResolution($tunerFD); -print "oldWidth = '$oldWidth', oldHeight = '$oldHeight'\n" if ($settings{Debug}); - -if ($settings{VideoWidth} != $oldWidth || $settings{VideoHeight} != $oldHeight) -{ - $changedSettings{resolution} = 1; -} - -# specify the width,height to capture -if ($changedSettings{resolution}) -{ - $result = $ivtvObj->setResolution($tunerFD, $settings{VideoWidth}, $settings{VideoHeight}); - if (not defined $result) - { - die "Error calling setResolution!\n"; - } - if (!$result) - { - die "Error in setResolution ioctl call!\n"; - } -} - -if ($settings{UsingIvtvDriver}) -{ - # set the GOP_END flag if the user requested it. - if ($ivtvVersion > 265) # > 0.1.9 - { - $result = $ivtvObj->setEndGOP($tunerFD, $settings{CaptureLastGOP}); - if (!$result) - { -## L1312 macmil_co_jp MMM die "Error calling setEndGOP($settings{CaptureLastGOP})!\n"; - } - } - - # specify the codec options to capture mpeg's at. - foreach my $codecName (keys %codecMappings) - { - my $codecIndex = $ivtvObj->{codecIndexes}{$codecMappings{$codecName}}; - if ($codecInfo[$codecIndex] != $settings{$codecName}) - { - $changedSettings{codec} = 1; - $newCodecInfo[$codecIndex] = $settings{$codecName}; - print "new $codecName = '$settings{$codecName}', old $codecName = '$codecInfo[$codecIndex]'\n" if $settings{Debug}; - } - } -} - -if ($changedSettings{codec}) -{ - $result = $ivtvObj->setCodecInfo($tunerFD, @newCodecInfo); - if (!$result) - { -## L1334 macmil_co_jp MMM die "Error calling setCodecInfo()!\n"; - } -} - -if (!$settings{DontRecord}) -{ - close($settingsFH) if ($settings{OutputSettings}); - - # capture the video/audio to video.mpg - captureVideo(directoryName => $directoryName, RecordDuration => $settings{RecordDuration}, - OutputFileName => $settings{OutputFileName}, tuner => $tuner); -} - -if ($settings{ResetCardSettings} && !$settings{DontRecord}) -{ - # close and re-open the device since it appears to not like taking new settings if we ended capturing. - close($tuner); - sysopen($tuner, $settings{VideoDevice}, O_RDWR) or die "Error unable to open '$settings{VideoDevice}': $!"; - $tunerFD = fileno($tuner); - - # restore Codec values - if ($changedSettings{codec}) - { - $result = $ivtvObj->setCodecInfo($tunerFD, @codecInfo); - if (!$result) - { -## L1360 macmil_co_jp MMM die "Error calling setCodecInfo()!\n"; - } - } - - # restore the previous input setting - if ($changedSettings{InputNum}) - { - # reset back to the old input name - $settings{InputName} = $curinputName; - change_input(); - } - - # restore the previous video standard - if ($changedSettings{standard}) - { - $settings{VideoStandard} = $curstd; - change_standard(); - } - - # restore the previous width,height settings - if ($changedSettings{resolution}) - { - $result = $ivtvObj->setResolution($tunerFD, $oldWidth, $oldHeight); - if (not defined $result) - { - die "Error calling setResolution!\n"; - } - if (!$result) - { - die "Error in setResolution ioctl call! result = '$result', oldWidth = '$oldWidth', oldHeight = '$oldHeight'\n"; - } - } - - # restore the previous channel - if ($changedSettings{Channel} && $curChannel > 0) - { - changeChannel($curChannel); - } - if ($changedSettings{Frequency} && $curFrequency > 0) - { - tuneFrequency($curFrequency); - } -} - -# close the tuner device -close($tuner); - -exit 0; - -# usage(returnValue, ErrorString) -# returnValue = 1 or 0 -# ErrorString = message you want to tell the user, but only if returnValue = 1. -sub usage -{ - my $errorCode = shift; - my $error = shift; - - print $usageStr; - print "\nError: $error\n" if ($errorCode == 1); - print "$error\n" if ($errorCode == 2); - - exit $errorCode; -} - -# error(returnValue, ErrorString) -# returnValue = 1 or 0 -# ErrorString = message you want to tell the user. -sub error -{ - my $errorCode = shift; - my $error = shift; - - print "$versionStr"; - print "\nError: $error\n"; - - exit $errorCode; -} - -# changes the input to $settings{InputNum} as long as it isn't = $curinput -sub change_input { - my $preinput = $name2input{$settings{InputName}}; - if($preinput != $curinput) - { - $curinput = $preinput; - print "input now $settings{InputName}, #$preinput\n" if ($settings{Debug}); - my $result = $ivtvObj->setInput($tunerFD, $preinput); - if (!$result) - { - die "Error: setInput($preinput) failed!\n"; - } - } -} - -# changes the video standard to $settings{VideoStandard} as long as it isn't = $curstd -sub change_standard { - my $standard = $name2std{$settings{VideoStandard}}; - if($standard != $curStandard) - { - $curStandard = $standard; - print "standard now $settings{VideoStandard}, #$standard\n" if ($settings{Debug}); -## L1460 v060406.pl MMM my $result = $ivtvObj->setStandard($tunerFD, $standard); - if (!$result) - { -## L1463 v060406.pl MMM die "Error: setStandard($standard) failed!\n"; - } - } -} - -# changes the channel -# takes the channel to change -sub changeChannel -{ - my $ch = shift; - my $freq = $CHANLIST{$settings{FrequencyTable}}->{$ch}; - my $driverf = ($freq * 16)/1000; - - print "Ch.$ch: $freq $driverf\n" if ($settings{Debug}); - - if (!$ivtvObj->setFrequency($tunerFD, $settings{TunerNum}, $driverf)) - { - die "Error: changeChannel($ch) failed!\n"; - } -} - -# tunes to the specified frequency -# takes the frequency to tune to -sub tuneFrequency -{ - my $freq = shift; - my $driverf = ($freq * 16)/1000; - - print "freq: $freq $driverf\n" if ($settings{Debug}); - - if (!$ivtvObj->setFrequency($tunerFD, $settings{TunerNum}, $driverf)) - { - die "Error: tuneFrequency($freq) failed!\n"; - } -} - -my $done = 0; - -sub catch_alarm { - if ($settings{CaptureLastGOP}) - { - $stopGOP = 1; # signal we need to stop the stream and capture the last GOP. - } - else - { - $done = 1; # signal we are done. - } -} - -# does the actual video capturing work. -# takes directoryName, RecordDuration, OutputFileName, tuner -sub captureVideo -{ - my %args = ( @_ ); - my $directoryName = $args{directoryName}; - my $RecordDuration = $args{RecordDuration}; - my $OutputFileName = $args{OutputFileName}; - my $tuner = $args{tuner}; - my $fname = "$directoryName/$OutputFileName"; - - # setup global variables, signal handlers, etc. - - $SIG{ALRM} = \&catch_alarm; - $SIG{INT} = \&catch_alarm; # handle Ctrl-C - - # open the file for writing. - - sysopen(OUTPUT, "$fname", O_CREAT | O_WRONLY | O_LARGEFILE) or die "Error creating file '$fname': $!\n"; - - alarm($RecordDuration); - my $buf = ""; - while (!$done) - { - if ($stopGOP) - { - $stopGOP = 0; - $ivtvObj->stopEncoding($tuner); - $endStream = 1; - $done = 1; # signal we are done after this loop. - } - # read from the device and write to the file. (16384) 32768 - my $bytes = read($tuner, $buf, 16384); - if (!$bytes && $endStream) - { - last; - } - print OUTPUT $buf; - } - - # close the file - close(OUTPUT); -} - -# returns the formatted directory string -sub formatDirectoryString -{ - my $temp = $settings{DirectoryFormatString}; - my $result = $settings{OutputDirectory}; - my %lookupTable = ( - "d" => `/bin/date "$settings{DateTimeFormatString}"`, - "I" => $settings{InputName}, - "c" => $settings{Channel}, - ); - - # fixup the InputName value - $lookupTable{I} =~ s/\s/_/g; - # cleanup the trailing slash on the date - chomp $lookupTable{d}; - - foreach my $option ("d", "I", "c") - { - $temp =~ s/\%$option/$lookupTable{$option}/g; - } - - $result .= "/" . ($temp ? "$temp/" : ""); - - return $result; -} - -sub outputSettingSetup -{ - my $date = `/bin/date`; chomp $date; - - if ($settings{OutputSettingsType} eq "shell") - { - print $settingsFH "# Settings for Recording made on $date.\n"; - } - elsif ($settings{OutputSettingsType} eq "perl") - { - print $settingsFH "# Settings for Recording made on $date.\n"; - print $settingsFH "my %settings = ();\n"; - } -} - -# outputs the specified setting and it's value to the -# settings file represented by $settingsFH in the -# specified language. -sub outputSetting -{ - my $setting = shift; - my $value = $settings{$setting}; - - return if (!$settings{OutputSettings}); - - if ($settings{OutputSettingsType} eq "shell") - { - print $settingsFH "REC_" . uc($setting) . "=\"$value\"\n"; - } - elsif ($settings{OutputSettingsType} eq "perl") - { - print $settingsFH "\$settings{$setting} = \"$value\";\n"; - } -} Index: trunk/install/php/reservecomp.php =================================================================== --- trunk/install/php/reservecomp.php (リビジョン 128) +++ trunk/install/php/reservecomp.php (リビジョン 1) @@ -17,19 +17,4 @@ */ - -include("./foltialib.php"); -$con = m_connect(); - -if ($useenvironmentpolicy == 1){ -if (!isset($_SERVER['PHP_AUTH_USER'])) { - header("WWW-Authenticate: Basic realm=\"foltia\""); - header("HTTP/1.0 401 Unauthorized"); - redirectlogin(); - exit; -} else { -login($con,$_SERVER['PHP_AUTH_USER'],$_SERVER['PHP_AUTH_PW']); -} -}//end if login - ?> @@ -44,4 +29,5 @@ fetch(); -if (! $rowdata) { + $query = "select title from foltia_program where tid='$tid'"; + $rs = m_query($con, $query, "DBクエリに失敗しました"); + $maxrows = pg_num_rows($rs); + + if ($maxrows == 0) { $title = "(未登録)"; }else{ + $rowdata = pg_fetch_row($rs, 0); $title = htmlspecialchars($rowdata[0]); } @@ -86,5 +71,5 @@
-「」を番組予約モードで予約しました。
+「」を番組予約モードで予約しました。

予約スケジュール
@@ -129,10 +114,11 @@ } $rs = m_query($con, $query, "DBクエリに失敗しました"); -$rowdata = $rs->fetch(); -if (! $rowdata) { + $maxrows = pg_num_rows($rs); + + if ($maxrows == 0) { echo("放映予定はいまのところありません
"); } else{ - $maxcols = $rs->columnCount(); + $maxcols = pg_num_fields($rs); ?> @@ -153,11 +139,14 @@ \n"); + /* pg_fetch_row で一行取り出す */ + $rowdata = pg_fetch_row($rs, $row); + for ($col = 0; $col < $maxcols; $col++) { /* 列に対応 */ echo("\n"); } echo("\n"); - } while ($rowdata = $rs->fetch()); + } }//end if ?> @@ -172,31 +161,39 @@ //既存が予約あって、新着が全局予約だったら if ($station ==0){ + $query = " +SELECT + * +FROM foltia_tvrecord +WHERE tid = '$tid' +"; + $rs = m_query($con, $query, "DBクエリに失敗しました"); + $maxrows = pg_num_rows($rs); + if ($maxrows > 0){ //既存局を消す $query = "DELETE FROM foltia_tvrecord -WHERE tid = ? -"; -// $rs = m_query($con, $query, "DBクエリに失敗しました"); - $rs = sql_query($con, $query, "DBクエリに失敗しました",array($tid)); +WHERE tid = '$tid' +"; + $rs = m_query($con, $query, "DBクエリに失敗しました"); + } }//endif $query = " SELECT -count(*) + * FROM foltia_tvrecord -WHERE tid = ? AND stationid = ? -"; -// $rs = m_query($con, $query, "DBクエリに失敗しました"); - $rs = sql_query($con, $query, "DBクエリに失敗しました",array($tid,$station)); - $maxrows = $rs->fetchColumn(0); +WHERE tid = '$tid' AND stationid = '$station' +"; + $rs = m_query($con, $query, "DBクエリに失敗しました"); + $maxrows = pg_num_rows($rs); + if ($maxrows == 0) { //新規追加 - $query = "INSERT INTO foltia_tvrecord values (?,?,?,?)"; -// $rs = m_query($con, $query, "DB書き込みに失敗しました"); - $rs = sql_query($con, $query, "DB書き込みに失敗しました",array($tid,$station,$bitrate,$usedigital)); + $query = "INSERT INTO foltia_tvrecord values ('$tid','$station','$bitrate')"; + $rs = m_query($con, $query, "DB書き込みに失敗しました"); }else{//修正 (ビットレート) $query = "UPDATE foltia_tvrecord SET - bitrate = ? , digital = ? WHERE tid = ? AND stationid = ? "; -// $rs = m_query($con, $query, "DB書き込みに失敗しました"); - $rs = sql_query($con, $query, "DB書き込みに失敗しました",array( $bitrate, $usedigital , $tid , $station )); + bitrate = '$bitrate' WHERE tid = '$tid' AND stationid = '$station' + "; + $rs = m_query($con, $query, "DB書き込みに失敗しました"); } Index: trunk/install/php/folcast.php =================================================================== --- trunk/install/php/folcast.php (リビジョン 133) +++ trunk/install/php/folcast.php (リビジョン 1) @@ -20,20 +20,9 @@ header('Content-Type: application/rss+xml'); -header('Content-Disposition: attachment; filename="folcast.xml"'); -include("./foltialib.php"); + + include("./foltialib.php"); $con = m_connect(); -/* -if ($useenvironmentpolicy == 1){ - if (!isset($_SERVER['PHP_AUTH_USER'])) { - header("WWW-Authenticate: Basic realm=\"foltia\""); - header("HTTP/1.0 401 Unauthorized"); - redirectlogin(); - exit; - } else { - login($con,$_SERVER['PHP_AUTH_USER'],$_SERVER['PHP_AUTH_PW']); - } -}//end if login -*/ + $now = date("YmdHi"); $nowrfc822 = date("r"); @@ -51,29 +40,24 @@ $query = " SELECT foltia_program.tid,foltia_program.title, -foltia_subtitle.countno , foltia_subtitle.subtitle , foltia_subtitle.startdatetime, foltia_subtitle.pspfilename,foltia_subtitle.lengthmin,foltia_subtitle.enddatetime FROM foltia_subtitle , foltia_program WHERE \"pspfilename\" LIKE 'M%%' AND foltia_program.tid = foltia_subtitle.tid AND foltia_program.tid = $tid -ORDER BY enddatetime DESC - limit ? offset 0 -"; +foltia_subtitle.countno , foltia_subtitle.subtitle , foltia_subtitle.startdatetime, foltia_subtitle.pspfilename,foltia_subtitle.lengthmin,foltia_subtitle.enddatetime FROM foltia_subtitle , foltia_program WHERE \"pspfilename\" ~~ 'M4V%%' AND foltia_program.tid = foltia_subtitle.tid AND foltia_program.tid = $tid +ORDER BY \"enddatetime\" DESC +offset 0 limit $max + "; $titlequery = " SELECT foltia_program.tid,foltia_program.title FROM foltia_program -WHERE foltia_program.tid = ? +WHERE foltia_program.tid = $tid "; -// $titlers = m_query($con, $query, "DBクエリに失敗しました"); - $titlers = sql_query($con, $query, "DBクエリに失敗しました",array($tid)); -// $titlers = sql_query($con, $titlequery, "DBクエリに失敗しました",array($tid)); - $rowdata = $titlers->fetch(); - $rsstitle = htmlspecialchars($rowdata[1]); + $titlers = m_query($con, $query, "DBクエリに失敗しました"); + $rowdata = pg_fetch_row($titlers, 0); + $rsstitle = $rowdata[1]; }else{ $query = " SELECT foltia_program.tid,foltia_program.title, -foltia_subtitle.countno , foltia_subtitle.subtitle , foltia_subtitle.startdatetime, foltia_subtitle.pspfilename,foltia_subtitle.lengthmin,foltia_subtitle.enddatetime FROM foltia_subtitle , foltia_program WHERE \"pspfilename\" LIKE 'M%%' AND foltia_program.tid = foltia_subtitle.tid ORDER BY enddatetime DESC -limit ? offset 0 +foltia_subtitle.countno , foltia_subtitle.subtitle , foltia_subtitle.startdatetime, foltia_subtitle.pspfilename,foltia_subtitle.lengthmin,foltia_subtitle.enddatetime FROM foltia_subtitle , foltia_program WHERE \"pspfilename\" ~~ 'M4V%%' AND foltia_program.tid = foltia_subtitle.tid ORDER BY \"enddatetime\" DESC +offset 0 limit $max "; - - - $rsstitle = "新規録画"; }//if @@ -82,14 +66,14 @@ - $rsstitle:Folcast + Folcast ($rsstitle) DCC-JPL Japan/foltia project http://www.dcc-jpl.com/soft/foltia/ フォルティアが未読処理をお助けしちゃいます - foltia video podcast :$rsstitle:Folcast + foltia video podcast :Folcast ($rsstitle) フォルティアが未読処理をお助けしちゃいます ja foltia - $rsstitle:Folcast + Folcast ($rsstitle) foltia@dcc-jpl.com @@ -101,12 +85,14 @@ print $header; -// $rs = m_query($con, $query, "DBクエリに失敗しました"); - $rs = sql_query($con, $query, "DBクエリに失敗しました",array($max)); -$rowdata = $rs->fetch(); + $rs = m_query($con, $query, "DBクエリに失敗しました"); + $maxrows = pg_num_rows($rs); -if (! $rowdata) { +if ($maxrows == 0) { //die_exit("No items"); }else{ - do { + +for ($row = 0; $row < $maxrows; $row++) { + $rowdata = pg_fetch_row($rs, $row); + //$title = mb_convert_encoding($rowdata[1],"UTF-8", "EUC-JP"); $tid = $rowdata[0]; @@ -133,11 +119,6 @@ $mp4thmname = ereg_replace(".MP4", ".THM", $mp4thmname); $mp4thmnameuri = "http://". getserverfqdn() . $httpmediamappath ."/$tid.localized/mp4/$mp4thmname"; - -if (file_exists("$recfolderpath/$tid.localized/mp4/$mp4filename")) { - $mp4filestat = stat("$recfolderpath/$tid.localized/mp4/$mp4filename"); - $mp4filesize = $mp4filestat[7]; -} else { - $mp4filesize = 0; -} +$mp4filestat = stat("$recfolderpath/$tid.localized/mp4/$mp4filename"); +$mp4filesize = $mp4filestat[7]; if ($rowdata[0] == 0 ){//EPG録画 @@ -166,5 +147,5 @@ print $item ; - } while ($rowdata = $rs->fetch()); //do +}//for }//if Index: trunk/install/php/foltia_config2.php.template =================================================================== --- trunk/install/php/foltia_config2.php.template (リビジョン 135) +++ trunk/install/php/foltia_config2.php.template (リビジョン 1) @@ -17,16 +17,12 @@ $recfolderpath = '/home/foltia/php/tv'; //録画ファイルの保存先のパス。 $httpmediamappath = '/tv'; //ブラウザから見える録画ファイルのある位置。 - $recunits = 0; //搭載アナログキャプチャカードチャンネル数 - - $protectmode = 0; //未使用:(ブラウザからの予約削除を禁止するなどの保護モードで動作します) + $protectmode = 1; //未使用:(ブラウザからの予約削除を禁止するなどの保護モードで動作します) $demomode = 0; //未使用:(ユーザインターフェイスだけ動作するデモモードで動作します) - $useenvironmentpolicy = 0 ;//環境ポリシーを使うかどうか - $environmentpolicytoken = "";//環境ポリシーのパスワードに連結されるセキュリティコード - $perltoolpath = $toolpath ;//perl版の初期設定の位置。デフォルトではphpと同じ位置 - $usedigital = 1;//Friioなどでデジタル録画をするか 1:する 0:しない // データベース接続設定 -// define("DSN", "pgsql:host=localhost dbname=foltia user=foltia password= "); -define("DSN", "sqlite:/home/foltia/foltia.sqlite"); + define("DATABASE_NAME", "foltia"); + define("DBHOST", "localhost"); + define("USER_NAME" , "foltia" ); + define("USER_PASSWORD", "passwd" ); // $mylocalip = "192.168.0.177" ; //動いている機械のIPアドレス Index: trunk/install/php/delreserve.php =================================================================== --- trunk/install/php/delreserve.php (リビジョン 128) +++ trunk/install/php/delreserve.php (リビジョン 1) @@ -17,19 +17,4 @@ */ - -include("./foltialib.php"); -$con = m_connect(); - -if ($useenvironmentpolicy == 1){ -if (!isset($_SERVER['PHP_AUTH_USER'])) { - header("WWW-Authenticate: Basic realm=\"foltia\""); - header("HTTP/1.0 401 Unauthorized"); - redirectlogin(); - exit; -} else { -login($con,$_SERVER['PHP_AUTH_USER'],$_SERVER['PHP_AUTH_PW']); -} -}//end if login - ?> @@ -44,13 +29,16 @@ "); } - $sid = getgetnumform("sid"); +$sid = getgetnumform(sid); if ($sid == "") { die_exit("局がありません
"); } +$con = m_connect(); $now = date("YmdHi"); ?> @@ -69,13 +57,14 @@ foltia_tvrecord.stationid FROM foltia_tvrecord , foltia_program , foltia_station -WHERE foltia_tvrecord.tid = foltia_program.tid AND foltia_tvrecord.stationid = foltia_station .stationid AND foltia_tvrecord.tid = ? AND foltia_tvrecord.stationid = ? "; +WHERE foltia_tvrecord.tid = foltia_program.tid AND foltia_tvrecord.stationid = foltia_station .stationid AND foltia_tvrecord.tid = $tid AND foltia_tvrecord.stationid = $sid "; -// $rs = m_query($con, $query, "DBクエリに失敗しました"); - $rs = sql_query($con, $query, "DBクエリに失敗しました",array($tid,$sid)); -$rowdata = $rs->fetch(); - -if (! $rowdata ) { + $rs = m_query($con, $query, "DBクエリに失敗しました"); + $maxrows = pg_num_rows($rs); + + if ($maxrows == 0) { die_exit("登録番組がありません
"); } + $rowdata = pg_fetch_row($rs, 0); + $tid = htmlspecialchars($rowdata[0]); $stationname = htmlspecialchars($rowdata[1]); @@ -105,8 +94,6 @@ DELETE FROM foltia_tvrecord -WHERE foltia_tvrecord.tid = ? AND foltia_tvrecord.stationid = ? "; -$rs->closeCursor(); -// $rs = m_query($con, $query, "DBクエリに失敗しました"); - $rs = sql_query($con, $query, "DBクエリに失敗しました",array($tid,$sid)); +WHERE foltia_tvrecord.tid = $tid AND foltia_tvrecord.stationid = $sid "; + $rs = m_query($con, $query, "DBクエリに失敗しました"); } @@ -128,7 +115,7 @@
- - - + + + @@ -164,14 +151,15 @@ FROM foltia_subtitle , foltia_program ,foltia_station WHERE foltia_program.tid = foltia_subtitle.tid AND foltia_station.stationid = foltia_subtitle.stationid - AND foltia_subtitle.startdatetime >= ? AND foltia_program.tid = ? + AND foltia_subtitle.startdatetime >= '$now' AND foltia_program.tid ='$tid' ORDER BY foltia_subtitle.startdatetime ASC "; -// $rs = m_query($con, $query, "DBクエリに失敗しました"); - $rs = sql_query($con, $query, "DBクエリに失敗しました",array($now,$tid)); -$rowdata = $rs->fetch(); -if (! $rowdata) { + $rs = m_query($con, $query, "DBクエリに失敗しました"); + $maxrows = pg_num_rows($rs); + + if ($maxrows == 0) { echo("放映予定はありません
"); -}else{ - $maxcols = $rs->columnCount(); + } + else{ + $maxcols = pg_num_fields($rs); ?>
".htmlspecialchars($rowdata[$col])."
@@ -191,11 +179,14 @@ \n"); + /* pg_fetch_row で一行取り出す */ + $rowdata = pg_fetch_row($rs, $row); + for ($col = 0; $col < $maxcols; $col++) { /* 列に対応 */ echo("\n"); } echo("\n"); - } while ($row = $rs->fetch()); + } }//end if ?> Index: trunk/install/php/deletemovie.php =================================================================== --- trunk/install/php/deletemovie.php (リビジョン 124) +++ trunk/install/php/deletemovie.php (リビジョン 1) @@ -15,19 +15,4 @@ */ - -include("./foltialib.php"); -$con = m_connect(); - -if ($useenvironmentpolicy == 1){ -if (!isset($_SERVER['PHP_AUTH_USER'])) { - header("WWW-Authenticate: Basic realm=\"foltia\""); - header("HTTP/1.0 401 Unauthorized"); - redirectlogin(); - exit; -} else { -login($con,$_SERVER['PHP_AUTH_USER'],$_SERVER['PHP_AUTH_PW']); -} -}//end if login - ?> @@ -41,4 +26,6 @@ 録画番組削除


-削除番組はありません。

\n"; -}else{ +

次の番組を削除しました。

-$userclass = getuserclass($con); -if ( $userclass <= 1){ - -print "

次の番組を削除しました。

-
".htmlspecialchars($rowdata[$col])."
+
- - - - + + + + - "; + + +fetch(); -$rowdata = $rall[0]; - -$title = htmlspecialchars($rall[1]); -$count = htmlspecialchars($rall[2]); -$subtitle = htmlspecialchars($rall[3]); - -print " - - - - - -\n +SELECT +foltia_program.tid,foltia_program.title,foltia_subtitle.subtitle +FROM foltia_subtitle , foltia_program +WHERE foltia_program.tid = foltia_subtitle.tid + AND foltia_subtitle.tid = $filesplit[0] "; - -//DBから削除 -if ($demomode){ +$rs = m_query($con, $query, "DBクエリに失敗しました"); +$rowdata = pg_fetch_row($rs, $row); +//print" $fName./$rowdata[1]//$rowdata[2]
\n"; +$title = $rowdata[1]; +$subtitle = ""; +$count = ""; }else{ $query = " -DELETE FROM foltia_mp4files -WHERE mp4filename = ? +SELECT +foltia_program.tid,foltia_program.title,foltia_subtitle.countno,foltia_subtitle.subtitle +FROM foltia_subtitle , foltia_program +WHERE foltia_program.tid = foltia_subtitle.tid + AND foltia_subtitle.tid = $filesplit[0] + AND foltia_subtitle.countno = $filesplit[1] "; -//$rs = m_query($con, $query, "DBクエリに失敗しました"); -$rs = sql_query($con, $query, "DBクエリに失敗しました",array($fName)); - -//削除処理 -$oserr = system("$toolpath/perl/deletemovie.pl $fName"); -}//end if demomode - -}else{ //拡張子がMP4以外なら 録画一覧(録画順・番組順)の削除(showplaylist.php) - -$query = " -SELECT foltia_program.tid,foltia_program.title,foltia_subtitle.countno,foltia_subtitle.subtitle -FROM foltia_subtitle , foltia_program -WHERE foltia_program.tid = foltia_subtitle.tid -AND foltia_subtitle.m2pfilename = ? -"; - -//$rs = m_query($con, $query, "DBクエリに失敗しました"); -//$rs = sql_query($con, $query, "DBクエリに失敗しました",array($filesplit[0] ,$filesplit[1])); -$rs = sql_query($con, $query, "DBクエリに失敗しました",array($fName)); - $rall = $rs->fetchAll(); - $rowdata = $rall[0]; +$rs = m_query($con, $query, "DBクエリに失敗しました"); +$rowdata = pg_fetch_row($rs, $row); +//print" $fName./$rowdata[1]/$rowdata[2]/$rowdata[3]
\n"; $title = $rowdata[1]; $count = $rowdata[2]; $subtitle = $rowdata[3]; + +}//end if 話数がNULL $tid = htmlspecialchars($rowdata[0]); @@ -151,16 +101,11 @@ $subtitle = htmlspecialchars($subtitle); +//-- + + print " - + @@ -174,8 +119,7 @@ $query = " DELETE FROM foltia_m2pfiles -WHERE m2pfilename = ? +WHERE m2pfilename = '$fName' "; -//$rs = m_query($con, $query, "DBクエリに失敗しました"); -$rs = sql_query($con, $query, "DBクエリに失敗しました",array($fName)); +$rs = m_query($con, $query, "DBクエリに失敗しました"); //削除処理 @@ -183,15 +127,9 @@ }//end if demomode -}//end if .MP4拡張子分岐 - }//foreach -print "
ファイル名タイトル話数サブタイファイル名タイトル話数サブタイ
$fName
"; - -if ($tid > 0 ){ - print "$title"; -}else{ - print "$title"; -} - -print "$count
$subtitle
$fName
"; - -if ($tid > 0 ){ - print "$title"; -}else{ - print "$title"; -} - -print "$title $count
$subtitle
\n"; - -}else{//権限なし - print "

ファイル削除権限がありません。

"; -} -}//if $delete == "" ?> + + Index: trunk/install/php/showplaylist.php =================================================================== --- trunk/install/php/showplaylist.php (リビジョン 126) +++ trunk/install/php/showplaylist.php (リビジョン 1) @@ -14,25 +14,9 @@  省略時、録画順にソートされる。  titleのときに、番組順ソートされる。 - rawのときに、DBに記録されている番組録画情報ではなくディレクトリにあるm2p/m2tファイルを全て表示する。 + rawのときに、DBに記録されている番組録画情報ではなくディレクトリにあるm2pファイルを全て表示する。 DCC-JPL Japan/foltia project */ - -include("./foltialib.php"); -$con = m_connect(); - -if ($useenvironmentpolicy == 1){ - if (!isset($_SERVER['PHP_AUTH_USER'])) { - header("WWW-Authenticate: Basic realm=\"foltia\""); - header("HTTP/1.0 401 Unauthorized"); - redirectlogin(); - exit; - } else { - login($con,$_SERVER['PHP_AUTH_USER'],$_SERVER['PHP_AUTH_PW']); - } -}//end if login - - ?> @@ -43,53 +27,25 @@ foltia:recorded file list "; - -/////////////////////////////////////////////////?????? -//1ページの表示レコード数 -$lim = 300; -//クエリ取得 -$p = getgetnumform(p); -//ページ取得の計算 -list($st,$p,$p2) = number_page($p,$lim); -//////////////////////////////////////////////////???? - + include("./foltialib.php"); +$con = m_connect(); $now = date("YmdHi"); + ?>
- -

録画一覧表示


再生可能番組リストを表示します。
- "; -////////////////////////////////////////// - - ?>

@@ -97,6 +53,6 @@ - - + + @@ -104,5 +60,4 @@ - - + - -\n"; -if(($fName == ".") or ($fName == "..") ){ continue; } -if ((ereg(".m2.+", $fName))|| (ereg(".aac", $fName))){ - $filesplit = split("-",$fName); - -if (preg_match("/^\d+$/", $filesplit[0])) {// print "File is looks like good:preg
\n"; + if(($fName == ".") or ($fName == "..") ){ continue; } + if (ereg(".m2p", $fName)){ + $filesplit = split("-",$fName); + if ($filesplit[1] == ""){ $query = " @@ -143,15 +94,12 @@ FROM foltia_subtitle , foltia_program WHERE foltia_program.tid = foltia_subtitle.tid - AND foltia_subtitle.tid = ? -"; -//$rs = m_query($con, $query, "DBクエリに失敗しました"); -$rs = sql_query($con, $query, "DBクエリに失敗しました",array($filesplit[0])); - $rall = $rs->fetchAll(); - $rowdata = $rall[0]; + AND foltia_subtitle.tid = $filesplit[0] +"; +$rs = m_query($con, $query, "DBクエリに失敗しました"); +$rowdata = pg_fetch_row($rs, $row); //print" $fName./$rowdata[1]//$rowdata[2]
\n"; $title = $rowdata[1]; $subtitle = ""; $count = ""; - }else{ @@ -161,11 +109,9 @@ FROM foltia_subtitle , foltia_program WHERE foltia_program.tid = foltia_subtitle.tid - AND foltia_subtitle.tid = ? - AND foltia_subtitle.countno = ? -"; -//$rs = m_query($con, $query, "DBクエリに失敗しました"); -$rs = sql_query($con, $query, "DBクエリに失敗しました",array($filesplit[0],$filesplit[1])); - $rall = $rs->fetchAll(); - $rowdata = $rall[0]; + AND foltia_subtitle.tid = $filesplit[0] + AND foltia_subtitle.countno = $filesplit[1] +"; +$rs = m_query($con, $query, "DBクエリに失敗しました"); +$rowdata = pg_fetch_row($rs, $row); //print" $fName./$rowdata[1]/$rowdata[2]/$rowdata[3]
\n"; $title = $rowdata[1]; @@ -194,13 +140,8 @@ print "\n "; -}else{ - //print "File is looks like BAD:preg
\n"; -}// - }//ereg }//foreach print " \n
削除 ファイル名話数 サブタイ
\n
\n\n\n"; exit; - }elseif ($list== "title"){//新仕様 $query = " @@ -216,5 +157,5 @@ AND foltia_subtitle.m2pfilename = foltia_m2pfiles.m2pfilename ORDER BY foltia_subtitle.tid DESC , foltia_subtitle.startdatetime ASC -LIMIT $lim OFFSET $st + "; @@ -232,32 +173,14 @@ AND foltia_subtitle.m2pfilename = foltia_m2pfiles.m2pfilename ORDER BY foltia_subtitle.startdatetime DESC -LIMIT $lim OFFSET $st "; } -//$rs = m_query($con, $query, "DBクエリに失敗しました"); -$rs = sql_query($con, $query, "DBクエリに失敗しました"); -$rowdata = $rs->fetch(); - -///////////////////////////////////////// -//テーブルの総数取得 - $query2 = " -SELECT COUNT(*) AS cnt FROM foltia_subtitle , foltia_program , foltia_m2pfiles -WHERE foltia_program.tid = foltia_subtitle.tid - AND foltia_subtitle.m2pfilename = foltia_m2pfiles.m2pfilename - "; -$rs2 = sql_query($con, $query2, "DB\?\ィ\e?E?oCO???T????"); -$rowdata2 = $rs2->fetch(); - if (! $rowdata2) { - die_exit("番組データがありません
"); - } -//1O?o?eAA -$dtcnt = $rowdata2[0]; - -///////////////////////////////////////// - -if ($rowdata) { - - do { +$rs = m_query($con, $query, "DBクエリに失敗しました"); +$maxrows = pg_num_rows($rs); + +if ($maxrows > 0){ +for ($row = 0; $row < $maxrows; $row++) { +$rowdata = pg_fetch_row($rs, $row); + $tid = htmlspecialchars($rowdata[0]); $title = htmlspecialchars($rowdata[1]); @@ -267,39 +190,24 @@ $pid = htmlspecialchars($rowdata[5]); //-- - - print " -
"; -if (ereg("syabas",$useragent)){ -print "$fName"; -} -else{ -print "$fName
"; -} -if ($tid > 0){ -print"$title +
+$fName
+$title $count
$subtitle
"; -}else{ -print"$title -$count
-$subtitle
"; -} - if (file_exists("./selectcaptureimage.php") ) { - $capimgpath = preg_replace("/.m2.+/", "", $fName); + $capimgpath = preg_replace("/.m2p/", "", $fName); +// list($citid,$cicountno,$cidate,$citime) = split("-", $capimgpath); +// if($cicountno == ""){ +// $cicountno = "x"; +// } +// $capimgpath = "$citid"."-"."$cicountno"."-"."$cidate"."-"."$citime"; print " キャプ\n"; } - print "\n "; - -//} - - - } while ($rowdata = $rs->fetch()); -}else{ - +}//for +}else{ print " @@ -315,17 +223,6 @@ \n"; -////////////////////////////////////////////////////////////////////// -//クエリ代入 -$query_st = $list; -//Autopageing処理とページのリンクを表示 -list($p2,$page) = page_display($query_st,$p,$p2,$lim,$dtcnt,""); -////////////////////////////////////////////////////////////////////// -print "
"; //Auto pager終わり - - //番組ソートの時、未読番組のタイトルだけ表示 -//if ($list== "title" && $p2 > $page){ if ($list== "title"){ - $query = " SELECT distinct @@ -338,8 +235,9 @@ "; -//$rs = m_query($con, $query, "DBクエリに失敗しました"); -$rs = sql_query($con, $query, "DBクエリに失敗しました"); - $rowdata = $rs->fetch(); - if ($rowdata) { +$rs = m_query($con, $query, "DBクエリに失敗しました"); +$maxrows = pg_num_rows($rs); + + +if ($maxrows > 0){ print "

未読タイトルを表示します。
@@ -354,16 +252,20 @@ "; - do { +for ($row = 0; $row < $maxrows; $row++) { +$rowdata = pg_fetch_row($rs, $row); + $tid = htmlspecialchars($rowdata[0]); $title = htmlspecialchars($rowdata[1]); + + print "$tid$title\n"; - } while ($rowdata = $rs->fetch()); +}//for print "\n"; }//if maxrows }//if title - -?> +?> + Index: trunk/install/php/reserveprogram.php =================================================================== --- trunk/install/php/reserveprogram.php (リビジョン 128) +++ trunk/install/php/reserveprogram.php (リビジョン 1) @@ -15,19 +15,4 @@ */ - -include("./foltialib.php"); -$con = m_connect(); - -if ($useenvironmentpolicy == 1){ - if (!isset($_SERVER['PHP_AUTH_USER'])) { - header("WWW-Authenticate: Basic realm=\"foltia\""); - header("HTTP/1.0 401 Unauthorized"); - redirectlogin(); - exit; - } else { - login($con,$_SERVER['PHP_AUTH_USER'],$_SERVER['PHP_AUTH_PW']); - } -}//end if login - ?> @@ -43,4 +28,5 @@ fetch(); -if (! $rowdata) { + $query = "select title from foltia_program where tid='$tid'"; + $rs = m_query($con, $query, "DBクエリに失敗しました"); + $maxrows = pg_num_rows($rs); + + if ($maxrows == 0) { die_exit("登録番組がありません
"); } - + $rowdata = pg_fetch_row($rs, 0); $title = htmlspecialchars($rowdata[0]); ?> @@ -80,5 +67,5 @@ ?> -「」を番組予約モードで録画予約します。
+「」を番組予約モードで録画予約します。
@@ -89,6 +76,5 @@ 放送局 - デジタル録画優先 - アナログビットレート + ビットレート @@ -100,19 +86,22 @@ FROM foltia_subtitle , foltia_program ,foltia_station WHERE foltia_program.tid = foltia_subtitle.tid AND foltia_station.stationid = foltia_subtitle.stationid - AND foltia_program.tid = ? + AND foltia_program.tid ='$tid' ORDER BY stationrecch DESC "; -// $rs = m_query($con, $query, "DBクエリに失敗しました"); -$rs = sql_query($con, $query, "DBクエリに失敗しました",array($tid)); -$rowdata = $rs->fetch(); -if (! $rowdata) { + + $rs = m_query($con, $query, "DBクエリに失敗しました"); + $maxrows = pg_num_rows($rs); + + if ($maxrows == 0) { echo("放映局情報がまだはいってません
"); } else{ - $maxcols = $rs->columnCount(); + $maxcols = pg_num_fields($rs); echo("\n"); }//endif @@ -126,23 +115,4 @@ - - - - - "> +

 

@@ -179,15 +149,15 @@ FROM foltia_subtitle , foltia_program ,foltia_station WHERE foltia_program.tid = foltia_subtitle.tid AND foltia_station.stationid = foltia_subtitle.stationid - AND foltia_subtitle.startdatetime >= ? AND foltia_program.tid = ? + AND foltia_subtitle.startdatetime >= '$now' AND foltia_program.tid ='$tid' ORDER BY foltia_subtitle.startdatetime ASC "; -// $rs = m_query($con, $query, "DBクエリに失敗しました"); -$rs = sql_query($con, $query, "DBクエリに失敗しました",array($now,$tid)); -$rowdata = $rs->fetch(); -if (! $rowdata) { + $rs = m_query($con, $query, "DBクエリに失敗しました"); + $maxrows = pg_num_rows($rs); + + if ($maxrows == 0) { echo("放映予定はありません
"); } else{ - $maxcols = $rs->columnCount(); + $maxcols = pg_num_fields($rs); ?> @@ -207,15 +177,14 @@ \n"); + /* pg_fetch_row で一行取り出す */ + $rowdata = pg_fetch_row($rs, $row); + for ($col = 0; $col < $maxcols; $col++) { /* 列に対応 */ - if ($col == 3){ - echo("\n"); - }else{ echo("\n"); - } } echo("\n"); - } while ($rowdata = $rs->fetch()); + } }//end if ?> Index: trunk/install/php/foltialib.php =================================================================== --- trunk/install/php/foltialib.php (リビジョン 131) +++ trunk/install/php/foltialib.php (リビジョン 1) @@ -19,6 +19,6 @@ if ($_GET["{$key}"] != "") { $value = $_GET["{$key}"]; - $value = escape_string($value); - $value = htmlspecialchars($value); + escape_string($value); + htmlspecialchars($value); return ($value); } @@ -26,8 +26,9 @@ //GET用数字フォームデコード function getgetnumform($key) { -// if ($_GET["{$key}"] != "") { - if (isset($_GET["{$key}"] )) { + if ($_GET["{$key}"] != "") { $value = $_GET["{$key}"]; - $value = ereg_replace("[^-0-9]", "", $value); + escape_string($value); + htmlspecialchars($value); + $value = ereg_replace("[^0-9]", "", $value); $value = escape_numeric($value); return ($value); @@ -37,8 +38,9 @@ //フォームデコード function getform($key) { + // global $where; if ($_POST["{$key}"] != "") { $value = $_POST["{$key}"]; - $value = escape_string($value); - $value = htmlspecialchars($value); + escape_string($value); + htmlspecialchars($value); return ($value); } @@ -48,7 +50,7 @@ if ($_POST["{$key}"] != "") { $value = $_POST["{$key}"]; - $value = escape_string($value); - $value = htmlspecialchars($value); - $value = ereg_replace("[^0-9]", "", $value); + escape_string($value); + htmlspecialchars($value); + $value = ereg_replace("[^0-9]", "", $value); $value = escape_numeric($value); return ($value); @@ -76,8 +78,8 @@ function die_exit($message) { ?> -

+

-setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); - return($dbh); - } catch (PDOException $e) { - die_exit($e->getMessage() . ": データベースに接続出来ませんでした。"); +/* $con = @pg_connect("host=".DBHOST ." dbname=".DATABASE_NAME . + " user=".USER_NAME . + " password=".USER_PASSWORD); +*/ + $con = @pg_pconnect("host=".DBHOST ." dbname=".DATABASE_NAME . + " user=".USER_NAME . + " password=".USER_PASSWORD); + + + if (!$con) { + die_exit("データベースに接続出来ませんでした。"); } /* データベースと、PHP の内部文字コードが違う場合 */ + return($con); } /* データベースとの接続を切り離す */ -function m_close($dbh) { - return null; - } - -//旧関数 sql_queryに置き換え -function m_query($dbh, $query, $errmessage) { - try { - $rtn = $dbh->query($query); - return($rtn); - } catch (PDOException $e) { + function m_close($con) { + return @pg_close($con); + } + + /* SQL 文を実行 */ + function m_query($con, $query, $errmessage) { + $rtn = @pg_query($con, $query); + if (!$rtn) { /* エラーメッセージに SQL 文を出すのはセキュリティ上良くない!! */ $msg = $errmessage . "
\n" . - $e->getMessage() . "
\n" . - var_export($e->errorInfo, true) . "
\n" . + @pg_last_error($con) . "
\n" . "" . htmlspecialchars($query) . "\n"; -// $dbh->rollBack(); - $dbh = null; + $rtn = @pg_query($con, "rollback");//04.4.8 + m_close($con); die_exit($msg); } - } -/* SQL 文を実行 */ -function sql_query($dbh, $query, $errmessage,$paramarray=null) { - try { - $rtn = $dbh->prepare("$query"); - $rtn->execute($paramarray); return($rtn); - } catch (PDOException $e) { - /* エラーメッセージに SQL 文を出すのはセキュリティ上良くない!! */ - $msg = $errmessage . "
\n" . - $e->getMessage() . "
\n" . - var_export($e->errorInfo, true) . "
\n" . - "" . htmlspecialchars($query) . - "\n"; -// $dbh->rollBack(); - $dbh = null; - die_exit($msg); - } } @@ -181,8 +168,7 @@ function m_showtable($rs) { /* 検索件数 */ - $maxrows = 0; + $maxrows = pg_num_rows($rs); - $rowdata = $rs->fetch(); - if (! $rowdata) { + if ($maxrows == 0) { echo("

データが存在しません

\n"); return 0; @@ -190,5 +176,5 @@ /* フィールド数 */ - $maxcols = $rs->columnCount(); + $maxcols = pg_num_fields($rs); ?>
".htmlspecialchars(foldate2print($rowdata[$col]))."
".htmlspecialchars($rowdata[$col])."
@@ -199,6 +185,5 @@ for ($col = 1; $col < $maxcols; $col++) { /* pg_field_name() はフィールド名を返す */ - $meta = $rs->getColumnMeta($col); - $f_name = htmlspecialchars($meta["name"]); + $f_name = htmlspecialchars(pg_field_name($rs, $col)); echo("\n"); } @@ -209,8 +194,8 @@ \n"); + /* pg_fetch_row で一行取り出す */ + $rowdata = pg_fetch_row($rs, $row); /* 1列目にリンクを張る */ echo(" @@ -229,8 +214,46 @@ } - -function m_viewdata($dbh, $code) { - -/*これ使ってないよね?*/ + /* 指定したコードのデータを表示 */ + function m_viewdata($con, $code) { + /* コードに該当するデータを検索 */ + $query = " +select p.code + ,p.name + ,p.email + ,p.pseudonym + ,s.name as job + ,p.profile + ,to_char(p.editdate, 'YYYY/MM/DD HH24:MI:SS') as editdate + from inet_profile p left join inet_job s on p.job = s.code + where p.code = $code"; + $rs = m_query($con, $query, "個人情報の取得に失敗しました。"); + if (pg_num_rows($rs) == 0) { + echo("

データが存在しません

\n"); + return FALSE; + } + + /* フィールド数 */ + $maxcols = pg_num_fields($rs); + /* 先頭行 */ + $rowdata = pg_fetch_row($rs, 0); + ?> +
$f_name\n"); - } while ($rowdata = $rs->fetch()); + } ?>
+ + + + + + + + + + +
+ foltia | 放映予定 | 新番組 | 予約一覧 | 番組一覧 | 番組表 | 録画一覧(録画順番組順) | 録画ライブラリ | Folcast[iTunesに登録] | "; -if ($useenvironmentpolicy == 1){ - print "【 $username 】"; -} - -print "

\n"; + +print "

foltia | 放映予定 | 新番組 | 予約一覧 | 番組一覧 | 番組表 | 録画一覧(録画順番組順) | 録画ライブラリ | Folcast(RSS)[iTunesにFolcastを登録] |

\n"; } @@ -273,6 +288,6 @@ "; $rs = m_query($con, $query, "DBクエリに失敗しました"); - $rowdata = $rs->fetch(); - if (! $rowdata) { + $maxrows = pg_num_rows($rs); +if ($maxrows == 0) { print("番組データがありません
"); }else{ @@ -280,5 +295,8 @@ //print "
    \n"; - do { +for ($row = 0; $row < $maxrows; $row++) { + +$rowdata = pg_fetch_row($rs, $row); + $printstarttime = substr($rowdata[0],8,2) . ":" . substr($rowdata[0],10,2); $tdclass = "t".substr($rowdata[0],8,2) . substr($rowdata[0],10,2); @@ -299,5 +317,5 @@ \n"; */ - } while ($rowdata = $rs->fetch());//do +}//for //print "
\n"; print "\n"; @@ -390,393 +408,70 @@ function printdiskusage(){//戻り値 なし -list (, $all, $use , $free, $usepercent) = getdiskusage(); + +global $recfolderpath,$recfolderpath; + + exec ( "df -h $recfolderpath | grep $recfolderpath", $hdfreearea); + $freearea = preg_split ("/[\s,]+/", $hdfreearea[0]); + + exec ( "ps ax | grep ffmpeg", $encoding); + exec ( "ps ax | grep faac", $processlock); print " -
$free -
$use/$all($usepercent)
+
$freearea[3] +
$freearea[2]/$freearea[1]($freearea[4])
"; -//exec('ps ax | grep ffmpeg |grep MP4 ' ,$ffmpegprocesses); + +// print "$freearea[1]
$freearea[2]
$freearea[3]
$freearea[4]
$hdfreearea[0]
$encoding[0]
$processlock[0]

\n"; + print "$encoding[0]
$processlock[0]

\n"; + +/* +
170GB +
1.1TB/1.3TB(87%)
+
+*/ + }//end sub -function getdiskusage(){//戻り値 配列 [,全体容量, 使用容量 , 空き容量, 利用割合] - -global $recfolderpath,$recfolderpath; - -// exec ( "df -h $recfolderpath | grep $recfolderpath", $hdfreearea); -// $freearea = preg_split ("/[\s,]+/", $hdfreearea[0]); - exec ( "df -hP $recfolderpath", $hdfreearea); - $freearea = preg_split ("/[\s,]+/", $hdfreearea[count($hdfreearea)-1]); - - return $freearea; - -}//endsub - - -function printtrcnprocesses(){ - -$ffmpegprocesses = `ps ax | grep ffmpeg | grep -v grep | wc -l `; -$uptime = exec('uptime'); - -print "
"; -print "$uptime
\n"; -print "トラコン稼働数:$ffmpegprocesses
\n"; -print "
"; - -}//endsub - - -function warndiskfreearea(){ - -global $demomode; - -if ($demomode){ -print ""; -}else{ - -global $recfolderpath,$hdfreearea ; - - exec ( "df $recfolderpath | grep $recfolderpath", $hdfreearea); - $freearea = preg_split ("/[\s,]+/", $hdfreearea[0]); -$freebytes = $freearea[3]; -if ($freebytes == "" ){ -// -//print ""; -}elseif($freebytes > 1024*1024*100 ){// 100GB以上あいてれば -//なにもしない -print ""; -}elseif($freebytes > 1024*1024*50 ){// 100GB以下 -print " -"; -}elseif($freebytes > 1024*1024*30 ){// 50GB以下 -print " -"; -}elseif($freebytes > 0 ){// 30GB以下 -print " -"; -}else{ //空き容量 0バイト -print " -"; -}//endif freebytess - -}//endif demomode - -}//endsub - - - -function foldatevalidation($foldate){ - -if (strlen($foldate) == 12 ){ - - $startyear = substr($foldate,0,4); - $startmonth = substr($foldate,4,2); - $startday = substr($foldate,6,2); - $starthour = substr($foldate,8,2); - $startmin = substr($foldate,10,2); - - $startepoch = date ("U",mktime($starthour , $startmin , 0, $startmonth , $startday, $startyear)); - $nowe = time(); - if ($startepoch > $nowe){ - //print "$foldate:$startepoch:$nowe"; - return TRUE; - }else{ - return FALSE; - } //end if $startepoch > $nowe -}else{ - return FALSE; -}//end if ($foldate) == 12 - -}//end function - - - -function login($con,$name,$passwd){ -global $environmentpolicytoken; - -//入力内容確認 - if (((mb_ereg('[^0-9a-zA-Z]', $name)) ||(mb_ereg('[^0-9a-zA-Z]', $passwd) ))){ - - //print "エラー処理\n"; - //print ""; - redirectlogin(); - -}else{ -//print "正常処理\n"; -//db検索 -escape_string($name); -escape_string($passwd); - -$query = " -SELECT memberid ,userclass,name,passwd1 -FROM foltia_envpolicy -WHERE foltia_envpolicy.name = '$name' - "; - $useraccount = m_query($con, $query, "DBクエリに失敗しました"); - $rowdata = $useraccount->fetch(); - if (! $rowdata) { - header("HTTP/1.0 401 Unauthorized"); - redirectlogin(); - } - - $memberid = $rowdata[0]; - $userclass = $rowdata[1]; - $username = $rowdata[2]; - $dbpasswd = $rowdata[3]; - - $rowdata = $useraccount->fetch(); - if ($rowdata) { - header("HTTP/1.0 401 Unauthorized"); - redirectlogin(); - } - -// passwdをdbから取りだし -if ($userclass == 0){ -$dbpasswd = "$dbpasswd"; -}else{ -// db passwdとトークンを連結し -$dbpasswd = "$dbpasswd"."$environmentpolicytoken"; -} -//それが入力と一致すれば認証 -if ($passwd == $dbpasswd) { -//print "認証成功
$dbpasswd $passwd\n"; -}else{ -//print "認証失敗
$dbpasswd $passwd\n"; - header("HTTP/1.0 401 Unauthorized"); - //print ""; +$viewstations = pg_num_rows($rs); +print "

+ + + +"; +for ($i=0 ; $i < $viewstations ; $i++){ + $rowdata = pg_fetch_row($rs, $i); + if ($rowdata[1] != ""){ + print " \n"; + } } + +print " + + +"; +for ($i=0 ; $i < $viewstations ; $i++){ + $rowdata = pg_fetch_row($rs, $i); + if ($rowdata[3] != ""){ + print "\n"; + } } -//ココから新コード -//・局リスト -$query = "SELECT stationid, stationname, stationrecch, ontvcode -FROM foltia_station -WHERE \"ontvcode\" LIKE '%ontvjapan%' -ORDER BY stationid ASC , stationrecch -LIMIT ? OFFSET ? + +print " + +
$rowdata[1]
"; + renderepgstation($con,$rowdata[3],$start); + print "
"; -//$slistrs = m_query($con, $query, "DBクエリに失敗しました"); -$slistrs = sql_query($con, $query, "DBクエリに失敗しました",array($maxdisplay,$offset)); -while ($rowdata = $slistrs->fetch()) { - $stationhash[] = $rowdata[3]; - $snames[] = $rowdata[1]; // headder -} + ?> -//・時間と全順番のハッシュ作る -$epgstart = $start ; -$epgend = calcendtime($start , (8*60)); - -$query = "SELECT DISTINCT startdatetime -FROM foltia_epg -WHERE foltia_epg.ontvchannel in ( - SELECT ontvcode - FROM foltia_station - WHERE \"ontvcode\" LIKE '%ontvjapan%' - ORDER BY stationid ASC , stationrecch - LIMIT ? OFFSET ? - ) -AND startdatetime >= ? -AND startdatetime < ? -ORDER BY foltia_epg.startdatetime ASC "; - -//$rs = m_query($con, $query, "DBクエリに失敗しました"); -$rs = sql_query($con, $query, "DBクエリに失敗しました",array($maxdisplay,$offset,$start,$epgend)); - -//print "$query
\n"; - -$rowdata = $rs->fetch(); -if (! $rowdata) { -//番組データがない -$colmnums = 2; -}else{ - $colmnums = 0; - do { - $colmnums++; - $timetablehash[$rowdata[0]] = $colmnums; -// print "$rowdata[0]:$i+1
\n"; - } while ($rowdata = $rs->fetch()); -} -//print "colmnums $colmnums
\n"; - -//・局ごとに縦に配列入れていく -foreach ($stationhash as $stationname) { -$epgstart = $start ; -$epgend = calcendtime($start , (8*60)); -$query = " -SELECT startdatetime , enddatetime , lengthmin , epgtitle , epgdesc , epgcategory ,ontvchannel ,epgid , epgcategory -FROM foltia_epg -WHERE foltia_epg.ontvchannel = ? AND -enddatetime > ? AND -startdatetime < ? -ORDER BY foltia_epg.startdatetime ASC - "; - -// $statiodh = m_query($con, $query, "DBクエリに失敗しました"); - $statiodh = sql_query($con, $query, "DBクエリに失敗しました",array($stationname,$epgstart,$epgend)); - $stationrowdata = $statiodh->fetch(); - if (! $stationrowdata) { - //print("番組データがありません
"); - $item[0]["$stationname"] = ">番組データがありません"; -}else{ - do { -$printstarttime = substr($stationrowdata[0],8,2) . ":" . substr($stationrowdata[0],10,2); -$tdclass = "t".substr($stationrowdata[0],8,2) . substr($stationrowdata[0],10,2); -$title = $stationrowdata[3]; -$title = htmlspecialchars(z2h($title)); -$desc = $stationrowdata[4]; -$desc = htmlspecialchars(z2h($desc)); - -if ($epgviewstyle){ -$desc=$desc ."

"; -}else{ -$desc=$desc ."

". htmlspecialchars(foldate2print($stationrowdata[1])) ; -} - - -$height = htmlspecialchars($stationrowdata[2]) * 3; -$epgid = htmlspecialchars($stationrowdata[7]); -$epgcategory = htmlspecialchars($stationrowdata[8]); - -if (isset($timetablehash["$stationrowdata[0]"])){ - $number = $timetablehash["$stationrowdata[0]"]; -//print "$stationname $stationrowdata[0] [$number] $printstarttime $title $desc
\n"; -}else{ - $number = 0; -//print "$stationname $stationrowdata[0] 現在番組 $printstarttime $title $desc
\n"; -} -if ($epgcategory == ""){ -$item["$number"]["$stationname"] = " onClick=\"location = './reserveepg.php?epgid=$epgid'\">$printstarttime $title $desc"; -}else{ -$item["$number"]["$stationname"] = " id=\"$epgcategory\" onClick=\"location = './reserveepg.php?epgid=$epgid'\">$printstarttime $title $desc"; -}//if - - } while ($stationrowdata = $statiodh->fetch()); -}//if - -//・局ごとに間隔決定 -//$item[$i][NHK] はヌルかどうか判定 -$dataplace = 0 ; //初期化 -$rowspan = 0; - -for ($i=1; $i <= $colmnums ; $i++){ - if ($i === ($colmnums )){//最終行 - $rowspan = $i - $dataplace ; - //そして自分自身にタグを - //if ((!isset($item[$i][$stationname])) && ($item[$i][$stationname] == "")){ - if (!isset($item[$i][$stationname])){ - $item[$i][$stationname] = null ; - }else{ - $item[$i][$stationname] = ""; - $rowspan--; - } - //ROWSPAN - if ($rowspan === 1 ){ - $item[$dataplace][$stationname] = ""; - }else{ - $item[$dataplace][$stationname] = ""; -// $item[$dataplace][$stationname] = ""; - } - -// }elseif ((!isset($item[$i][$stationname]))&&($item[$i][$stationname] == "")){ - }elseif (!isset($item[$i][$stationname])){ - //ヌルなら - //$item[$i][$stationname] = $item[$i][$stationname] ; - $item[$i][$stationname] = null ; -// $item[$i][$stationname] = "
" ; - }else{ - //なんか入ってるなら - $rowspan = $i - $dataplace; - $itemDataplaceStationname = null; - if (isset($item[$dataplace][$stationname])){ - $itemDataplaceStationname = $item[$dataplace][$stationname]; - } - if ($rowspan === 1 ){ - $item[$dataplace][$stationname] = ""; - }else{ - $item[$dataplace][$stationname] = ""; -// $item[$dataplace][$stationname] = ""; - } - $dataplace = $i; - - } -}//for -}// end of for://・局ごとに縦に配列入れていく - -//・テーブルレンダリング -print "\n"; - -//ヘッダ -foreach ($snames as $s) { - print "" ; -} -//本体 -for ($l = 0 ;$l < $colmnums; $l++){ - print ""; - foreach ($stationhash as $stationname) { - print_r($item[$l]["$stationname"]); - } - print "\n"; -} -print "
".htmlspecialchars($s)."
\n"; - -print "

$navigationbar

"; -?> -
-凡例 - - - - - - - - - - - - - - - - - - -
情報アニメ・特撮ニュース・報道ドラマバラエティドキュメンタリー・教養教育音楽映画趣味・実用キッズスポーツその他演劇
- - Index: trunk/install/php/showlib.php =================================================================== --- trunk/install/php/showlib.php (リビジョン 119) +++ trunk/install/php/showlib.php (リビジョン 1) @@ -15,20 +15,4 @@ */ - -include("./foltialib.php"); -$con = m_connect(); - -if ($useenvironmentpolicy == 1){ - if (!isset($_SERVER['PHP_AUTH_USER'])) { - header("WWW-Authenticate: Basic realm=\"foltia\""); - header("HTTP/1.0 401 Unauthorized"); - redirectlogin(); - exit; - } else { - login($con,$_SERVER['PHP_AUTH_USER'],$_SERVER['PHP_AUTH_PW']); - } -}//end if login - - ?> @@ -37,20 +21,6 @@ - - - - -"; -}else{ -print " - -"; -} -?> + + foltia:MP4 Lib @@ -58,54 +28,20 @@ -
-

- -
-"; -}else{ - print " -
-"; +$con = m_connect(); +$now = date("YmdHi"); + +?> + +
+録画ライブラリ表示

-
-

再生可能ライブラリを表示します。
-"; -} +?> +

録画ライブラリ表示

+
+

再生可能ライブラリを表示します。
-//////////////////////////////////////////////////////// -//レコードの総数取得 -$query = " -SELECT -COUNT(DISTINCT tid) -FROM foltia_mp4files -"; - -$rs = sql_query($con, $query, "DBクエリに失敗しました"); -$rowdata = $rs->fetch(); -$dtcnt = htmlspecialchars($rowdata[0]); -//echo $dtcnt; -// -if (! $rowdata) { - die_exit("番組データがありません
"); -} - -//////////////////////////////////////////////////////// - -//Autopager -echo "

"; - +fetch(); +$maxrows = pg_num_rows($rs); -if ($rowdata) { -if(ereg("iPhone",$useragent)){ - print "
    "; -}else{ - +if ($maxrows > 0 ){ print " @@ -140,8 +70,6 @@ "; - -} - - do { +for ($row = 0; $row < $maxrows; $row++) { + $rowdata = pg_fetch_row($rs, $row); $title = $rowdata[1]; $counts = $rowdata[2]; @@ -150,8 +78,4 @@ $counts = htmlspecialchars($counts); - -if(ereg("iPhone",$useragent)){ -print "
  • $title
  • \n"; -}else{ print " @@ -162,34 +86,15 @@ \n "; -} - } while ($rowdata = $rs->fetch()); - -if(ereg("iPhone",$useragent)){ - print "\n\n\n"; -}else{ +}//for print "
    - -"; -//////////////////////////////////////////////////////////////// -//Autopageing処理とページのリンクを表示 -page_display("",$p,$p2,$lim,$dtcnt,""); -/////////////////////////////////////////////////////////////// - -print " "; -} - }else{ print "録画ファイルが存在しません。"; }//end if - - - - /* //旧仕様 @@ -210,5 +115,5 @@ "; $rs = m_query($con, $query, "DBクエリに失敗しました"); -$rowdata = $rs->fetch(); +$rowdata = pg_fetch_row($rs, $row); //print" $fName./$rowdata[1]/$rowdata[2]/$rowdata[3]
    \n"; $title = $rowdata[1]; Index: trunk/install/php/reserveepg.php =================================================================== --- trunk/install/php/reserveepg.php (リビジョン 122) +++ trunk/install/php/reserveepg.php (リビジョン 1) @@ -15,18 +15,4 @@ */ - -include("./foltialib.php"); -$con = m_connect(); - -if ($useenvironmentpolicy == 1){ - if (!isset($_SERVER['PHP_AUTH_USER'])) { - header("WWW-Authenticate: Basic realm=\"foltia\""); - header("HTTP/1.0 401 Unauthorized"); - redirectlogin(); - exit; - } else { - login($con,$_SERVER['PHP_AUTH_USER'],$_SERVER['PHP_AUTH_PW']); - } -}//end if login ?> @@ -39,4 +25,5 @@ fetch(); -if (! $rowdata) { + $rs = m_query($con, $query, "DBクエリに失敗しました"); + $maxrows = pg_num_rows($rs); + + if ($maxrows == 0) { die_exit("登録番組がありません
    "); } - + $rowdata = pg_fetch_row($rs, 0); //$title = htmlspecialchars($rowdata[0]); ?> @@ -76,4 +64,7 @@
    EPGから下記番組を録画予約します。
    +
    + +
    @@ -90,36 +81,6 @@ $progdesc = htmlspecialchars($rowdata[6]); $progdesc = z2h($progdesc); -$progcat = htmlspecialchars(z2h($rowdata[7])); - -if ($progcat == "information"){ -$progcat = '情報'; -}elseif ($progcat == "anime"){ -$progcat = 'アニメ・特撮'; -}elseif ($progcat == "news"){ -$progcat = 'ニュース・報道'; -}elseif ($progcat == "drama"){ -$progcat = 'ドラマ'; -}elseif ($progcat == "variety"){ -$progcat = 'バラエティ'; -}elseif ($progcat == "documentary"){ -$progcat = 'ドキュメンタリー・教養'; -}elseif ($progcat == "education"){ -$progcat = '教育'; -}elseif ($progcat == "music"){ -$progcat = '音楽'; -}elseif ($progcat == "cinema"){ -$progcat = '映画'; -}elseif ($progcat == "hobby"){ -$progcat = '趣味・実用'; -}elseif ($progcat == "kids"){ -$progcat = 'キッズ'; -}elseif ($progcat == "sports"){ -$progcat = 'スポーツ'; -}elseif ($progcat == "etc"){ -$progcat = 'その他'; -}elseif ($progcat == "stage"){ -$progcat = '演劇'; -} - +$progcat = htmlspecialchars($rowdata[7]); +$progcat = z2h($progcat); $epgid = $epgid ; $stationid = htmlspecialchars($rowdata[10]); @@ -134,48 +95,27 @@ //重複確認 -$query = " -SELECT - foltia_program.title, foltia_program.tid, stationname, - foltia_station.stationid, foltia_subtitle.countno, - foltia_subtitle.subtitle, foltia_subtitle.startdatetime, - foltia_subtitle.lengthmin, foltia_tvrecord.bitrate, - foltia_subtitle.startoffset, foltia_subtitle.pid -FROM foltia_subtitle , foltia_program ,foltia_station ,foltia_tvrecord -WHERE foltia_tvrecord.tid = foltia_program.tid AND foltia_tvrecord.stationid = foltia_station .stationid AND foltia_program.tid = foltia_subtitle.tid AND foltia_station.stationid = foltia_subtitle.stationid -AND foltia_subtitle.startdatetime = ? -AND foltia_subtitle.enddatetime = ? -AND foltia_station.stationid = ? -UNION -SELECT - foltia_program.title, foltia_program.tid, stationname, - foltia_station.stationid, foltia_subtitle.countno, - foltia_subtitle.subtitle, foltia_subtitle.startdatetime, - foltia_subtitle.lengthmin, foltia_tvrecord.bitrate, - foltia_subtitle.startoffset, foltia_subtitle.pid -FROM foltia_tvrecord -LEFT OUTER JOIN foltia_subtitle on (foltia_tvrecord.tid = foltia_subtitle.tid ) -LEFT OUTER JOIN foltia_program on (foltia_tvrecord.tid = foltia_program.tid ) -LEFT OUTER JOIN foltia_station on (foltia_subtitle.stationid = foltia_station.stationid ) -WHERE foltia_tvrecord.stationid = 0 -AND foltia_subtitle.startdatetime = ? -AND foltia_subtitle.enddatetime = ? -AND foltia_station.stationid = ? -"; -//print ""; + $query = " +SELECT foltia_program.title,foltia_subtitle.tid,foltia_subtitle.pid +FROM foltia_subtitle ,foltia_program ,foltia_tvrecord +WHERE startdatetime ='$startfoltime' +AND enddatetime = '$endfoltime' +AND foltia_subtitle.stationid = '$stationid' +AND foltia_program.tid = foltia_subtitle.tid +AND foltia_tvrecord.tid = foltia_program.tid +AND foltia_tvrecord.stationid = foltia_subtitle.stationid +"; + + $rs = m_query($con, $query, "DBクエリに失敗しました"); + $maxrows = pg_num_rows($rs); -print "\n"; - -//$rs = m_query($con, $query, "DBクエリに失敗しました"); -$rs = sql_query($con, $query, "DBクエリに失敗しました",array($startfoltime,$endfoltime,$stationid,$startfoltime,$endfoltime,$stationid)); -$chkoverwrap = $rs->fetch(); -if (! $chkoverwrap) { + if ($maxrows == 0) { //重複なし - print "
    \n"; }else{ + $chkoverwrap = pg_fetch_row($rs, 0); $prereservedtitle = htmlspecialchars($chkoverwrap[0]); $tid = htmlspecialchars($chkoverwrap[1]); $pid = htmlspecialchars($chkoverwrap[2]); - print "
    この番組は既に予約済みです。 \n"; + print "この番組は既に予約済みです。 \n"; if ($tid > 1){ print "予約番組名:$prereservedtitle
    \n"; @@ -201,5 +141,4 @@ - Index: trunk/install/php/listreserve.php =================================================================== --- trunk/install/php/listreserve.php (リビジョン 128) +++ trunk/install/php/listreserve.php (リビジョン 1) @@ -10,33 +10,9 @@ 引数 -r:録画デバイス数 -startdate:特定日付からの予約状況。YYYYmmddHHii形式で。表示数に限定かけてないのでレコード数が大量になると重くなるかも知れません。 - +なし DCC-JPL Japan/foltia project - -History - -2009/5/1 -重複予約検出処理の修正 http://www.dcc-jpl.com/foltia/ticket/7 -パッチ適用 */ - -include("./foltialib.php"); -$con = m_connect(); - -if ($useenvironmentpolicy == 1){ - if (!isset($_SERVER['PHP_AUTH_USER'])) { - header("WWW-Authenticate: Basic realm=\"foltia\""); - header("HTTP/1.0 401 Unauthorized"); - redirectlogin(); - exit; - } else { - login($con,$_SERVER['PHP_AUTH_USER'],$_SERVER['PHP_AUTH_PW']); - } -}//end if login -$userclass = getuserclass($con); - ?> @@ -50,33 +26,38 @@ 200501010000){ -}else{ - $now = date("YmdHi"); -} + + include("./foltialib.php"); + +$con = m_connect(); + +$now = date("YmdHi"); + $query = " SELECT - foltia_program.tid, stationname, foltia_program.title, - foltia_subtitle.countno, foltia_subtitle.subtitle, - foltia_subtitle.startdatetime as x, foltia_subtitle.lengthmin, - foltia_tvrecord.bitrate, foltia_subtitle.startoffset, - foltia_subtitle.pid, foltia_subtitle.epgaddedby, -foltia_tvrecord.digital +foltia_program .tid, +stationname, +foltia_program .title, +foltia_subtitle.countno, +foltia_subtitle.subtitle, +foltia_subtitle.startdatetime , +foltia_subtitle.lengthmin , +foltia_tvrecord.bitrate , +foltia_subtitle.startoffset , +foltia_subtitle.pid FROM foltia_subtitle , foltia_program ,foltia_station ,foltia_tvrecord WHERE foltia_tvrecord.tid = foltia_program.tid AND foltia_tvrecord.stationid = foltia_station .stationid AND foltia_program.tid = foltia_subtitle.tid AND foltia_station.stationid = foltia_subtitle.stationid -AND foltia_subtitle.enddatetime >= ? +AND foltia_subtitle.enddatetime >= '$now' UNION SELECT - foltia_program.tid, stationname, foltia_program.title, - foltia_subtitle.countno, foltia_subtitle.subtitle, - foltia_subtitle.startdatetime, foltia_subtitle.lengthmin, - foltia_tvrecord.bitrate, foltia_subtitle.startoffset, - foltia_subtitle.pid, foltia_subtitle.epgaddedby, -foltia_tvrecord.digital +foltia_program .tid, +stationname, +foltia_program .title, +foltia_subtitle.countno, +foltia_subtitle.subtitle, +foltia_subtitle.startdatetime , +foltia_subtitle.lengthmin , +foltia_tvrecord.bitrate , +foltia_subtitle.startoffset , +foltia_subtitle.pid FROM foltia_tvrecord LEFT OUTER JOIN foltia_subtitle on (foltia_tvrecord.tid = foltia_subtitle.tid ) @@ -84,18 +65,13 @@ LEFT OUTER JOIN foltia_station on (foltia_subtitle.stationid = foltia_station.stationid ) WHERE foltia_tvrecord.stationid = 0 AND - foltia_subtitle.enddatetime >= ? ORDER BY x ASC +foltia_subtitle.enddatetime >= '$now' ORDER BY \"startdatetime\" ASC "; -// $rs = m_query($con, $query, "DBクエリに失敗しました"); - $rs = sql_query($con, $query, "DBクエリに失敗しました",array($now,$now)); - -//チューナー数 -if (getgetnumform(r) != ""){ - $recunits = getgetnumform(r); -}elseif($recunits == ""){ - $recunits = 2; -} - -?> + $rs = m_query($con, $query, "DBクエリに失敗しました"); + $maxrows = pg_num_rows($rs); + +?> + + @@ -108,11 +84,12 @@

    録画予約番組放映予定と予約番組名を表示します。

    -fetch(); - if (! $rowdata) { +\n"; }else{ + + /* フィールド数 */ - $maxcols = $rs->columnCount(); + $maxcols = pg_num_fields($rs); ?> @@ -124,8 +101,7 @@ - + - @@ -135,136 +111,14 @@ \n"); - + /* pg_fetch_row で一行取り出す */ + $rowdata = pg_fetch_row($rs, $row); $pid = htmlspecialchars($rowdata[9]); $tid = htmlspecialchars($rowdata[0]); $title = htmlspecialchars($rowdata[2]); -$subtitle = htmlspecialchars($rowdata[4]); -$dbepgaddedby = htmlspecialchars($rowdata[10]); - -//重複検出 -//開始時刻 $rowdata[5] -//終了時刻 -$endtime = calcendtime($rowdata[5],$rowdata[6]); -//番組の開始時刻より遅い時刻に終了し、終了時刻より前にはじまる番組があるかどうか -//オンボードチューナー録画 -$query = " -SELECT - foltia_program.tid, stationname, foltia_program.title, - foltia_subtitle.countno, foltia_subtitle.subtitle, - foltia_subtitle.startdatetime, foltia_subtitle.lengthmin, - foltia_tvrecord.bitrate, foltia_subtitle.startoffset, - foltia_subtitle.pid, foltia_tvrecord.digital -FROM foltia_subtitle , foltia_program ,foltia_station ,foltia_tvrecord -WHERE foltia_tvrecord.tid = foltia_program.tid AND foltia_tvrecord.stationid = foltia_station .stationid AND foltia_program.tid = foltia_subtitle.tid AND foltia_station.stationid = foltia_subtitle.stationid -AND foltia_subtitle.enddatetime > ? -AND foltia_subtitle.startdatetime < ? -UNION -SELECT - foltia_program.tid, stationname, foltia_program.title, - foltia_subtitle.countno, foltia_subtitle.subtitle, - foltia_subtitle.startdatetime, foltia_subtitle.lengthmin, - foltia_tvrecord.bitrate, foltia_subtitle.startoffset, - foltia_subtitle.pid, foltia_tvrecord.digital -FROM foltia_tvrecord -LEFT OUTER JOIN foltia_subtitle on (foltia_tvrecord.tid = foltia_subtitle.tid ) -LEFT OUTER JOIN foltia_program on (foltia_tvrecord.tid = foltia_program.tid ) -LEFT OUTER JOIN foltia_station on (foltia_subtitle.stationid = foltia_station.stationid ) -WHERE foltia_tvrecord.stationid = 0 AND -foltia_subtitle.enddatetime > ? -AND foltia_subtitle.startdatetime < ? -"; - $rclass = ""; -// $overlap = m_query($con, $query, "DBクエリに失敗しました"); - $overlap = sql_query($con, $query, "DBクエリに失敗しました",array($rowdata[5],$endtime,$rowdata[5],$endtime)); - $owrowall = $overlap->fetchAll(); - $overlapmaxrows = count($owrowall); - if ($overlapmaxrows > ($recunits) ){ - - $owtimeline = array(); - - for ($rrow = 0; $rrow < $overlapmaxrows ; $rrow++) { - $owrowdata = $owrowall[$rrow]; - $owtimeline[ $owrowdata['startdatetime'] ] = $owtimeline[ $owrowdata['startdatetime'] ] +1; - - $owrend = calcendtime( $owrowdata['startdatetime'], $owrowdata['lengthmin'] ); - $owtimeline[ $owrend ] = $owtimeline[ $owrend ] -1; - //注意: NULL に減算子を適用しても何も起こりませんが、NULL に加算子を 適用すると 1 となります。 - } - - ksort ( $owtimeline ); - - $owcount = 0; - foreach ( $owtimeline as $key => $val ) { - $owcount += $val; - - if ( $owcount > $recunits ) { - $rclass = "overwraped"; - break; - } - } - } - -//外部チューナー録画 -$externalinputs = 1; //現状一系統のみ -$query = " -SELECT - foltia_program.tid, stationname, foltia_program.title, - foltia_subtitle.countno, foltia_subtitle.subtitle, - foltia_subtitle.startdatetime, foltia_subtitle.lengthmin, - foltia_tvrecord.bitrate, foltia_subtitle.startoffset, - foltia_subtitle.pid, foltia_tvrecord.digital -FROM foltia_subtitle , foltia_program ,foltia_station ,foltia_tvrecord -WHERE foltia_tvrecord.tid = foltia_program.tid AND foltia_tvrecord.stationid = foltia_station .stationid AND foltia_program.tid = foltia_subtitle.tid AND foltia_station.stationid = foltia_subtitle.stationid -AND foltia_subtitle.enddatetime > ? -AND foltia_subtitle.startdatetime < ? -AND (foltia_station.stationrecch = '0' OR foltia_station.stationrecch = '-1' ) -UNION -SELECT - foltia_program.tid, stationname, foltia_program.title, - foltia_subtitle.countno, foltia_subtitle.subtitle, - foltia_subtitle.startdatetime, foltia_subtitle.lengthmin, - foltia_tvrecord.bitrate, foltia_subtitle.startoffset, - foltia_subtitle.pid, foltia_tvrecord.digital -FROM foltia_tvrecord -LEFT OUTER JOIN foltia_subtitle on (foltia_tvrecord.tid = foltia_subtitle.tid ) -LEFT OUTER JOIN foltia_program on (foltia_tvrecord.tid = foltia_program.tid ) -LEFT OUTER JOIN foltia_station on (foltia_subtitle.stationid = foltia_station.stationid ) -WHERE foltia_tvrecord.stationid = 0 AND -foltia_subtitle.enddatetime > ? -AND foltia_subtitle.startdatetime < ? -AND (foltia_station.stationrecch = '0' OR foltia_station.stationrecch = '-1' ) - "; -// $eoverlap = m_query($con, $query, "DBクエリに失敗しました"); - $eoverlap = sql_query($con, $query, "DBクエリに失敗しました",array($rowdata[5], $endtime,$rowdata[5], $endtime)); - $eowrowall = $eoverlap->fetchAll(); - $eoverlapmaxrows = count($eowrowall); - if ($eoverlapmaxrows > ($externalinputs) ){ - - $eowtimeline = array(); - - for ($erow = 0; $erow < $eoverlapmaxrows ; $erow++) { - $eowrowdata = $eowrowall[$erow]; - $eowtimeline[ $eowrowdata['startdatetime'] ] = $eowtimeline[ $eowrowdata['startdatetime'] ] +1; - - $eowrend = calcendtime( $eowrowdata['startdatetime'], $eowrowdata['lengthmin'] ); - $eowtimeline[ $eowrend ] = $eowtimeline[ $eowrend ] -1; - } - - ksort ( $eowtimeline ); - - $eowcount = 0; - foreach ( $eowtimeline as $key => $val ) { - $eowcount += $val; - - if ( $eowcount > $externalinputs ) { - $rclass = "exoverwraped"; - break; - } - } - - } +$subtitle = htmlspecialchars($rowdata[4]); + echo("\n"); // TID @@ -284,5 +138,4 @@ }else{ print "$title"; - } print "\n"; @@ -293,15 +146,8 @@ print "\n"; }else{ - //if ( $userclass <= 2){ - if (($mymemberid == $dbepgaddedby)||($userclass <= 1)){ - if ($userclass <= 1 ){//管理者なら - $membername = getmemberid2name($con,$dbepgaddedby); - $membername = ":" . $membername ; - }else{ - $membername = ""; - } - print "\n"; - }else{ - print "\n"; + if ($protectmode) { + print "\n"; + }else{ + print "\n"; } } @@ -313,47 +159,32 @@ //録画レート echo("\n"); - - //デジタル優先 - echo("\n"); echo("\n"); - } while ($rowdata = $rs->fetch()); + } ?>
    話数 サブタイトル開始時刻(ズレ)開始時刻 総尺 画質デジタル優先
    $subtitle
    $subtitle [予約解除$membername]
    $subtitle [解除不能]
    $subtitle
    $subtitle [予約解除]
    ".htmlspecialchars($rowdata[7])."
    "); - if (htmlspecialchars($rowdata[11]) == 1){ - print "する"; - }else{ - print "しない"; - } - echo("
    - - - - - - - -
    アナログ重複表示
    エンコーダ数
    チューナー重複
    外部入力重複
    - - fetch(); -if (! $rowdata) { + $rs = m_query($con, $query, "DBクエリに失敗しました"); + $maxrows = pg_num_rows($rs); + + if ($maxrows == 0) { //なければなにもしない }else{ - $maxcols = $rs->columnCount(); + $maxcols = pg_num_fields($rs); ?> @@ -368,6 +199,4 @@ 録画リスト 画質 - デジタル優先 - @@ -376,5 +205,8 @@ \n"); //予約解除 - if ( $userclass <= 1){ + if ($protectmode) { + echo("−"); + }else{ echo("解除\n"); - }else{ - echo("−"); + htmlspecialchars($rowdata[4]) . "\">解除\n"); } //TID @@ -393,18 +225,12 @@ echo("".htmlspecialchars($rowdata[1])."
    \n"); //タイトル - echo("" . + echo("" . htmlspecialchars($rowdata[2]) . "\n"); //MP4 echo("mp4\n"); - //画質(アナログビットレート) + echo("".htmlspecialchars($rowdata[3])."
    \n"); - //デジタル優先 - echo(""); - if (htmlspecialchars($rowdata[5]) == 1){ - print "する"; - }else{ - print "しない"; - } + echo("\n"); }else{ @@ -414,15 +240,7 @@ EPG録画 mp4"; - echo("".htmlspecialchars($rowdata[3])."
    "); - //デジタル優先 - echo(""); - if (htmlspecialchars($rowdata[5]) == 1){ - print "する"; - }else{ - print "しない"; - } - echo("\n"); + echo("".htmlspecialchars($rowdata[3])."
    \n"); }//if tid 0 - } while ($rowdata = $rs->fetch()); + }//for }//else ?> Index: trunk/install/php/index.php =================================================================== --- trunk/install/php/index.php (リビジョン 119) +++ trunk/install/php/index.php (リビジョン 1) @@ -13,28 +13,17 @@ オプション mode:"new"を指定すると、新番組(第1話)のみの表示となる。 -now:YmdHi形式で日付を指定するとその日からの番組表が表示される。 DCC-JPL Japan/foltia project */ - -include("./foltialib.php"); +?> + + 209912342353 )){ - $now = date("YmdHi"); -} +$now = date("YmdHi"); + + function printtitle(){ @@ -44,22 +33,10 @@ - "; -//ディスク空き容量によって背景色表示変更 -warndiskfreearea(); -print "foltia:放映予定 + +foltia:放映予定 "; }//end function printtitle() - - -////////////////////////// -//ページの表示レコード数 -$lim = 300; -//クエリ取得 -$p = getgetnumform(p); -//ページ取得の計算 -list($st,$p,$p2) = number_page($p,$lim); -//////////////////////////// //同一番組他局検索 @@ -77,29 +54,33 @@ WHERE foltia_tvrecord.tid = foltia_program.tid AND foltia_program.tid = foltia_subtitle.tid -AND foltia_subtitle.enddatetime >= ? -ORDER BY \"startdatetime\" ASC -LIMIT 1000 - "; -// $reservedrssametid = m_query($con, $query, "DBクエリに失敗しました"); -$reservedrssametid = sql_query($con, $query, "DBクエリに失敗しました",array($now)); -$rowdata = $reservedrssametid->fetch(); -if ($rowdata) { - do { +AND foltia_subtitle.enddatetime >= '$now' + ORDER BY \"startdatetime\" ASC + "; + $reservedrssametid = m_query($con, $query, "DBクエリに失敗しました"); + $reservedmaxrowssameid = pg_num_rows($reservedrssametid); + + if ($reservedmaxrowssameid > 0 ){ + for ($rrow = 0; $rrow < $reservedmaxrowssameid ; $rrow++) { + $rowdata = pg_fetch_row($reservedrssametid, $rrow); $reservedpidsametid[] = $rowdata[7]; - } while ($rowdata = $reservedrssametid->fetch()); - + } $rowdata = ""; + $rrow = ""; }else{ - $reservedpidsametid = array(); + $reservedpidsametid = "" ; }//end if -$reservedrssametid->closeCursor(); //録画番組検索 $query = " SELECT - foltia_program.tid, stationname, foltia_program.title, - foltia_subtitle.countno, foltia_subtitle.subtitle, - foltia_subtitle.startdatetime as x, foltia_subtitle.lengthmin, - foltia_tvrecord.bitrate, foltia_subtitle.pid +foltia_program .tid, +stationname, +foltia_program .title, +foltia_subtitle.countno, +foltia_subtitle.subtitle, +foltia_subtitle.startdatetime , +foltia_subtitle.lengthmin , +foltia_tvrecord.bitrate , +foltia_subtitle.pid FROM foltia_subtitle , foltia_program ,foltia_station ,foltia_tvrecord WHERE foltia_tvrecord.tid = foltia_program.tid AND foltia_tvrecord.stationid = foltia_station .stationid AND foltia_program.tid = foltia_subtitle.tid AND foltia_station.stationid = foltia_subtitle.stationid @@ -107,8 +88,13 @@ UNION SELECT - foltia_program.tid, stationname, foltia_program.title, - foltia_subtitle.countno, foltia_subtitle.subtitle, - foltia_subtitle.startdatetime, foltia_subtitle.lengthmin, - foltia_tvrecord.bitrate, foltia_subtitle.pid +foltia_program .tid, +stationname, +foltia_program .title, +foltia_subtitle.countno, +foltia_subtitle.subtitle, +foltia_subtitle.startdatetime , +foltia_subtitle.lengthmin , +foltia_tvrecord.bitrate , +foltia_subtitle.pid FROM foltia_tvrecord LEFT OUTER JOIN foltia_subtitle on (foltia_tvrecord.tid = foltia_subtitle.tid ) @@ -116,40 +102,17 @@ LEFT OUTER JOIN foltia_station on (foltia_subtitle.stationid = foltia_station.stationid ) WHERE foltia_tvrecord.stationid = 0 AND - foltia_subtitle.enddatetime >= '$now' ORDER BY x ASC -LIMIT 1000 - "; - -//$reservedrs = m_query($con, $query, "DBクエリに失敗しました"); -$query = " -SELECT - foltia_program.tid, stationname, foltia_program.title, - foltia_subtitle.countno, foltia_subtitle.subtitle, - foltia_subtitle.startdatetime as x, foltia_subtitle.lengthmin, - foltia_tvrecord.bitrate, foltia_subtitle.pid -FROM foltia_subtitle , foltia_program ,foltia_station ,foltia_tvrecord -WHERE foltia_tvrecord.tid = foltia_program.tid AND foltia_tvrecord.stationid = foltia_station .stationid AND foltia_program.tid = foltia_subtitle.tid AND foltia_station.stationid = foltia_subtitle.stationid -AND foltia_subtitle.enddatetime >= ? -UNION -SELECT - foltia_program.tid, stationname, foltia_program.title, - foltia_subtitle.countno, foltia_subtitle.subtitle, - foltia_subtitle.startdatetime, foltia_subtitle.lengthmin, - foltia_tvrecord.bitrate, foltia_subtitle.pid -FROM foltia_tvrecord -LEFT OUTER JOIN foltia_subtitle on (foltia_tvrecord.tid = foltia_subtitle.tid ) -LEFT OUTER JOIN foltia_program on (foltia_tvrecord.tid = foltia_program.tid ) -LEFT OUTER JOIN foltia_station on (foltia_subtitle.stationid = foltia_station.stationid ) -WHERE foltia_tvrecord.stationid = 0 AND - foltia_subtitle.enddatetime >= ? ORDER BY x ASC - "; -$reservedrs = sql_query($con, $query, "DBクエリに失敗しました",array($now,$now)); - -$rowdata = $reservedrs->fetch(); -if ($rowdata) { - do { +foltia_subtitle.enddatetime >= '$now' ORDER BY \"startdatetime\" ASC + "; + + $reservedrs = m_query($con, $query, "DBクエリに失敗しました"); + $reservedmaxrows = pg_num_rows($reservedrs); + + if ($reservedmaxrows > 0 ){ + for ($rrow = 0; $rrow < $reservedmaxrows ; $rrow++) { + $rowdata = pg_fetch_row($reservedrs, $rrow); $reservedpid[] = $rowdata[8]; - } while ($rowdata = $reservedrs->fetch()); + } }else{ - $reservedpid = array(); + $reservedpid = ""; }//end if @@ -160,89 +123,45 @@ $query = " SELECT - foltia_program.tid, stationname, foltia_program.title, - foltia_subtitle.countno, foltia_subtitle.subtitle, - foltia_subtitle.startdatetime, foltia_subtitle.lengthmin, - foltia_subtitle.pid, foltia_subtitle.startoffset +foltia_program .tid, +stationname, +foltia_program .title, +foltia_subtitle.countno, +foltia_subtitle.subtitle, +foltia_subtitle.startdatetime , +foltia_subtitle.lengthmin , +foltia_subtitle.pid , +foltia_subtitle.startoffset FROM foltia_subtitle , foltia_program ,foltia_station WHERE foltia_program.tid = foltia_subtitle.tid AND foltia_station.stationid = foltia_subtitle.stationid AND foltia_subtitle.enddatetime >= '$now' AND foltia_subtitle.countno = '1' -ORDER BY foltia_subtitle.startdatetime ASC -LIMIT 1000 - "; -$query = " +ORDER BY foltia_subtitle.startdatetime ASC + "; + $rs = m_query($con, $query, "DBクエリに失敗しました"); + $maxrows = pg_num_rows($rs); + + +}else{ + $query = " SELECT - foltia_program.tid, stationname, foltia_program.title, - foltia_subtitle.countno, foltia_subtitle.subtitle, - foltia_subtitle.startdatetime, foltia_subtitle.lengthmin, - foltia_subtitle.pid, foltia_subtitle.startoffset -FROM foltia_subtitle , foltia_program ,foltia_station -WHERE foltia_program.tid = foltia_subtitle.tid AND foltia_station.stationid = foltia_subtitle.stationid - AND foltia_subtitle.enddatetime >= ? AND foltia_subtitle.countno = '1' -ORDER BY foltia_subtitle.startdatetime ASC -LIMIT 1000 - "; - -}else{ - -$query = " - SELECT - foltia_program.tid, stationname, foltia_program.title, - foltia_subtitle.countno, foltia_subtitle.subtitle, - foltia_subtitle.startdatetime, foltia_subtitle.lengthmin, - foltia_subtitle.pid, foltia_subtitle.startoffset +foltia_program .tid, +stationname, +foltia_program .title, +foltia_subtitle.countno, +foltia_subtitle.subtitle, +foltia_subtitle.startdatetime , +foltia_subtitle.lengthmin , +foltia_subtitle.pid , +foltia_subtitle.startoffset FROM foltia_subtitle , foltia_program ,foltia_station WHERE foltia_program.tid = foltia_subtitle.tid AND foltia_station.stationid = foltia_subtitle.stationid AND foltia_subtitle.enddatetime >= '$now' -ORDER BY foltia_subtitle.startdatetime ASC -LIMIT 1000 - "; - -///////////////////////////////////////////////////////////// -//レコード総数取得 -$query = " - SELECT -COUNT(*) AS cnt -FROM foltia_subtitle , foltia_program ,foltia_station -WHERE foltia_program.tid = foltia_subtitle.tid AND foltia_station.stationid = foltia_subtitle.stationid - AND foltia_subtitle.enddatetime >= ? -LIMIT 1000 - "; - -$rs = sql_query($con, $query, "DBクエリに失敗しました",array($now)); -$rowdata = $rs->fetch(); - -$dtcnt = htmlspecialchars($rowdata[0]); -// echo $dtcnt; - -if (! $rowdata) { - die_exit("番組データがありません
    "); -}//endif -//////////////////////////////////////////////////////////// - -//レコード表示 -$query = " - SELECT - foltia_program.tid, stationname, foltia_program.title, - foltia_subtitle.countno, foltia_subtitle.subtitle, - foltia_subtitle.startdatetime, foltia_subtitle.lengthmin, - foltia_subtitle.pid, foltia_subtitle.startoffset -FROM foltia_subtitle , foltia_program ,foltia_station -WHERE foltia_program.tid = foltia_subtitle.tid AND foltia_station.stationid = foltia_subtitle.stationid - AND foltia_subtitle.enddatetime >= ? -ORDER BY foltia_subtitle.startdatetime ASC -LIMIT $lim OFFSET $st - "; - - -///////////////////////////////////////////////////////////////// +ORDER BY foltia_subtitle.startdatetime ASC + "; + $rs = m_query($con, $query, "DBクエリに失敗しました"); + $maxrows = pg_num_rows($rs); }//end if -//$rs = m_query($con, $query, "DBクエリに失敗しました"); -$rs = sql_query($con, $query, "DBクエリに失敗しました",array($now)); -$rowdata = $rs->fetch(); -// -// -if (! $rowdata) { +if ($maxrows == 0) { header("Status: 404 Not Found",TRUE,404); printtitle(); @@ -252,5 +171,4 @@ print "
    \n"; die_exit("番組データがありません
    "); - }//endif @@ -274,11 +192,7 @@

    放映番組リストを表示します。

    -columnCount(); - -//Autopager -echo "
    "; - + $maxcols = pg_num_fields($rs); ?> @@ -292,4 +206,5 @@ + @@ -298,5 +213,8 @@ \n"); - - } while ($rowdata = $rs->fetch()); + } ?>
    開始時刻(ズレ) 総尺
    - Index: trunk/install/php/showlibc.php =================================================================== --- trunk/install/php/showlibc.php (リビジョン 124) +++ trunk/install/php/showlibc.php (リビジョン 1) @@ -16,17 +16,5 @@ */ -include("./foltialib.php"); -$con = m_connect(); - -if ($useenvironmentpolicy == 1){ - if (!isset($_SERVER['PHP_AUTH_USER'])) { - header("WWW-Authenticate: Basic realm=\"foltia\""); - header("HTTP/1.0 401 Unauthorized"); - redirectlogin(); - exit; - } else { - login($con,$_SERVER['PHP_AUTH_USER'],$_SERVER['PHP_AUTH_PW']); - } -}//end if login + include("./foltialib.php"); $tid = getgetnumform(tid); @@ -41,92 +29,54 @@ + + + - - -"; -}else{ -print " - - - -"; -} -if ($tid == "") { - print "foltia:Lib - \n"; +print " +foltia:Lib $tid + +"; + if ($tid == "") { + print " \n"; printhtmlpageheader(); die_exit("再生可能番組がありません
    "); - } + } + +$con = m_connect(); +$now = date("YmdHi"); ?> - + +
    + +

    録画ライブラリ番組個別表示

    +
    +

    再生可能ムービーを表示します。
    fetch(); -if (! $rowdata) { -$syobocaldb = `curl "http://cal.syoboi.jp/db?Command=TitleLookup&TID=$tid" | head -2 `; +WHERE foltia_program.tid = $tid +"; +$rs = m_query($con, $query, "DBクエリに失敗しました"); +$maxrows = pg_num_rows($rs); +if ($maxrows == 0 ){ + $syobocaldb = `curl "http://cal.syoboi.jp/db?Command=TitleLookup&TID=$tid" | head -2 `; $syobocaldb = mb_convert_encoding($syobocaldb, "EUC-JP", "UTF-8"); $syobocaldb = preg_match("/.*<\/Title>/", $syobocaldb,$title); $title = $title[0]; $title = strip_tags($title); - $title = htmlspecialchars($title) ; -}else{ +}else{ +$rowdata = pg_fetch_row($rs, 0); $title = $rowdata[0]; -$title = htmlspecialchars($title) ; -} -//ヘッダ続き -print "<title>foltia:Lib $tid:$title"; -$serveruri = getserveruri(); - - -if(ereg("iPhone",$useragent)){ - print " -

    -

    - -
    -"; -}else{ - -print " -
    -"; - printhtmlpageheader(); -print "

    録画ライブラリ番組個別表示

    -
    -

    再生可能ムービーを表示します。
    "; -if ($tid == 0){ -print "$title 【この番組のFolcastiTunesに登録]】
    \n"; -}else{ +} print "$title -【この番組のFolcast -[iTunesに登録]】
    \n"; -} -}// endif if(ereg("iPhone",$useragent)) - + htmlspecialchars($tid) . "\" target=\"_blank\">" . + htmlspecialchars($title) . " 【この番組のFolcast
    \n"; + + //確認 if (file_exists ("$recfolderpath/$tid.localized")){ @@ -138,4 +88,6 @@ } + + //新仕様/* 2006/10/26 */ if (file_exists("./selectcaptureimage.php") ) { @@ -144,39 +96,4 @@ $serverfqdn = getserverfqdn(); - -//Autopager -echo "

    "; -?> - - -

    - - -fetch(); -$dtcnt = htmlspecialchars($rowdata[0]); -//echo $dtcnt; -// -if (! $rowdata) { - die_exit("番組データがありません。
    "); -}//endif - -////////////////////////////////////////////////////////// -//レコード表示 $query = " SELECT @@ -194,24 +111,20 @@ LEFT JOIN foltia_program ON foltia_mp4files.tid = foltia_program.tid -WHERE foltia_mp4files.tid = ? +WHERE foltia_mp4files.tid = $tid ORDER BY \"startdatetime\" ASC -LIMIT $lim OFFSET $st "; $rs = ""; -//$rs = m_query($con, $query, "DBクエリに失敗しました"); -$rs = sql_query($con, $query, "DBクエリに失敗しました",array($tid)); -$rowdata = $rs->fetch(); -if ($rowdata) { -if(ereg("iPhone",$useragent)){ - print "
      "; -}else{ +$rs = m_query($con, $query, "DBクエリに失敗しました"); +$maxrows = pg_num_rows($rs); +if ($maxrows > 0 ){ print " "; -} - - do { + +for ($row = 0; $row < $maxrows; $row++) { + $rowdata = pg_fetch_row($rs, $row); + $title = $rowdata[1]; @@ -233,7 +146,5 @@ $subtitle = htmlspecialchars($subtitle); $onairdate = htmlspecialchars($onairdate); -$pid = htmlspecialchars($rowdata[6]); $fName = htmlspecialchars($rowdata[7]); - if (ereg(".MP4", $fName)){ $thumbnail = $fName; @@ -248,12 +159,10 @@ } //Starlight Breaker向け拡張 -//$debug_pg_num_rows = $rs ->rowCount(); +//$debug_pg_num_rows = pg_num_rows ($rs ); $caplink = ""; - if ($sbpluginexist == 1) { - //$capimgpath = htmlspecialchars(preg_replace("/.m2p/", "", $rowdata[5])); - $capimgpath = htmlspecialchars(preg_replace("/.m2./", "", $rowdata[5])); - - if (($capimgpath != "") && (file_exists("$recfolderpath/$tid.localized/img/$capimgpath") )){ +if (($sbpluginexist == 1) && (pg_num_rows ($rs ) > 0)){ + $capimgpath = htmlspecialchars(preg_replace("/.m2p/", "", $rowdata[5])); + if (file_exists("$recfolderpath/$tid.localized/img/$capimgpath") ){ $caplink = " / キャプ"; }else{ @@ -264,65 +173,144 @@ }//end if sb -if (file_exists("$recfolderpath/$tid.localized/mp4/$thumbnail") ){ - $imgsrcuri = "$httpmediamappath/$tid.localized/mp4/$thumbnail\" alt=\"$title $count $subtitle"; -}else{ - $imgsrcuri = "./img/no-thumbnail-img.png\" alt=\"NO IMAGE"; -} - -if(ereg("iPhone",$useragent)){ - -print "
    • $count $subtitle $onairdate
    • \n"; - -}else{ -print " - +print " + + -"; - if ($tid == 0){ - print "\n "; - }else{ - print "\n "; - }//if - - -print " + + - - -"; - - -}//endif iPhone - - } while ($rowdata = $rs->fetch()); + + +"; + + +}//for }else{ print "録画ファイルがありません
      \n"; }//if -if(ereg("iPhone",$useragent)){ - print "
    • 一覧へ戻る
    • \n"; - print "\n"; -}else{ - print "
      $count
      $subtitle$subtitle
      $subtitle
      $onairdate
      削除 / - $fName / - Player / - $caplink
      $fName / $caplink
      \n"; -} - -////////////////////////////////////////////// -//クエリ代入 -$query_st = $tid; -//Autopager処理とページのリンク表示 -page_display($query_st,$p,$p2,$lim,$dtcnt,""); -////////////////////////////////////////////// +//旧仕様 +/* +//ディレクトリからファイル一覧を取得 + exec ("ls $recfolderpath/$tid.localized/mp4/*.MP4", $mp4files); + +if (file_exists("./selectcaptureimage.php") ) { + $sbpluginexist = 1; +} + +$serverfqdn = getserverfqdn(); + +foreach($mp4files as $pathfName) { +$fName = ""; +$fNametmp = split("/",$pathfName); +$fName = array_pop($fNametmp); + if(($fName == ".") or ($fName == "..") ){ continue; } + +if (ereg(".MP4", $fName)){ + $thumbnail = $fName; + $thumbnail = ereg_replace(".MP4", ".THM", $thumbnail); + // $filesplit = split("-",$fName); +//print "\n"; +$query = ""; + +$query = " +SELECT +foltia_program.tid, +foltia_program.title, +foltia_subtitle.countno, +foltia_subtitle.subtitle, +foltia_subtitle.startdatetime , +foltia_subtitle.m2pfilename , +foltia_subtitle.pid +FROM foltia_subtitle , foltia_program +WHERE foltia_subtitle.pspfilename = '$fName' +AND foltia_program.tid = foltia_subtitle.tid +AND foltia_program.tid = $tid +"; +//print "\n"; +$rs = ""; +$rs = m_query($con, $query, "DBクエリに失敗しました"); + +if (pg_num_rows ($rs ) == 0){ + + $count = "[話数]"; + $subtitle = "[サブタイトル]"; + $onairdate = "[放映日]"; + $caplink = ""; +}else{ + +$rowdata = pg_fetch_row($rs, $row); +$title = $rowdata[1]; + +if ($rowdata[2]== "" ){ + $count = "[話数]"; +}else{ + $count = $rowdata[2]; +} +if ($rowdata[3]== "" ){ + $subtitle = "[サブタイトル]"; +}else{ + $subtitle = $rowdata[3]; +} +$onairdate = $rowdata[4]; + +$tid = htmlspecialchars($rowdata[0]); +$title = htmlspecialchars($title); +$count = htmlspecialchars($count); +$subtitle = htmlspecialchars($subtitle); +$onairdate = htmlspecialchars($onairdate); + +$day = substr($onairdate,0,4)."/".substr($onairdate,4,2)."/".substr($onairdate,6,2); +$time = substr($onairdate,8,2).":".substr($onairdate,10,2); +$onairdate = "$day $time"; + +//Starlight Breaker向け拡張 +//$debug_pg_num_rows = pg_num_rows ($rs ); +$caplink = ""; + +if (($sbpluginexist == 1) && (pg_num_rows ($rs ) > 0)){ + $capimgpath = htmlspecialchars(preg_replace("/.m2p/", "", $rowdata[5])); + if (file_exists("$recfolderpath/$tid.localized/img/$capimgpath") ){ + $caplink = " / キャプ"; + }else{ + $caplink = " / キャプなし"; + } +}else{ +$caplink = ""; +}//end if sb + +} //end if 検索件数が0のとき +//-- +print " + + + $count + + + $subtitle + + + $onairdate + + + $fName / $caplink + +"; + + }//end if ereg m2p +}//end foreach + +*/ +//旧仕様ココまで ?> + + + - - Index: trunk/install/php/graytable.css =================================================================== --- trunk/install/php/graytable.css (リビジョン 94) +++ trunk/install/php/graytable.css (リビジョン 1) @@ -1,3 +1,4 @@ -// body * {margin:0px;padding:0px;border:0px;} + +body * {margin:0px;padding:0px;border:0px;} body { @@ -24,11 +25,9 @@ background-color: #CCC; } -th + th, td + td { border-right: 1px solid #AAA; } -td { vertical-align: top; } -th, td { border-right: 1px solid #AAA;border-bottom: 1px solid #AAA; padding: 3px;} +th + th, td + td { border-left: 1px solid #AAA; } +td { border-top: 1px solid #AAA; } +th, td { padding: 3px;} tr.reserved{background-color: #FFDDDD;} tr.reservedtitle{background-color: #DDDDFF;} -tr.overwraped{background-color: #FF0000;} -tr.exoverwraped{background-color: #FF00FF;} /* 全体共通 */ @@ -59,26 +58,1465 @@ li {width:90px;background:#ffa;padding:2px;border:1px solid white;line-height:1.1em;} -td#anime {background:#FFC0CB;} /* アニメ・特撮 */ -td#kids {background:#FFFFDC;} /* キッズ */ -td#sports {background:#D7D7FF;} /* スポーツ */ -td#etc {background:#F3F3F3;} /* その他 */ -td#news {background:#E3C0FF;} /* ニュース・報道 */ -td#cinema {background:#FAA5FF;} /* 映画 */ -td#education{background-color:#C9C9C9;} /* 教育 */ -td#documentary{background-color:#E8FFE8;} /* ドキュメンタリー・教養 */ -td#music{background-color: #FFEAD5;} /* 音楽 */ -td#variety{background-color: #E0F0CA;} /* バラエティ */ -td#hobby{background-color: #FDF7BB;} /* 趣味・実用 */ -td#information {background:#B6FFFA;} /* 情報 */ -td#stage{background-color: #FFC0E3;} /* 演劇 */ -td#drama {background:#FFD0FF;} /* ドラマ */ - -#information:hover, #hobby:hover, #education:hover, #music:hover, #stage:hover, #cinema:hover, #variety:hover, #news:hover, #drama:hover, #documentary:hover, #sports:hover, #kids:hover, #anime:hover, #etc:hover - { - background-color: #FFFA4D; - padding-right: 1px; padding-bottom:1px; - border-right: 3px solid #aaa; border-bottom: 3px solid #666; - cursor:pointer; - } - - +.t0800 {position:absolute;top: 0px ;} +.t0801 {position:absolute;top: 4px ;} +.t0802 {position:absolute;top: 8px ;} +.t0803 {position:absolute;top: 12px ;} +.t0804 {position:absolute;top: 16px ;} +.t0805 {position:absolute;top: 20px ;} +.t0806 {position:absolute;top: 24px ;} +.t0807 {position:absolute;top: 28px ;} +.t0808 {position:absolute;top: 32px ;} +.t0809 {position:absolute;top: 36px ;} +.t0810 {position:absolute;top: 40px ;} +.t0811 {position:absolute;top: 44px ;} +.t0812 {position:absolute;top: 48px ;} +.t0813 {position:absolute;top: 52px ;} +.t0814 {position:absolute;top: 56px ;} +.t0815 {position:absolute;top: 60px ;} +.t0816 {position:absolute;top: 64px ;} +.t0817 {position:absolute;top: 68px ;} +.t0818 {position:absolute;top: 72px ;} +.t0819 {position:absolute;top: 76px ;} +.t0820 {position:absolute;top: 80px ;} +.t0821 {position:absolute;top: 84px ;} +.t0822 {position:absolute;top: 88px ;} +.t0823 {position:absolute;top: 92px ;} +.t0824 {position:absolute;top: 96px ;} +.t0825 {position:absolute;top: 100px ;} +.t0826 {position:absolute;top: 104px ;} +.t0827 {position:absolute;top: 108px ;} +.t0828 {position:absolute;top: 112px ;} +.t0829 {position:absolute;top: 116px ;} +.t0830 {position:absolute;top: 120px ;} +.t0831 {position:absolute;top: 124px ;} +.t0832 {position:absolute;top: 128px ;} +.t0833 {position:absolute;top: 132px ;} +.t0834 {position:absolute;top: 136px ;} +.t0835 {position:absolute;top: 140px ;} +.t0836 {position:absolute;top: 144px ;} +.t0837 {position:absolute;top: 148px ;} +.t0838 {position:absolute;top: 152px ;} +.t0839 {position:absolute;top: 156px ;} +.t0840 {position:absolute;top: 160px ;} +.t0841 {position:absolute;top: 164px ;} +.t0842 {position:absolute;top: 168px ;} +.t0843 {position:absolute;top: 172px ;} +.t0844 {position:absolute;top: 176px ;} +.t0845 {position:absolute;top: 180px ;} +.t0846 {position:absolute;top: 184px ;} +.t0847 {position:absolute;top: 188px ;} +.t0848 {position:absolute;top: 192px ;} +.t0849 {position:absolute;top: 196px ;} +.t0850 {position:absolute;top: 200px ;} +.t0851 {position:absolute;top: 204px ;} +.t0852 {position:absolute;top: 208px ;} +.t0853 {position:absolute;top: 212px ;} +.t0854 {position:absolute;top: 216px ;} +.t0855 {position:absolute;top: 220px ;} +.t0856 {position:absolute;top: 224px ;} +.t0857 {position:absolute;top: 228px ;} +.t0858 {position:absolute;top: 232px ;} +.t0859 {position:absolute;top: 236px ;} + +.t0900 {position:absolute;top: 244px ;} +.t0901 {position:absolute;top: 248px ;} +.t0902 {position:absolute;top: 252px ;} +.t0903 {position:absolute;top: 256px ;} +.t0904 {position:absolute;top: 260px ;} +.t0905 {position:absolute;top: 264px ;} +.t0906 {position:absolute;top: 268px ;} +.t0907 {position:absolute;top: 272px ;} +.t0908 {position:absolute;top: 276px ;} +.t0909 {position:absolute;top: 280px ;} +.t0910 {position:absolute;top: 284px ;} +.t0911 {position:absolute;top: 288px ;} +.t0912 {position:absolute;top: 292px ;} +.t0913 {position:absolute;top: 296px ;} +.t0914 {position:absolute;top: 300px ;} +.t0915 {position:absolute;top: 304px ;} +.t0916 {position:absolute;top: 308px ;} +.t0917 {position:absolute;top: 312px ;} +.t0918 {position:absolute;top: 316px ;} +.t0919 {position:absolute;top: 320px ;} +.t0920 {position:absolute;top: 324px ;} +.t0921 {position:absolute;top: 328px ;} +.t0922 {position:absolute;top: 332px ;} +.t0923 {position:absolute;top: 336px ;} +.t0924 {position:absolute;top: 340px ;} +.t0925 {position:absolute;top: 344px ;} +.t0926 {position:absolute;top: 348px ;} +.t0927 {position:absolute;top: 352px ;} +.t0928 {position:absolute;top: 356px ;} +.t0929 {position:absolute;top: 360px ;} +.t0930 {position:absolute;top: 364px ;} +.t0931 {position:absolute;top: 368px ;} +.t0932 {position:absolute;top: 372px ;} +.t0933 {position:absolute;top: 376px ;} +.t0934 {position:absolute;top: 380px ;} +.t0935 {position:absolute;top: 384px ;} +.t0936 {position:absolute;top: 388px ;} +.t0937 {position:absolute;top: 392px ;} +.t0938 {position:absolute;top: 396px ;} +.t0939 {position:absolute;top: 400px ;} +.t0940 {position:absolute;top: 404px ;} +.t0941 {position:absolute;top: 408px ;} +.t0942 {position:absolute;top: 412px ;} +.t0943 {position:absolute;top: 416px ;} +.t0944 {position:absolute;top: 420px ;} +.t0945 {position:absolute;top: 424px ;} +.t0946 {position:absolute;top: 428px ;} +.t0947 {position:absolute;top: 432px ;} +.t0948 {position:absolute;top: 436px ;} +.t0949 {position:absolute;top: 440px ;} +.t0950 {position:absolute;top: 444px ;} +.t0951 {position:absolute;top: 448px ;} +.t0952 {position:absolute;top: 452px ;} +.t0953 {position:absolute;top: 456px ;} +.t0954 {position:absolute;top: 460px ;} +.t0955 {position:absolute;top: 464px ;} +.t0956 {position:absolute;top: 468px ;} +.t0957 {position:absolute;top: 472px ;} +.t0958 {position:absolute;top: 476px ;} +.t0959 {position:absolute;top: 480px ;} + +.t1000 {position:absolute;top: 488px ;} +.t1001 {position:absolute;top: 492px ;} +.t1002 {position:absolute;top: 496px ;} +.t1003 {position:absolute;top: 500px ;} +.t1004 {position:absolute;top: 504px ;} +.t1005 {position:absolute;top: 508px ;} +.t1006 {position:absolute;top: 512px ;} +.t1007 {position:absolute;top: 516px ;} +.t1008 {position:absolute;top: 520px ;} +.t1009 {position:absolute;top: 524px ;} +.t1010 {position:absolute;top: 528px ;} +.t1011 {position:absolute;top: 532px ;} +.t1012 {position:absolute;top: 536px ;} +.t1013 {position:absolute;top: 540px ;} +.t1014 {position:absolute;top: 544px ;} +.t1015 {position:absolute;top: 548px ;} +.t1016 {position:absolute;top: 552px ;} +.t1017 {position:absolute;top: 556px ;} +.t1018 {position:absolute;top: 560px ;} +.t1019 {position:absolute;top: 564px ;} +.t1020 {position:absolute;top: 568px ;} +.t1021 {position:absolute;top: 572px ;} +.t1022 {position:absolute;top: 576px ;} +.t1023 {position:absolute;top: 580px ;} +.t1024 {position:absolute;top: 584px ;} +.t1025 {position:absolute;top: 588px ;} +.t1026 {position:absolute;top: 592px ;} +.t1027 {position:absolute;top: 596px ;} +.t1028 {position:absolute;top: 600px ;} +.t1029 {position:absolute;top: 604px ;} +.t1030 {position:absolute;top: 608px ;} +.t1031 {position:absolute;top: 612px ;} +.t1032 {position:absolute;top: 616px ;} +.t1033 {position:absolute;top: 620px ;} +.t1034 {position:absolute;top: 624px ;} +.t1035 {position:absolute;top: 628px ;} +.t1036 {position:absolute;top: 632px ;} +.t1037 {position:absolute;top: 636px ;} +.t1038 {position:absolute;top: 640px ;} +.t1039 {position:absolute;top: 644px ;} +.t1040 {position:absolute;top: 648px ;} +.t1041 {position:absolute;top: 652px ;} +.t1042 {position:absolute;top: 656px ;} +.t1043 {position:absolute;top: 660px ;} +.t1044 {position:absolute;top: 664px ;} +.t1045 {position:absolute;top: 668px ;} +.t1046 {position:absolute;top: 672px ;} +.t1047 {position:absolute;top: 676px ;} +.t1048 {position:absolute;top: 680px ;} +.t1049 {position:absolute;top: 684px ;} +.t1050 {position:absolute;top: 688px ;} +.t1051 {position:absolute;top: 692px ;} +.t1052 {position:absolute;top: 696px ;} +.t1053 {position:absolute;top: 700px ;} +.t1054 {position:absolute;top: 704px ;} +.t1055 {position:absolute;top: 708px ;} +.t1056 {position:absolute;top: 712px ;} +.t1057 {position:absolute;top: 716px ;} +.t1058 {position:absolute;top: 720px ;} +.t1059 {position:absolute;top: 724px ;} + +.t1100 {position:absolute;top: 732px ;} +.t1101 {position:absolute;top: 736px ;} +.t1102 {position:absolute;top: 740px ;} +.t1103 {position:absolute;top: 744px ;} +.t1104 {position:absolute;top: 748px ;} +.t1105 {position:absolute;top: 752px ;} +.t1106 {position:absolute;top: 756px ;} +.t1107 {position:absolute;top: 760px ;} +.t1108 {position:absolute;top: 764px ;} +.t1109 {position:absolute;top: 768px ;} +.t1110 {position:absolute;top: 772px ;} +.t1111 {position:absolute;top: 776px ;} +.t1112 {position:absolute;top: 780px ;} +.t1113 {position:absolute;top: 784px ;} +.t1114 {position:absolute;top: 788px ;} +.t1115 {position:absolute;top: 792px ;} +.t1116 {position:absolute;top: 796px ;} +.t1117 {position:absolute;top: 800px ;} +.t1118 {position:absolute;top: 804px ;} +.t1119 {position:absolute;top: 808px ;} +.t1120 {position:absolute;top: 812px ;} +.t1121 {position:absolute;top: 816px ;} +.t1122 {position:absolute;top: 820px ;} +.t1123 {position:absolute;top: 824px ;} +.t1124 {position:absolute;top: 828px ;} +.t1125 {position:absolute;top: 832px ;} +.t1126 {position:absolute;top: 836px ;} +.t1127 {position:absolute;top: 840px ;} +.t1128 {position:absolute;top: 844px ;} +.t1129 {position:absolute;top: 848px ;} +.t1130 {position:absolute;top: 852px ;} +.t1131 {position:absolute;top: 856px ;} +.t1132 {position:absolute;top: 860px ;} +.t1133 {position:absolute;top: 864px ;} +.t1134 {position:absolute;top: 868px ;} +.t1135 {position:absolute;top: 872px ;} +.t1136 {position:absolute;top: 876px ;} +.t1137 {position:absolute;top: 880px ;} +.t1138 {position:absolute;top: 884px ;} +.t1139 {position:absolute;top: 888px ;} +.t1140 {position:absolute;top: 892px ;} +.t1141 {position:absolute;top: 896px ;} +.t1142 {position:absolute;top: 900px ;} +.t1143 {position:absolute;top: 904px ;} +.t1144 {position:absolute;top: 908px ;} +.t1145 {position:absolute;top: 912px ;} +.t1146 {position:absolute;top: 916px ;} +.t1147 {position:absolute;top: 920px ;} +.t1148 {position:absolute;top: 924px ;} +.t1149 {position:absolute;top: 928px ;} +.t1150 {position:absolute;top: 932px ;} +.t1151 {position:absolute;top: 936px ;} +.t1152 {position:absolute;top: 940px ;} +.t1153 {position:absolute;top: 944px ;} +.t1154 {position:absolute;top: 948px ;} +.t1155 {position:absolute;top: 952px ;} +.t1156 {position:absolute;top: 956px ;} +.t1157 {position:absolute;top: 960px ;} +.t1158 {position:absolute;top: 964px ;} +.t1159 {position:absolute;top: 968px ;} + +.t1200 {position:absolute;top: 976px ;} +.t1201 {position:absolute;top: 980px ;} +.t1202 {position:absolute;top: 984px ;} +.t1203 {position:absolute;top: 988px ;} +.t1204 {position:absolute;top: 992px ;} +.t1205 {position:absolute;top: 996px ;} +.t1206 {position:absolute;top: 1000px ;} +.t1207 {position:absolute;top: 1004px ;} +.t1208 {position:absolute;top: 1008px ;} +.t1209 {position:absolute;top: 1012px ;} +.t1210 {position:absolute;top: 1016px ;} +.t1211 {position:absolute;top: 1020px ;} +.t1212 {position:absolute;top: 1024px ;} +.t1213 {position:absolute;top: 1028px ;} +.t1214 {position:absolute;top: 1032px ;} +.t1215 {position:absolute;top: 1036px ;} +.t1216 {position:absolute;top: 1040px ;} +.t1217 {position:absolute;top: 1044px ;} +.t1218 {position:absolute;top: 1048px ;} +.t1219 {position:absolute;top: 1052px ;} +.t1220 {position:absolute;top: 1056px ;} +.t1221 {position:absolute;top: 1060px ;} +.t1222 {position:absolute;top: 1064px ;} +.t1223 {position:absolute;top: 1068px ;} +.t1224 {position:absolute;top: 1072px ;} +.t1225 {position:absolute;top: 1076px ;} +.t1226 {position:absolute;top: 1080px ;} +.t1227 {position:absolute;top: 1084px ;} +.t1228 {position:absolute;top: 1088px ;} +.t1229 {position:absolute;top: 1092px ;} +.t1230 {position:absolute;top: 1096px ;} +.t1231 {position:absolute;top: 1100px ;} +.t1232 {position:absolute;top: 1104px ;} +.t1233 {position:absolute;top: 1108px ;} +.t1234 {position:absolute;top: 1112px ;} +.t1235 {position:absolute;top: 1116px ;} +.t1236 {position:absolute;top: 1120px ;} +.t1237 {position:absolute;top: 1124px ;} +.t1238 {position:absolute;top: 1128px ;} +.t1239 {position:absolute;top: 1132px ;} +.t1240 {position:absolute;top: 1136px ;} +.t1241 {position:absolute;top: 1140px ;} +.t1242 {position:absolute;top: 1144px ;} +.t1243 {position:absolute;top: 1148px ;} +.t1244 {position:absolute;top: 1152px ;} +.t1245 {position:absolute;top: 1156px ;} +.t1246 {position:absolute;top: 1160px ;} +.t1247 {position:absolute;top: 1164px ;} +.t1248 {position:absolute;top: 1168px ;} +.t1249 {position:absolute;top: 1172px ;} +.t1250 {position:absolute;top: 1176px ;} +.t1251 {position:absolute;top: 1180px ;} +.t1252 {position:absolute;top: 1184px ;} +.t1253 {position:absolute;top: 1188px ;} +.t1254 {position:absolute;top: 1192px ;} +.t1255 {position:absolute;top: 1196px ;} +.t1256 {position:absolute;top: 1200px ;} +.t1257 {position:absolute;top: 1204px ;} +.t1258 {position:absolute;top: 1208px ;} +.t1259 {position:absolute;top: 1212px ;} + +.t1300 {position:absolute;top: 1220px ;} +.t1301 {position:absolute;top: 1224px ;} +.t1302 {position:absolute;top: 1228px ;} +.t1303 {position:absolute;top: 1232px ;} +.t1304 {position:absolute;top: 1236px ;} +.t1305 {position:absolute;top: 1240px ;} +.t1306 {position:absolute;top: 1244px ;} +.t1307 {position:absolute;top: 1248px ;} +.t1308 {position:absolute;top: 1252px ;} +.t1309 {position:absolute;top: 1256px ;} +.t1310 {position:absolute;top: 1260px ;} +.t1311 {position:absolute;top: 1264px ;} +.t1312 {position:absolute;top: 1268px ;} +.t1313 {position:absolute;top: 1272px ;} +.t1314 {position:absolute;top: 1276px ;} +.t1315 {position:absolute;top: 1280px ;} +.t1316 {position:absolute;top: 1284px ;} +.t1317 {position:absolute;top: 1288px ;} +.t1318 {position:absolute;top: 1292px ;} +.t1319 {position:absolute;top: 1296px ;} +.t1320 {position:absolute;top: 1300px ;} +.t1321 {position:absolute;top: 1304px ;} +.t1322 {position:absolute;top: 1308px ;} +.t1323 {position:absolute;top: 1312px ;} +.t1324 {position:absolute;top: 1316px ;} +.t1325 {position:absolute;top: 1320px ;} +.t1326 {position:absolute;top: 1324px ;} +.t1327 {position:absolute;top: 1328px ;} +.t1328 {position:absolute;top: 1332px ;} +.t1329 {position:absolute;top: 1336px ;} +.t1330 {position:absolute;top: 1340px ;} +.t1331 {position:absolute;top: 1344px ;} +.t1332 {position:absolute;top: 1348px ;} +.t1333 {position:absolute;top: 1352px ;} +.t1334 {position:absolute;top: 1356px ;} +.t1335 {position:absolute;top: 1360px ;} +.t1336 {position:absolute;top: 1364px ;} +.t1337 {position:absolute;top: 1368px ;} +.t1338 {position:absolute;top: 1372px ;} +.t1339 {position:absolute;top: 1376px ;} +.t1340 {position:absolute;top: 1380px ;} +.t1341 {position:absolute;top: 1384px ;} +.t1342 {position:absolute;top: 1388px ;} +.t1343 {position:absolute;top: 1392px ;} +.t1344 {position:absolute;top: 1396px ;} +.t1345 {position:absolute;top: 1400px ;} +.t1346 {position:absolute;top: 1404px ;} +.t1347 {position:absolute;top: 1408px ;} +.t1348 {position:absolute;top: 1412px ;} +.t1349 {position:absolute;top: 1416px ;} +.t1350 {position:absolute;top: 1420px ;} +.t1351 {position:absolute;top: 1424px ;} +.t1352 {position:absolute;top: 1428px ;} +.t1353 {position:absolute;top: 1432px ;} +.t1354 {position:absolute;top: 1436px ;} +.t1355 {position:absolute;top: 1440px ;} +.t1356 {position:absolute;top: 1444px ;} +.t1357 {position:absolute;top: 1448px ;} +.t1358 {position:absolute;top: 1452px ;} +.t1359 {position:absolute;top: 1456px ;} + +.t1400 {position:absolute;top: 1464px ;} +.t1401 {position:absolute;top: 1468px ;} +.t1402 {position:absolute;top: 1472px ;} +.t1403 {position:absolute;top: 1476px ;} +.t1404 {position:absolute;top: 1480px ;} +.t1405 {position:absolute;top: 1484px ;} +.t1406 {position:absolute;top: 1488px ;} +.t1407 {position:absolute;top: 1492px ;} +.t1408 {position:absolute;top: 1496px ;} +.t1409 {position:absolute;top: 1500px ;} +.t1410 {position:absolute;top: 1504px ;} +.t1411 {position:absolute;top: 1508px ;} +.t1412 {position:absolute;top: 1512px ;} +.t1413 {position:absolute;top: 1516px ;} +.t1414 {position:absolute;top: 1520px ;} +.t1415 {position:absolute;top: 1524px ;} +.t1416 {position:absolute;top: 1528px ;} +.t1417 {position:absolute;top: 1532px ;} +.t1418 {position:absolute;top: 1536px ;} +.t1419 {position:absolute;top: 1540px ;} +.t1420 {position:absolute;top: 1544px ;} +.t1421 {position:absolute;top: 1548px ;} +.t1422 {position:absolute;top: 1552px ;} +.t1423 {position:absolute;top: 1556px ;} +.t1424 {position:absolute;top: 1560px ;} +.t1425 {position:absolute;top: 1564px ;} +.t1426 {position:absolute;top: 1568px ;} +.t1427 {position:absolute;top: 1572px ;} +.t1428 {position:absolute;top: 1576px ;} +.t1429 {position:absolute;top: 1580px ;} +.t1430 {position:absolute;top: 1584px ;} +.t1431 {position:absolute;top: 1588px ;} +.t1432 {position:absolute;top: 1592px ;} +.t1433 {position:absolute;top: 1596px ;} +.t1434 {position:absolute;top: 1600px ;} +.t1435 {position:absolute;top: 1604px ;} +.t1436 {position:absolute;top: 1608px ;} +.t1437 {position:absolute;top: 1612px ;} +.t1438 {position:absolute;top: 1616px ;} +.t1439 {position:absolute;top: 1620px ;} +.t1440 {position:absolute;top: 1624px ;} +.t1441 {position:absolute;top: 1628px ;} +.t1442 {position:absolute;top: 1632px ;} +.t1443 {position:absolute;top: 1636px ;} +.t1444 {position:absolute;top: 1640px ;} +.t1445 {position:absolute;top: 1644px ;} +.t1446 {position:absolute;top: 1648px ;} +.t1447 {position:absolute;top: 1652px ;} +.t1448 {position:absolute;top: 1656px ;} +.t1449 {position:absolute;top: 1660px ;} +.t1450 {position:absolute;top: 1664px ;} +.t1451 {position:absolute;top: 1668px ;} +.t1452 {position:absolute;top: 1672px ;} +.t1453 {position:absolute;top: 1676px ;} +.t1454 {position:absolute;top: 1680px ;} +.t1455 {position:absolute;top: 1684px ;} +.t1456 {position:absolute;top: 1688px ;} +.t1457 {position:absolute;top: 1692px ;} +.t1458 {position:absolute;top: 1696px ;} +.t1459 {position:absolute;top: 1700px ;} + +.t1500 {position:absolute;top: 1708px ;} +.t1501 {position:absolute;top: 1712px ;} +.t1502 {position:absolute;top: 1716px ;} +.t1503 {position:absolute;top: 1720px ;} +.t1504 {position:absolute;top: 1724px ;} +.t1505 {position:absolute;top: 1728px ;} +.t1506 {position:absolute;top: 1732px ;} +.t1507 {position:absolute;top: 1736px ;} +.t1508 {position:absolute;top: 1740px ;} +.t1509 {position:absolute;top: 1744px ;} +.t1510 {position:absolute;top: 1748px ;} +.t1511 {position:absolute;top: 1752px ;} +.t1512 {position:absolute;top: 1756px ;} +.t1513 {position:absolute;top: 1760px ;} +.t1514 {position:absolute;top: 1764px ;} +.t1515 {position:absolute;top: 1768px ;} +.t1516 {position:absolute;top: 1772px ;} +.t1517 {position:absolute;top: 1776px ;} +.t1518 {position:absolute;top: 1780px ;} +.t1519 {position:absolute;top: 1784px ;} +.t1520 {position:absolute;top: 1788px ;} +.t1521 {position:absolute;top: 1792px ;} +.t1522 {position:absolute;top: 1796px ;} +.t1523 {position:absolute;top: 1800px ;} +.t1524 {position:absolute;top: 1804px ;} +.t1525 {position:absolute;top: 1808px ;} +.t1526 {position:absolute;top: 1812px ;} +.t1527 {position:absolute;top: 1816px ;} +.t1528 {position:absolute;top: 1820px ;} +.t1529 {position:absolute;top: 1824px ;} +.t1530 {position:absolute;top: 1828px ;} +.t1531 {position:absolute;top: 1832px ;} +.t1532 {position:absolute;top: 1836px ;} +.t1533 {position:absolute;top: 1840px ;} +.t1534 {position:absolute;top: 1844px ;} +.t1535 {position:absolute;top: 1848px ;} +.t1536 {position:absolute;top: 1852px ;} +.t1537 {position:absolute;top: 1856px ;} +.t1538 {position:absolute;top: 1860px ;} +.t1539 {position:absolute;top: 1864px ;} +.t1540 {position:absolute;top: 1868px ;} +.t1541 {position:absolute;top: 1872px ;} +.t1542 {position:absolute;top: 1876px ;} +.t1543 {position:absolute;top: 1880px ;} +.t1544 {position:absolute;top: 1884px ;} +.t1545 {position:absolute;top: 1888px ;} +.t1546 {position:absolute;top: 1892px ;} +.t1547 {position:absolute;top: 1896px ;} +.t1548 {position:absolute;top: 1900px ;} +.t1549 {position:absolute;top: 1904px ;} +.t1550 {position:absolute;top: 1908px ;} +.t1551 {position:absolute;top: 1912px ;} +.t1552 {position:absolute;top: 1916px ;} +.t1553 {position:absolute;top: 1920px ;} +.t1554 {position:absolute;top: 1924px ;} +.t1555 {position:absolute;top: 1928px ;} +.t1556 {position:absolute;top: 1932px ;} +.t1557 {position:absolute;top: 1936px ;} +.t1558 {position:absolute;top: 1940px ;} +.t1559 {position:absolute;top: 1944px ;} + +.t1600 {position:absolute;top: 1952px ;} +.t1601 {position:absolute;top: 1956px ;} +.t1602 {position:absolute;top: 1960px ;} +.t1603 {position:absolute;top: 1964px ;} +.t1604 {position:absolute;top: 1968px ;} +.t1605 {position:absolute;top: 1972px ;} +.t1606 {position:absolute;top: 1976px ;} +.t1607 {position:absolute;top: 1980px ;} +.t1608 {position:absolute;top: 1984px ;} +.t1609 {position:absolute;top: 1988px ;} +.t1610 {position:absolute;top: 1992px ;} +.t1611 {position:absolute;top: 1996px ;} +.t1612 {position:absolute;top: 2000px ;} +.t1613 {position:absolute;top: 2004px ;} +.t1614 {position:absolute;top: 2008px ;} +.t1615 {position:absolute;top: 2012px ;} +.t1616 {position:absolute;top: 2016px ;} +.t1617 {position:absolute;top: 2020px ;} +.t1618 {position:absolute;top: 2024px ;} +.t1619 {position:absolute;top: 2028px ;} +.t1620 {position:absolute;top: 2032px ;} +.t1621 {position:absolute;top: 2036px ;} +.t1622 {position:absolute;top: 2040px ;} +.t1623 {position:absolute;top: 2044px ;} +.t1624 {position:absolute;top: 2048px ;} +.t1625 {position:absolute;top: 2052px ;} +.t1626 {position:absolute;top: 2056px ;} +.t1627 {position:absolute;top: 2060px ;} +.t1628 {position:absolute;top: 2064px ;} +.t1629 {position:absolute;top: 2068px ;} +.t1630 {position:absolute;top: 2072px ;} +.t1631 {position:absolute;top: 2076px ;} +.t1632 {position:absolute;top: 2080px ;} +.t1633 {position:absolute;top: 2084px ;} +.t1634 {position:absolute;top: 2088px ;} +.t1635 {position:absolute;top: 2092px ;} +.t1636 {position:absolute;top: 2096px ;} +.t1637 {position:absolute;top: 2100px ;} +.t1638 {position:absolute;top: 2104px ;} +.t1639 {position:absolute;top: 2108px ;} +.t1640 {position:absolute;top: 2112px ;} +.t1641 {position:absolute;top: 2116px ;} +.t1642 {position:absolute;top: 2120px ;} +.t1643 {position:absolute;top: 2124px ;} +.t1644 {position:absolute;top: 2128px ;} +.t1645 {position:absolute;top: 2132px ;} +.t1646 {position:absolute;top: 2136px ;} +.t1647 {position:absolute;top: 2140px ;} +.t1648 {position:absolute;top: 2144px ;} +.t1649 {position:absolute;top: 2148px ;} +.t1650 {position:absolute;top: 2152px ;} +.t1651 {position:absolute;top: 2156px ;} +.t1652 {position:absolute;top: 2160px ;} +.t1653 {position:absolute;top: 2164px ;} +.t1654 {position:absolute;top: 2168px ;} +.t1655 {position:absolute;top: 2172px ;} +.t1656 {position:absolute;top: 2176px ;} +.t1657 {position:absolute;top: 2180px ;} +.t1658 {position:absolute;top: 2184px ;} +.t1659 {position:absolute;top: 2188px ;} + +.t1700 {position:absolute;top: 2196px ;} +.t1701 {position:absolute;top: 2200px ;} +.t1702 {position:absolute;top: 2204px ;} +.t1703 {position:absolute;top: 2208px ;} +.t1704 {position:absolute;top: 2212px ;} +.t1705 {position:absolute;top: 2216px ;} +.t1706 {position:absolute;top: 2220px ;} +.t1707 {position:absolute;top: 2224px ;} +.t1708 {position:absolute;top: 2228px ;} +.t1709 {position:absolute;top: 2232px ;} +.t1710 {position:absolute;top: 2236px ;} +.t1711 {position:absolute;top: 2240px ;} +.t1712 {position:absolute;top: 2244px ;} +.t1713 {position:absolute;top: 2248px ;} +.t1714 {position:absolute;top: 2252px ;} +.t1715 {position:absolute;top: 2256px ;} +.t1716 {position:absolute;top: 2260px ;} +.t1717 {position:absolute;top: 2264px ;} +.t1718 {position:absolute;top: 2268px ;} +.t1719 {position:absolute;top: 2272px ;} +.t1720 {position:absolute;top: 2276px ;} +.t1721 {position:absolute;top: 2280px ;} +.t1722 {position:absolute;top: 2284px ;} +.t1723 {position:absolute;top: 2288px ;} +.t1724 {position:absolute;top: 2292px ;} +.t1725 {position:absolute;top: 2296px ;} +.t1726 {position:absolute;top: 2300px ;} +.t1727 {position:absolute;top: 2304px ;} +.t1728 {position:absolute;top: 2308px ;} +.t1729 {position:absolute;top: 2312px ;} +.t1730 {position:absolute;top: 2316px ;} +.t1731 {position:absolute;top: 2320px ;} +.t1732 {position:absolute;top: 2324px ;} +.t1733 {position:absolute;top: 2328px ;} +.t1734 {position:absolute;top: 2332px ;} +.t1735 {position:absolute;top: 2336px ;} +.t1736 {position:absolute;top: 2340px ;} +.t1737 {position:absolute;top: 2344px ;} +.t1738 {position:absolute;top: 2348px ;} +.t1739 {position:absolute;top: 2352px ;} +.t1740 {position:absolute;top: 2356px ;} +.t1741 {position:absolute;top: 2360px ;} +.t1742 {position:absolute;top: 2364px ;} +.t1743 {position:absolute;top: 2368px ;} +.t1744 {position:absolute;top: 2372px ;} +.t1745 {position:absolute;top: 2376px ;} +.t1746 {position:absolute;top: 2380px ;} +.t1747 {position:absolute;top: 2384px ;} +.t1748 {position:absolute;top: 2388px ;} +.t1749 {position:absolute;top: 2392px ;} +.t1750 {position:absolute;top: 2396px ;} +.t1751 {position:absolute;top: 2400px ;} +.t1752 {position:absolute;top: 2404px ;} +.t1753 {position:absolute;top: 2408px ;} +.t1754 {position:absolute;top: 2412px ;} +.t1755 {position:absolute;top: 2416px ;} +.t1756 {position:absolute;top: 2420px ;} +.t1757 {position:absolute;top: 2424px ;} +.t1758 {position:absolute;top: 2428px ;} +.t1759 {position:absolute;top: 2432px ;} + +.t1800 {position:absolute;top: 2440px ;} +.t1801 {position:absolute;top: 2444px ;} +.t1802 {position:absolute;top: 2448px ;} +.t1803 {position:absolute;top: 2452px ;} +.t1804 {position:absolute;top: 2456px ;} +.t1805 {position:absolute;top: 2460px ;} +.t1806 {position:absolute;top: 2464px ;} +.t1807 {position:absolute;top: 2468px ;} +.t1808 {position:absolute;top: 2472px ;} +.t1809 {position:absolute;top: 2476px ;} +.t1810 {position:absolute;top: 2480px ;} +.t1811 {position:absolute;top: 2484px ;} +.t1812 {position:absolute;top: 2488px ;} +.t1813 {position:absolute;top: 2492px ;} +.t1814 {position:absolute;top: 2496px ;} +.t1815 {position:absolute;top: 2500px ;} +.t1816 {position:absolute;top: 2504px ;} +.t1817 {position:absolute;top: 2508px ;} +.t1818 {position:absolute;top: 2512px ;} +.t1819 {position:absolute;top: 2516px ;} +.t1820 {position:absolute;top: 2520px ;} +.t1821 {position:absolute;top: 2524px ;} +.t1822 {position:absolute;top: 2528px ;} +.t1823 {position:absolute;top: 2532px ;} +.t1824 {position:absolute;top: 2536px ;} +.t1825 {position:absolute;top: 2540px ;} +.t1826 {position:absolute;top: 2544px ;} +.t1827 {position:absolute;top: 2548px ;} +.t1828 {position:absolute;top: 2552px ;} +.t1829 {position:absolute;top: 2556px ;} +.t1830 {position:absolute;top: 2560px ;} +.t1831 {position:absolute;top: 2564px ;} +.t1832 {position:absolute;top: 2568px ;} +.t1833 {position:absolute;top: 2572px ;} +.t1834 {position:absolute;top: 2576px ;} +.t1835 {position:absolute;top: 2580px ;} +.t1836 {position:absolute;top: 2584px ;} +.t1837 {position:absolute;top: 2588px ;} +.t1838 {position:absolute;top: 2592px ;} +.t1839 {position:absolute;top: 2596px ;} +.t1840 {position:absolute;top: 2600px ;} +.t1841 {position:absolute;top: 2604px ;} +.t1842 {position:absolute;top: 2608px ;} +.t1843 {position:absolute;top: 2612px ;} +.t1844 {position:absolute;top: 2616px ;} +.t1845 {position:absolute;top: 2620px ;} +.t1846 {position:absolute;top: 2624px ;} +.t1847 {position:absolute;top: 2628px ;} +.t1848 {position:absolute;top: 2632px ;} +.t1849 {position:absolute;top: 2636px ;} +.t1850 {position:absolute;top: 2640px ;} +.t1851 {position:absolute;top: 2644px ;} +.t1852 {position:absolute;top: 2648px ;} +.t1853 {position:absolute;top: 2652px ;} +.t1854 {position:absolute;top: 2656px ;} +.t1855 {position:absolute;top: 2660px ;} +.t1856 {position:absolute;top: 2664px ;} +.t1857 {position:absolute;top: 2668px ;} +.t1858 {position:absolute;top: 2672px ;} +.t1859 {position:absolute;top: 2676px ;} + +.t1900 {position:absolute;top: 2684px ;} +.t1901 {position:absolute;top: 2688px ;} +.t1902 {position:absolute;top: 2692px ;} +.t1903 {position:absolute;top: 2696px ;} +.t1904 {position:absolute;top: 2700px ;} +.t1905 {position:absolute;top: 2704px ;} +.t1906 {position:absolute;top: 2708px ;} +.t1907 {position:absolute;top: 2712px ;} +.t1908 {position:absolute;top: 2716px ;} +.t1909 {position:absolute;top: 2720px ;} +.t1910 {position:absolute;top: 2724px ;} +.t1911 {position:absolute;top: 2728px ;} +.t1912 {position:absolute;top: 2732px ;} +.t1913 {position:absolute;top: 2736px ;} +.t1914 {position:absolute;top: 2740px ;} +.t1915 {position:absolute;top: 2744px ;} +.t1916 {position:absolute;top: 2748px ;} +.t1917 {position:absolute;top: 2752px ;} +.t1918 {position:absolute;top: 2756px ;} +.t1919 {position:absolute;top: 2760px ;} +.t1920 {position:absolute;top: 2764px ;} +.t1921 {position:absolute;top: 2768px ;} +.t1922 {position:absolute;top: 2772px ;} +.t1923 {position:absolute;top: 2776px ;} +.t1924 {position:absolute;top: 2780px ;} +.t1925 {position:absolute;top: 2784px ;} +.t1926 {position:absolute;top: 2788px ;} +.t1927 {position:absolute;top: 2792px ;} +.t1928 {position:absolute;top: 2796px ;} +.t1929 {position:absolute;top: 2800px ;} +.t1930 {position:absolute;top: 2804px ;} +.t1931 {position:absolute;top: 2808px ;} +.t1932 {position:absolute;top: 2812px ;} +.t1933 {position:absolute;top: 2816px ;} +.t1934 {position:absolute;top: 2820px ;} +.t1935 {position:absolute;top: 2824px ;} +.t1936 {position:absolute;top: 2828px ;} +.t1937 {position:absolute;top: 2832px ;} +.t1938 {position:absolute;top: 2836px ;} +.t1939 {position:absolute;top: 2840px ;} +.t1940 {position:absolute;top: 2844px ;} +.t1941 {position:absolute;top: 2848px ;} +.t1942 {position:absolute;top: 2852px ;} +.t1943 {position:absolute;top: 2856px ;} +.t1944 {position:absolute;top: 2860px ;} +.t1945 {position:absolute;top: 2864px ;} +.t1946 {position:absolute;top: 2868px ;} +.t1947 {position:absolute;top: 2872px ;} +.t1948 {position:absolute;top: 2876px ;} +.t1949 {position:absolute;top: 2880px ;} +.t1950 {position:absolute;top: 2884px ;} +.t1951 {position:absolute;top: 2888px ;} +.t1952 {position:absolute;top: 2892px ;} +.t1953 {position:absolute;top: 2896px ;} +.t1954 {position:absolute;top: 2900px ;} +.t1955 {position:absolute;top: 2904px ;} +.t1956 {position:absolute;top: 2908px ;} +.t1957 {position:absolute;top: 2912px ;} +.t1958 {position:absolute;top: 2916px ;} +.t1959 {position:absolute;top: 2920px ;} + +.t2000 {position:absolute;top: 2928px ;} +.t2001 {position:absolute;top: 2932px ;} +.t2002 {position:absolute;top: 2936px ;} +.t2003 {position:absolute;top: 2940px ;} +.t2004 {position:absolute;top: 2944px ;} +.t2005 {position:absolute;top: 2948px ;} +.t2006 {position:absolute;top: 2952px ;} +.t2007 {position:absolute;top: 2956px ;} +.t2008 {position:absolute;top: 2960px ;} +.t2009 {position:absolute;top: 2964px ;} +.t2010 {position:absolute;top: 2968px ;} +.t2011 {position:absolute;top: 2972px ;} +.t2012 {position:absolute;top: 2976px ;} +.t2013 {position:absolute;top: 2980px ;} +.t2014 {position:absolute;top: 2984px ;} +.t2015 {position:absolute;top: 2988px ;} +.t2016 {position:absolute;top: 2992px ;} +.t2017 {position:absolute;top: 2996px ;} +.t2018 {position:absolute;top: 3000px ;} +.t2019 {position:absolute;top: 3004px ;} +.t2020 {position:absolute;top: 3008px ;} +.t2021 {position:absolute;top: 3012px ;} +.t2022 {position:absolute;top: 3016px ;} +.t2023 {position:absolute;top: 3020px ;} +.t2024 {position:absolute;top: 3024px ;} +.t2025 {position:absolute;top: 3028px ;} +.t2026 {position:absolute;top: 3032px ;} +.t2027 {position:absolute;top: 3036px ;} +.t2028 {position:absolute;top: 3040px ;} +.t2029 {position:absolute;top: 3044px ;} +.t2030 {position:absolute;top: 3048px ;} +.t2031 {position:absolute;top: 3052px ;} +.t2032 {position:absolute;top: 3056px ;} +.t2033 {position:absolute;top: 3060px ;} +.t2034 {position:absolute;top: 3064px ;} +.t2035 {position:absolute;top: 3068px ;} +.t2036 {position:absolute;top: 3072px ;} +.t2037 {position:absolute;top: 3076px ;} +.t2038 {position:absolute;top: 3080px ;} +.t2039 {position:absolute;top: 3084px ;} +.t2040 {position:absolute;top: 3088px ;} +.t2041 {position:absolute;top: 3092px ;} +.t2042 {position:absolute;top: 3096px ;} +.t2043 {position:absolute;top: 3100px ;} +.t2044 {position:absolute;top: 3104px ;} +.t2045 {position:absolute;top: 3108px ;} +.t2046 {position:absolute;top: 3112px ;} +.t2047 {position:absolute;top: 3116px ;} +.t2048 {position:absolute;top: 3120px ;} +.t2049 {position:absolute;top: 3124px ;} +.t2050 {position:absolute;top: 3128px ;} +.t2051 {position:absolute;top: 3132px ;} +.t2052 {position:absolute;top: 3136px ;} +.t2053 {position:absolute;top: 3140px ;} +.t2054 {position:absolute;top: 3144px ;} +.t2055 {position:absolute;top: 3148px ;} +.t2056 {position:absolute;top: 3152px ;} +.t2057 {position:absolute;top: 3156px ;} +.t2058 {position:absolute;top: 3160px ;} +.t2059 {position:absolute;top: 3164px ;} + +.t2100 {position:absolute;top: 3172px ;} +.t2101 {position:absolute;top: 3176px ;} +.t2102 {position:absolute;top: 3180px ;} +.t2103 {position:absolute;top: 3184px ;} +.t2104 {position:absolute;top: 3188px ;} +.t2105 {position:absolute;top: 3192px ;} +.t2106 {position:absolute;top: 3196px ;} +.t2107 {position:absolute;top: 3200px ;} +.t2108 {position:absolute;top: 3204px ;} +.t2109 {position:absolute;top: 3208px ;} +.t2110 {position:absolute;top: 3212px ;} +.t2111 {position:absolute;top: 3216px ;} +.t2112 {position:absolute;top: 3220px ;} +.t2113 {position:absolute;top: 3224px ;} +.t2114 {position:absolute;top: 3228px ;} +.t2115 {position:absolute;top: 3232px ;} +.t2116 {position:absolute;top: 3236px ;} +.t2117 {position:absolute;top: 3240px ;} +.t2118 {position:absolute;top: 3244px ;} +.t2119 {position:absolute;top: 3248px ;} +.t2120 {position:absolute;top: 3252px ;} +.t2121 {position:absolute;top: 3256px ;} +.t2122 {position:absolute;top: 3260px ;} +.t2123 {position:absolute;top: 3264px ;} +.t2124 {position:absolute;top: 3268px ;} +.t2125 {position:absolute;top: 3272px ;} +.t2126 {position:absolute;top: 3276px ;} +.t2127 {position:absolute;top: 3280px ;} +.t2128 {position:absolute;top: 3284px ;} +.t2129 {position:absolute;top: 3288px ;} +.t2130 {position:absolute;top: 3292px ;} +.t2131 {position:absolute;top: 3296px ;} +.t2132 {position:absolute;top: 3300px ;} +.t2133 {position:absolute;top: 3304px ;} +.t2134 {position:absolute;top: 3308px ;} +.t2135 {position:absolute;top: 3312px ;} +.t2136 {position:absolute;top: 3316px ;} +.t2137 {position:absolute;top: 3320px ;} +.t2138 {position:absolute;top: 3324px ;} +.t2139 {position:absolute;top: 3328px ;} +.t2140 {position:absolute;top: 3332px ;} +.t2141 {position:absolute;top: 3336px ;} +.t2142 {position:absolute;top: 3340px ;} +.t2143 {position:absolute;top: 3344px ;} +.t2144 {position:absolute;top: 3348px ;} +.t2145 {position:absolute;top: 3352px ;} +.t2146 {position:absolute;top: 3356px ;} +.t2147 {position:absolute;top: 3360px ;} +.t2148 {position:absolute;top: 3364px ;} +.t2149 {position:absolute;top: 3368px ;} +.t2150 {position:absolute;top: 3372px ;} +.t2151 {position:absolute;top: 3376px ;} +.t2152 {position:absolute;top: 3380px ;} +.t2153 {position:absolute;top: 3384px ;} +.t2154 {position:absolute;top: 3388px ;} +.t2155 {position:absolute;top: 3392px ;} +.t2156 {position:absolute;top: 3396px ;} +.t2157 {position:absolute;top: 3400px ;} +.t2158 {position:absolute;top: 3404px ;} +.t2159 {position:absolute;top: 3408px ;} + +.t2200 {position:absolute;top: 3416px ;} +.t2201 {position:absolute;top: 3420px ;} +.t2202 {position:absolute;top: 3424px ;} +.t2203 {position:absolute;top: 3428px ;} +.t2204 {position:absolute;top: 3432px ;} +.t2205 {position:absolute;top: 3436px ;} +.t2206 {position:absolute;top: 3440px ;} +.t2207 {position:absolute;top: 3444px ;} +.t2208 {position:absolute;top: 3448px ;} +.t2209 {position:absolute;top: 3452px ;} +.t2210 {position:absolute;top: 3456px ;} +.t2211 {position:absolute;top: 3460px ;} +.t2212 {position:absolute;top: 3464px ;} +.t2213 {position:absolute;top: 3468px ;} +.t2214 {position:absolute;top: 3472px ;} +.t2215 {position:absolute;top: 3476px ;} +.t2216 {position:absolute;top: 3480px ;} +.t2217 {position:absolute;top: 3484px ;} +.t2218 {position:absolute;top: 3488px ;} +.t2219 {position:absolute;top: 3492px ;} +.t2220 {position:absolute;top: 3496px ;} +.t2221 {position:absolute;top: 3500px ;} +.t2222 {position:absolute;top: 3504px ;} +.t2223 {position:absolute;top: 3508px ;} +.t2224 {position:absolute;top: 3512px ;} +.t2225 {position:absolute;top: 3516px ;} +.t2226 {position:absolute;top: 3520px ;} +.t2227 {position:absolute;top: 3524px ;} +.t2228 {position:absolute;top: 3528px ;} +.t2229 {position:absolute;top: 3532px ;} +.t2230 {position:absolute;top: 3536px ;} +.t2231 {position:absolute;top: 3540px ;} +.t2232 {position:absolute;top: 3544px ;} +.t2233 {position:absolute;top: 3548px ;} +.t2234 {position:absolute;top: 3552px ;} +.t2235 {position:absolute;top: 3556px ;} +.t2236 {position:absolute;top: 3560px ;} +.t2237 {position:absolute;top: 3564px ;} +.t2238 {position:absolute;top: 3568px ;} +.t2239 {position:absolute;top: 3572px ;} +.t2240 {position:absolute;top: 3576px ;} +.t2241 {position:absolute;top: 3580px ;} +.t2242 {position:absolute;top: 3584px ;} +.t2243 {position:absolute;top: 3588px ;} +.t2244 {position:absolute;top: 3592px ;} +.t2245 {position:absolute;top: 3596px ;} +.t2246 {position:absolute;top: 3600px ;} +.t2247 {position:absolute;top: 3604px ;} +.t2248 {position:absolute;top: 3608px ;} +.t2249 {position:absolute;top: 3612px ;} +.t2250 {position:absolute;top: 3616px ;} +.t2251 {position:absolute;top: 3620px ;} +.t2252 {position:absolute;top: 3624px ;} +.t2253 {position:absolute;top: 3628px ;} +.t2254 {position:absolute;top: 3632px ;} +.t2255 {position:absolute;top: 3636px ;} +.t2256 {position:absolute;top: 3640px ;} +.t2257 {position:absolute;top: 3644px ;} +.t2258 {position:absolute;top: 3648px ;} +.t2259 {position:absolute;top: 3652px ;} + +.t2300 {position:absolute;top: 3660px ;} +.t2301 {position:absolute;top: 3664px ;} +.t2302 {position:absolute;top: 3668px ;} +.t2303 {position:absolute;top: 3672px ;} +.t2304 {position:absolute;top: 3676px ;} +.t2305 {position:absolute;top: 3680px ;} +.t2306 {position:absolute;top: 3684px ;} +.t2307 {position:absolute;top: 3688px ;} +.t2308 {position:absolute;top: 3692px ;} +.t2309 {position:absolute;top: 3696px ;} +.t2310 {position:absolute;top: 3700px ;} +.t2311 {position:absolute;top: 3704px ;} +.t2312 {position:absolute;top: 3708px ;} +.t2313 {position:absolute;top: 3712px ;} +.t2314 {position:absolute;top: 3716px ;} +.t2315 {position:absolute;top: 3720px ;} +.t2316 {position:absolute;top: 3724px ;} +.t2317 {position:absolute;top: 3728px ;} +.t2318 {position:absolute;top: 3732px ;} +.t2319 {position:absolute;top: 3736px ;} +.t2320 {position:absolute;top: 3740px ;} +.t2321 {position:absolute;top: 3744px ;} +.t2322 {position:absolute;top: 3748px ;} +.t2323 {position:absolute;top: 3752px ;} +.t2324 {position:absolute;top: 3756px ;} +.t2325 {position:absolute;top: 3760px ;} +.t2326 {position:absolute;top: 3764px ;} +.t2327 {position:absolute;top: 3768px ;} +.t2328 {position:absolute;top: 3772px ;} +.t2329 {position:absolute;top: 3776px ;} +.t2330 {position:absolute;top: 3780px ;} +.t2331 {position:absolute;top: 3784px ;} +.t2332 {position:absolute;top: 3788px ;} +.t2333 {position:absolute;top: 3792px ;} +.t2334 {position:absolute;top: 3796px ;} +.t2335 {position:absolute;top: 3800px ;} +.t2336 {position:absolute;top: 3804px ;} +.t2337 {position:absolute;top: 3808px ;} +.t2338 {position:absolute;top: 3812px ;} +.t2339 {position:absolute;top: 3816px ;} +.t2340 {position:absolute;top: 3820px ;} +.t2341 {position:absolute;top: 3824px ;} +.t2342 {position:absolute;top: 3828px ;} +.t2343 {position:absolute;top: 3832px ;} +.t2344 {position:absolute;top: 3836px ;} +.t2345 {position:absolute;top: 3840px ;} +.t2346 {position:absolute;top: 3844px ;} +.t2347 {position:absolute;top: 3848px ;} +.t2348 {position:absolute;top: 3852px ;} +.t2349 {position:absolute;top: 3856px ;} +.t2350 {position:absolute;top: 3860px ;} +.t2351 {position:absolute;top: 3864px ;} +.t2352 {position:absolute;top: 3868px ;} +.t2353 {position:absolute;top: 3872px ;} +.t2354 {position:absolute;top: 3876px ;} +.t2355 {position:absolute;top: 3880px ;} +.t2356 {position:absolute;top: 3884px ;} +.t2357 {position:absolute;top: 3888px ;} +.t2358 {position:absolute;top: 3892px ;} +.t2359 {position:absolute;top: 3896px ;} + +.t0000 {position:absolute;top: 3904px ;} +.t0001 {position:absolute;top: 3908px ;} +.t0002 {position:absolute;top: 3912px ;} +.t0003 {position:absolute;top: 3916px ;} +.t0004 {position:absolute;top: 3920px ;} +.t0005 {position:absolute;top: 3924px ;} +.t0006 {position:absolute;top: 3928px ;} +.t0007 {position:absolute;top: 3932px ;} +.t0008 {position:absolute;top: 3936px ;} +.t0009 {position:absolute;top: 3940px ;} +.t0010 {position:absolute;top: 3944px ;} +.t0011 {position:absolute;top: 3948px ;} +.t0012 {position:absolute;top: 3952px ;} +.t0013 {position:absolute;top: 3956px ;} +.t0014 {position:absolute;top: 3960px ;} +.t0015 {position:absolute;top: 3964px ;} +.t0016 {position:absolute;top: 3968px ;} +.t0017 {position:absolute;top: 3972px ;} +.t0018 {position:absolute;top: 3976px ;} +.t0019 {position:absolute;top: 3980px ;} +.t0020 {position:absolute;top: 3984px ;} +.t0021 {position:absolute;top: 3988px ;} +.t0022 {position:absolute;top: 3992px ;} +.t0023 {position:absolute;top: 3996px ;} +.t0024 {position:absolute;top: 4000px ;} +.t0025 {position:absolute;top: 4004px ;} +.t0026 {position:absolute;top: 4008px ;} +.t0027 {position:absolute;top: 4012px ;} +.t0028 {position:absolute;top: 4016px ;} +.t0029 {position:absolute;top: 4020px ;} +.t0030 {position:absolute;top: 4024px ;} +.t0031 {position:absolute;top: 4028px ;} +.t0032 {position:absolute;top: 4032px ;} +.t0033 {position:absolute;top: 4036px ;} +.t0034 {position:absolute;top: 4040px ;} +.t0035 {position:absolute;top: 4044px ;} +.t0036 {position:absolute;top: 4048px ;} +.t0037 {position:absolute;top: 4052px ;} +.t0038 {position:absolute;top: 4056px ;} +.t0039 {position:absolute;top: 4060px ;} +.t0040 {position:absolute;top: 4064px ;} +.t0041 {position:absolute;top: 4068px ;} +.t0042 {position:absolute;top: 4072px ;} +.t0043 {position:absolute;top: 4076px ;} +.t0044 {position:absolute;top: 4080px ;} +.t0045 {position:absolute;top: 4084px ;} +.t0046 {position:absolute;top: 4088px ;} +.t0047 {position:absolute;top: 4092px ;} +.t0048 {position:absolute;top: 4096px ;} +.t0049 {position:absolute;top: 4100px ;} +.t0050 {position:absolute;top: 4104px ;} +.t0051 {position:absolute;top: 4108px ;} +.t0052 {position:absolute;top: 4112px ;} +.t0053 {position:absolute;top: 4116px ;} +.t0054 {position:absolute;top: 4120px ;} +.t0055 {position:absolute;top: 4124px ;} +.t0056 {position:absolute;top: 4128px ;} +.t0057 {position:absolute;top: 4132px ;} +.t0058 {position:absolute;top: 4136px ;} +.t0059 {position:absolute;top: 4140px ;} + +.t0100 {position:absolute;top: 4148px ;} +.t0101 {position:absolute;top: 4152px ;} +.t0102 {position:absolute;top: 4156px ;} +.t0103 {position:absolute;top: 4160px ;} +.t0104 {position:absolute;top: 4164px ;} +.t0105 {position:absolute;top: 4168px ;} +.t0106 {position:absolute;top: 4172px ;} +.t0107 {position:absolute;top: 4176px ;} +.t0108 {position:absolute;top: 4180px ;} +.t0109 {position:absolute;top: 4184px ;} +.t0110 {position:absolute;top: 4188px ;} +.t0111 {position:absolute;top: 4192px ;} +.t0112 {position:absolute;top: 4196px ;} +.t0113 {position:absolute;top: 4200px ;} +.t0114 {position:absolute;top: 4204px ;} +.t0115 {position:absolute;top: 4208px ;} +.t0116 {position:absolute;top: 4212px ;} +.t0117 {position:absolute;top: 4216px ;} +.t0118 {position:absolute;top: 4220px ;} +.t0119 {position:absolute;top: 4224px ;} +.t0120 {position:absolute;top: 4228px ;} +.t0121 {position:absolute;top: 4232px ;} +.t0122 {position:absolute;top: 4236px ;} +.t0123 {position:absolute;top: 4240px ;} +.t0124 {position:absolute;top: 4244px ;} +.t0125 {position:absolute;top: 4248px ;} +.t0126 {position:absolute;top: 4252px ;} +.t0127 {position:absolute;top: 4256px ;} +.t0128 {position:absolute;top: 4260px ;} +.t0129 {position:absolute;top: 4264px ;} +.t0130 {position:absolute;top: 4268px ;} +.t0131 {position:absolute;top: 4272px ;} +.t0132 {position:absolute;top: 4276px ;} +.t0133 {position:absolute;top: 4280px ;} +.t0134 {position:absolute;top: 4284px ;} +.t0135 {position:absolute;top: 4288px ;} +.t0136 {position:absolute;top: 4292px ;} +.t0137 {position:absolute;top: 4296px ;} +.t0138 {position:absolute;top: 4300px ;} +.t0139 {position:absolute;top: 4304px ;} +.t0140 {position:absolute;top: 4308px ;} +.t0141 {position:absolute;top: 4312px ;} +.t0142 {position:absolute;top: 4316px ;} +.t0143 {position:absolute;top: 4320px ;} +.t0144 {position:absolute;top: 4324px ;} +.t0145 {position:absolute;top: 4328px ;} +.t0146 {position:absolute;top: 4332px ;} +.t0147 {position:absolute;top: 4336px ;} +.t0148 {position:absolute;top: 4340px ;} +.t0149 {position:absolute;top: 4344px ;} +.t0150 {position:absolute;top: 4348px ;} +.t0151 {position:absolute;top: 4352px ;} +.t0152 {position:absolute;top: 4356px ;} +.t0153 {position:absolute;top: 4360px ;} +.t0154 {position:absolute;top: 4364px ;} +.t0155 {position:absolute;top: 4368px ;} +.t0156 {position:absolute;top: 4372px ;} +.t0157 {position:absolute;top: 4376px ;} +.t0158 {position:absolute;top: 4380px ;} +.t0159 {position:absolute;top: 4384px ;} + +.t0200 {position:absolute;top: 4392px ;} +.t0201 {position:absolute;top: 4396px ;} +.t0202 {position:absolute;top: 4400px ;} +.t0203 {position:absolute;top: 4404px ;} +.t0204 {position:absolute;top: 4408px ;} +.t0205 {position:absolute;top: 4412px ;} +.t0206 {position:absolute;top: 4416px ;} +.t0207 {position:absolute;top: 4420px ;} +.t0208 {position:absolute;top: 4424px ;} +.t0209 {position:absolute;top: 4428px ;} +.t0210 {position:absolute;top: 4432px ;} +.t0211 {position:absolute;top: 4436px ;} +.t0212 {position:absolute;top: 4440px ;} +.t0213 {position:absolute;top: 4444px ;} +.t0214 {position:absolute;top: 4448px ;} +.t0215 {position:absolute;top: 4452px ;} +.t0216 {position:absolute;top: 4456px ;} +.t0217 {position:absolute;top: 4460px ;} +.t0218 {position:absolute;top: 4464px ;} +.t0219 {position:absolute;top: 4468px ;} +.t0220 {position:absolute;top: 4472px ;} +.t0221 {position:absolute;top: 4476px ;} +.t0222 {position:absolute;top: 4480px ;} +.t0223 {position:absolute;top: 4484px ;} +.t0224 {position:absolute;top: 4488px ;} +.t0225 {position:absolute;top: 4492px ;} +.t0226 {position:absolute;top: 4496px ;} +.t0227 {position:absolute;top: 4500px ;} +.t0228 {position:absolute;top: 4504px ;} +.t0229 {position:absolute;top: 4508px ;} +.t0230 {position:absolute;top: 4512px ;} +.t0231 {position:absolute;top: 4516px ;} +.t0232 {position:absolute;top: 4520px ;} +.t0233 {position:absolute;top: 4524px ;} +.t0234 {position:absolute;top: 4528px ;} +.t0235 {position:absolute;top: 4532px ;} +.t0236 {position:absolute;top: 4536px ;} +.t0237 {position:absolute;top: 4540px ;} +.t0238 {position:absolute;top: 4544px ;} +.t0239 {position:absolute;top: 4548px ;} +.t0240 {position:absolute;top: 4552px ;} +.t0241 {position:absolute;top: 4556px ;} +.t0242 {position:absolute;top: 4560px ;} +.t0243 {position:absolute;top: 4564px ;} +.t0244 {position:absolute;top: 4568px ;} +.t0245 {position:absolute;top: 4572px ;} +.t0246 {position:absolute;top: 4576px ;} +.t0247 {position:absolute;top: 4580px ;} +.t0248 {position:absolute;top: 4584px ;} +.t0249 {position:absolute;top: 4588px ;} +.t0250 {position:absolute;top: 4592px ;} +.t0251 {position:absolute;top: 4596px ;} +.t0252 {position:absolute;top: 4600px ;} +.t0253 {position:absolute;top: 4604px ;} +.t0254 {position:absolute;top: 4608px ;} +.t0255 {position:absolute;top: 4612px ;} +.t0256 {position:absolute;top: 4616px ;} +.t0257 {position:absolute;top: 4620px ;} +.t0258 {position:absolute;top: 4624px ;} +.t0259 {position:absolute;top: 4628px ;} + +.t0300 {position:absolute;top: 4636px ;} +.t0301 {position:absolute;top: 4640px ;} +.t0302 {position:absolute;top: 4644px ;} +.t0303 {position:absolute;top: 4648px ;} +.t0304 {position:absolute;top: 4652px ;} +.t0305 {position:absolute;top: 4656px ;} +.t0306 {position:absolute;top: 4660px ;} +.t0307 {position:absolute;top: 4664px ;} +.t0308 {position:absolute;top: 4668px ;} +.t0309 {position:absolute;top: 4672px ;} +.t0310 {position:absolute;top: 4676px ;} +.t0311 {position:absolute;top: 4680px ;} +.t0312 {position:absolute;top: 4684px ;} +.t0313 {position:absolute;top: 4688px ;} +.t0314 {position:absolute;top: 4692px ;} +.t0315 {position:absolute;top: 4696px ;} +.t0316 {position:absolute;top: 4700px ;} +.t0317 {position:absolute;top: 4704px ;} +.t0318 {position:absolute;top: 4708px ;} +.t0319 {position:absolute;top: 4712px ;} +.t0320 {position:absolute;top: 4716px ;} +.t0321 {position:absolute;top: 4720px ;} +.t0322 {position:absolute;top: 4724px ;} +.t0323 {position:absolute;top: 4728px ;} +.t0324 {position:absolute;top: 4732px ;} +.t0325 {position:absolute;top: 4736px ;} +.t0326 {position:absolute;top: 4740px ;} +.t0327 {position:absolute;top: 4744px ;} +.t0328 {position:absolute;top: 4748px ;} +.t0329 {position:absolute;top: 4752px ;} +.t0330 {position:absolute;top: 4756px ;} +.t0331 {position:absolute;top: 4760px ;} +.t0332 {position:absolute;top: 4764px ;} +.t0333 {position:absolute;top: 4768px ;} +.t0334 {position:absolute;top: 4772px ;} +.t0335 {position:absolute;top: 4776px ;} +.t0336 {position:absolute;top: 4780px ;} +.t0337 {position:absolute;top: 4784px ;} +.t0338 {position:absolute;top: 4788px ;} +.t0339 {position:absolute;top: 4792px ;} +.t0340 {position:absolute;top: 4796px ;} +.t0341 {position:absolute;top: 4800px ;} +.t0342 {position:absolute;top: 4804px ;} +.t0343 {position:absolute;top: 4808px ;} +.t0344 {position:absolute;top: 4812px ;} +.t0345 {position:absolute;top: 4816px ;} +.t0346 {position:absolute;top: 4820px ;} +.t0347 {position:absolute;top: 4824px ;} +.t0348 {position:absolute;top: 4828px ;} +.t0349 {position:absolute;top: 4832px ;} +.t0350 {position:absolute;top: 4836px ;} +.t0351 {position:absolute;top: 4840px ;} +.t0352 {position:absolute;top: 4844px ;} +.t0353 {position:absolute;top: 4848px ;} +.t0354 {position:absolute;top: 4852px ;} +.t0355 {position:absolute;top: 4856px ;} +.t0356 {position:absolute;top: 4860px ;} +.t0357 {position:absolute;top: 4864px ;} +.t0358 {position:absolute;top: 4868px ;} +.t0359 {position:absolute;top: 4872px ;} + +.t0400 {position:absolute;top: 4880px ;} +.t0401 {position:absolute;top: 4884px ;} +.t0402 {position:absolute;top: 4888px ;} +.t0403 {position:absolute;top: 4892px ;} +.t0404 {position:absolute;top: 4896px ;} +.t0405 {position:absolute;top: 4900px ;} +.t0406 {position:absolute;top: 4904px ;} +.t0407 {position:absolute;top: 4908px ;} +.t0408 {position:absolute;top: 4912px ;} +.t0409 {position:absolute;top: 4916px ;} +.t0410 {position:absolute;top: 4920px ;} +.t0411 {position:absolute;top: 4924px ;} +.t0412 {position:absolute;top: 4928px ;} +.t0413 {position:absolute;top: 4932px ;} +.t0414 {position:absolute;top: 4936px ;} +.t0415 {position:absolute;top: 4940px ;} +.t0416 {position:absolute;top: 4944px ;} +.t0417 {position:absolute;top: 4948px ;} +.t0418 {position:absolute;top: 4952px ;} +.t0419 {position:absolute;top: 4956px ;} +.t0420 {position:absolute;top: 4960px ;} +.t0421 {position:absolute;top: 4964px ;} +.t0422 {position:absolute;top: 4968px ;} +.t0423 {position:absolute;top: 4972px ;} +.t0424 {position:absolute;top: 4976px ;} +.t0425 {position:absolute;top: 4980px ;} +.t0426 {position:absolute;top: 4984px ;} +.t0427 {position:absolute;top: 4988px ;} +.t0428 {position:absolute;top: 4992px ;} +.t0429 {position:absolute;top: 4996px ;} +.t0430 {position:absolute;top: 5000px ;} +.t0431 {position:absolute;top: 5004px ;} +.t0432 {position:absolute;top: 5008px ;} +.t0433 {position:absolute;top: 5012px ;} +.t0434 {position:absolute;top: 5016px ;} +.t0435 {position:absolute;top: 5020px ;} +.t0436 {position:absolute;top: 5024px ;} +.t0437 {position:absolute;top: 5028px ;} +.t0438 {position:absolute;top: 5032px ;} +.t0439 {position:absolute;top: 5036px ;} +.t0440 {position:absolute;top: 5040px ;} +.t0441 {position:absolute;top: 5044px ;} +.t0442 {position:absolute;top: 5048px ;} +.t0443 {position:absolute;top: 5052px ;} +.t0444 {position:absolute;top: 5056px ;} +.t0445 {position:absolute;top: 5060px ;} +.t0446 {position:absolute;top: 5064px ;} +.t0447 {position:absolute;top: 5068px ;} +.t0448 {position:absolute;top: 5072px ;} +.t0449 {position:absolute;top: 5076px ;} +.t0450 {position:absolute;top: 5080px ;} +.t0451 {position:absolute;top: 5084px ;} +.t0452 {position:absolute;top: 5088px ;} +.t0453 {position:absolute;top: 5092px ;} +.t0454 {position:absolute;top: 5096px ;} +.t0455 {position:absolute;top: 5100px ;} +.t0456 {position:absolute;top: 5104px ;} +.t0457 {position:absolute;top: 5108px ;} +.t0458 {position:absolute;top: 5112px ;} +.t0459 {position:absolute;top: 5116px ;} + +.t0500 {position:absolute;top: 5124px ;} +.t0501 {position:absolute;top: 5128px ;} +.t0502 {position:absolute;top: 5132px ;} +.t0503 {position:absolute;top: 5136px ;} +.t0504 {position:absolute;top: 5140px ;} +.t0505 {position:absolute;top: 5144px ;} +.t0506 {position:absolute;top: 5148px ;} +.t0507 {position:absolute;top: 5152px ;} +.t0508 {position:absolute;top: 5156px ;} +.t0509 {position:absolute;top: 5160px ;} +.t0510 {position:absolute;top: 5164px ;} +.t0511 {position:absolute;top: 5168px ;} +.t0512 {position:absolute;top: 5172px ;} +.t0513 {position:absolute;top: 5176px ;} +.t0514 {position:absolute;top: 5180px ;} +.t0515 {position:absolute;top: 5184px ;} +.t0516 {position:absolute;top: 5188px ;} +.t0517 {position:absolute;top: 5192px ;} +.t0518 {position:absolute;top: 5196px ;} +.t0519 {position:absolute;top: 5200px ;} +.t0520 {position:absolute;top: 5204px ;} +.t0521 {position:absolute;top: 5208px ;} +.t0522 {position:absolute;top: 5212px ;} +.t0523 {position:absolute;top: 5216px ;} +.t0524 {position:absolute;top: 5220px ;} +.t0525 {position:absolute;top: 5224px ;} +.t0526 {position:absolute;top: 5228px ;} +.t0527 {position:absolute;top: 5232px ;} +.t0528 {position:absolute;top: 5236px ;} +.t0529 {position:absolute;top: 5240px ;} +.t0530 {position:absolute;top: 5244px ;} +.t0531 {position:absolute;top: 5248px ;} +.t0532 {position:absolute;top: 5252px ;} +.t0533 {position:absolute;top: 5256px ;} +.t0534 {position:absolute;top: 5260px ;} +.t0535 {position:absolute;top: 5264px ;} +.t0536 {position:absolute;top: 5268px ;} +.t0537 {position:absolute;top: 5272px ;} +.t0538 {position:absolute;top: 5276px ;} +.t0539 {position:absolute;top: 5280px ;} +.t0540 {position:absolute;top: 5284px ;} +.t0541 {position:absolute;top: 5288px ;} +.t0542 {position:absolute;top: 5292px ;} +.t0543 {position:absolute;top: 5296px ;} +.t0544 {position:absolute;top: 5300px ;} +.t0545 {position:absolute;top: 5304px ;} +.t0546 {position:absolute;top: 5308px ;} +.t0547 {position:absolute;top: 5312px ;} +.t0548 {position:absolute;top: 5316px ;} +.t0549 {position:absolute;top: 5320px ;} +.t0550 {position:absolute;top: 5324px ;} +.t0551 {position:absolute;top: 5328px ;} +.t0552 {position:absolute;top: 5332px ;} +.t0553 {position:absolute;top: 5336px ;} +.t0554 {position:absolute;top: 5340px ;} +.t0555 {position:absolute;top: 5344px ;} +.t0556 {position:absolute;top: 5348px ;} +.t0557 {position:absolute;top: 5352px ;} +.t0558 {position:absolute;top: 5356px ;} +.t0559 {position:absolute;top: 5360px ;} + +.t0600 {position:absolute;top: 5368px ;} +.t0601 {position:absolute;top: 5372px ;} +.t0602 {position:absolute;top: 5376px ;} +.t0603 {position:absolute;top: 5380px ;} +.t0604 {position:absolute;top: 5384px ;} +.t0605 {position:absolute;top: 5388px ;} +.t0606 {position:absolute;top: 5392px ;} +.t0607 {position:absolute;top: 5396px ;} +.t0608 {position:absolute;top: 5400px ;} +.t0609 {position:absolute;top: 5404px ;} +.t0610 {position:absolute;top: 5408px ;} +.t0611 {position:absolute;top: 5412px ;} +.t0612 {position:absolute;top: 5416px ;} +.t0613 {position:absolute;top: 5420px ;} +.t0614 {position:absolute;top: 5424px ;} +.t0615 {position:absolute;top: 5428px ;} +.t0616 {position:absolute;top: 5432px ;} +.t0617 {position:absolute;top: 5436px ;} +.t0618 {position:absolute;top: 5440px ;} +.t0619 {position:absolute;top: 5444px ;} +.t0620 {position:absolute;top: 5448px ;} +.t0621 {position:absolute;top: 5452px ;} +.t0622 {position:absolute;top: 5456px ;} +.t0623 {position:absolute;top: 5460px ;} +.t0624 {position:absolute;top: 5464px ;} +.t0625 {position:absolute;top: 5468px ;} +.t0626 {position:absolute;top: 5472px ;} +.t0627 {position:absolute;top: 5476px ;} +.t0628 {position:absolute;top: 5480px ;} +.t0629 {position:absolute;top: 5484px ;} +.t0630 {position:absolute;top: 5488px ;} +.t0631 {position:absolute;top: 5492px ;} +.t0632 {position:absolute;top: 5496px ;} +.t0633 {position:absolute;top: 5500px ;} +.t0634 {position:absolute;top: 5504px ;} +.t0635 {position:absolute;top: 5508px ;} +.t0636 {position:absolute;top: 5512px ;} +.t0637 {position:absolute;top: 5516px ;} +.t0638 {position:absolute;top: 5520px ;} +.t0639 {position:absolute;top: 5524px ;} +.t0640 {position:absolute;top: 5528px ;} +.t0641 {position:absolute;top: 5532px ;} +.t0642 {position:absolute;top: 5536px ;} +.t0643 {position:absolute;top: 5540px ;} +.t0644 {position:absolute;top: 5544px ;} +.t0645 {position:absolute;top: 5548px ;} +.t0646 {position:absolute;top: 5552px ;} +.t0647 {position:absolute;top: 5556px ;} +.t0648 {position:absolute;top: 5560px ;} +.t0649 {position:absolute;top: 5564px ;} +.t0650 {position:absolute;top: 5568px ;} +.t0651 {position:absolute;top: 5572px ;} +.t0652 {position:absolute;top: 5576px ;} +.t0653 {position:absolute;top: 5580px ;} +.t0654 {position:absolute;top: 5584px ;} +.t0655 {position:absolute;top: 5588px ;} +.t0656 {position:absolute;top: 5592px ;} +.t0657 {position:absolute;top: 5596px ;} +.t0658 {position:absolute;top: 5600px ;} +.t0659 {position:absolute;top: 5604px ;} + +.t0700 {position:absolute;top: 5612px ;} +.t0701 {position:absolute;top: 5616px ;} +.t0702 {position:absolute;top: 5620px ;} +.t0703 {position:absolute;top: 5624px ;} +.t0704 {position:absolute;top: 5628px ;} +.t0705 {position:absolute;top: 5632px ;} +.t0706 {position:absolute;top: 5636px ;} +.t0707 {position:absolute;top: 5640px ;} +.t0708 {position:absolute;top: 5644px ;} +.t0709 {position:absolute;top: 5648px ;} +.t0710 {position:absolute;top: 5652px ;} +.t0711 {position:absolute;top: 5656px ;} +.t0712 {position:absolute;top: 5660px ;} +.t0713 {position:absolute;top: 5664px ;} +.t0714 {position:absolute;top: 5668px ;} +.t0715 {position:absolute;top: 5672px ;} +.t0716 {position:absolute;top: 5676px ;} +.t0717 {position:absolute;top: 5680px ;} +.t0718 {position:absolute;top: 5684px ;} +.t0719 {position:absolute;top: 5688px ;} +.t0720 {position:absolute;top: 5692px ;} +.t0721 {position:absolute;top: 5696px ;} +.t0722 {position:absolute;top: 5700px ;} +.t0723 {position:absolute;top: 5704px ;} +.t0724 {position:absolute;top: 5708px ;} +.t0725 {position:absolute;top: 5712px ;} +.t0726 {position:absolute;top: 5716px ;} +.t0727 {position:absolute;top: 5720px ;} +.t0728 {position:absolute;top: 5724px ;} +.t0729 {position:absolute;top: 5728px ;} +.t0730 {position:absolute;top: 5732px ;} +.t0731 {position:absolute;top: 5736px ;} +.t0732 {position:absolute;top: 5740px ;} +.t0733 {position:absolute;top: 5744px ;} +.t0734 {position:absolute;top: 5748px ;} +.t0735 {position:absolute;top: 5752px ;} +.t0736 {position:absolute;top: 5756px ;} +.t0737 {position:absolute;top: 5760px ;} +.t0738 {position:absolute;top: 5764px ;} +.t0739 {position:absolute;top: 5768px ;} +.t0740 {position:absolute;top: 5772px ;} +.t0741 {position:absolute;top: 5776px ;} +.t0742 {position:absolute;top: 5780px ;} +.t0743 {position:absolute;top: 5784px ;} +.t0744 {position:absolute;top: 5788px ;} +.t0745 {position:absolute;top: 5792px ;} +.t0746 {position:absolute;top: 5796px ;} +.t0747 {position:absolute;top: 5800px ;} +.t0748 {position:absolute;top: 5804px ;} +.t0749 {position:absolute;top: 5808px ;} +.t0750 {position:absolute;top: 5812px ;} +.t0751 {position:absolute;top: 5816px ;} +.t0752 {position:absolute;top: 5820px ;} +.t0753 {position:absolute;top: 5824px ;} +.t0754 {position:absolute;top: 5828px ;} +.t0755 {position:absolute;top: 5832px ;} +.t0756 {position:absolute;top: 5836px ;} +.t0757 {position:absolute;top: 5840px ;} +.t0758 {position:absolute;top: 5844px ;} +.t0759 {position:absolute;top: 5848px ;} Index: trunk/install/php/titlelist.php =================================================================== --- trunk/install/php/titlelist.php (リビジョン 119) +++ trunk/install/php/titlelist.php (リビジョン 1) @@ -16,20 +16,4 @@ */ - -include("./foltialib.php"); -$con = m_connect(); - - -if ($useenvironmentpolicy == 1){ -if (!isset($_SERVER['PHP_AUTH_USER'])) { - header("WWW-Authenticate: Basic realm=\"foltia\""); - header("HTTP/1.0 401 Unauthorized"); - redirectlogin(); - exit; -} else { -login($con,$_SERVER['PHP_AUTH_USER'],$_SERVER['PHP_AUTH_PW']); -} -}//end if login - ?> @@ -44,14 +28,9 @@ fetch(); - if (! $rowdata) { - die_exit("番組データがありません
      "); - } - - $query2 = " -SELECT COUNT(*) AS cnt FROM foltia_program - "; -$rs2 = sql_query($con, $query2, "DBクエリに失敗しました"); -$rowdata2 = $rs2->fetch(); - if (! $rowdata2) { - die_exit("番組データがありません
      "); - } -//行数取得 -$dtcnt = $rowdata2[0]; + $rs = m_query($con, $query, "DBクエリに失敗しました"); + $maxrows = pg_num_rows($rs); + + if ($maxrows == 0) { + die_exit("番組データがありません
      "); + + } ?> @@ -85,5 +53,4 @@
      - 全番組リストを表示します。

      -columnCount(); - -//Autopager -echo "
      "; -?> - + $maxcols = pg_num_fields($rs); + ?> @@ -109,38 +72,28 @@ - + \n"); - + /* pg_fetch_row で一行取り出す */ + $rowdata = pg_fetch_row($rs, $row); //TID echo("\n"); + htmlspecialchars($rowdata[0]) . "\">" . + htmlspecialchars($rowdata[0]) . "\n"); //タイトル - echo("\n"); + echo("\n"); print "\n"; - echo("\n"); - } while ($rowdata = $rs->fetch()); - + } ?> -
      " . - htmlspecialchars($rowdata[0]) . "" . - htmlspecialchars($rowdata[1]) . "" . + htmlspecialchars($rowdata[1]) . "mp4
      - Index: trunk/install/php/delepgp.php =================================================================== --- trunk/install/php/delepgp.php (リビジョン 107) +++ trunk/install/php/delepgp.php (リビジョン 1) @@ -16,20 +16,4 @@ */ - -include("./foltialib.php"); -$con = m_connect(); - -if ($useenvironmentpolicy == 1){ -if (!isset($_SERVER['PHP_AUTH_USER'])) { - header("WWW-Authenticate: Basic realm=\"foltia\""); - header("HTTP/1.0 401 Unauthorized"); - redirectlogin(); - exit; -} else { -login($con,$_SERVER['PHP_AUTH_USER'],$_SERVER['PHP_AUTH_PW']); -} -}//end if login - - ?> @@ -41,17 +25,21 @@ foltia:delete EPG Program - "); } +$con = m_connect(); $now = date("YmdHi"); +?> + +fetch(); - $rs->closeCursor(); - - if (!is_array($rowdata) || empty($rowdata)) { - die_exit("登録番組がありません
      "); + $rs = m_query($con, $query, "DBクエリに失敗しました"); + $maxrows = pg_num_rows($rs); + + if ($maxrows == 0) { + die_exit("登録番組がありません
      "); } + $rowdata = pg_fetch_row($rs, 0); $pid = htmlspecialchars($rowdata[0]); @@ -115,7 +102,6 @@ DELETE FROM foltia_subtitle - WHERE foltia_subtitle.pid = ? AND foltia_subtitle.tid = 0 "; -// $rs = m_query($con, $query, "DBクエリに失敗しました"); - $rs = sql_query($con, $query, "DBクエリに失敗しました",array($pid)); + WHERE foltia_subtitle.pid = $pid AND foltia_subtitle.tid = 0 "; + $rs = m_query($con, $query, "DBクエリに失敗しました"); } }else{ Index: trunk/install/php/reserveepgcomp.php =================================================================== --- trunk/install/php/reserveepgcomp.php (リビジョン 122) +++ trunk/install/php/reserveepgcomp.php (リビジョン 1) @@ -19,20 +19,4 @@ */ - -include("./foltialib.php"); -$con = m_connect(); - -if ($useenvironmentpolicy == 1){ -if (!isset($_SERVER['PHP_AUTH_USER'])) { - header("WWW-Authenticate: Basic realm=\"foltia\""); - header("HTTP/1.0 401 Unauthorized"); - redirectlogin(); - exit; -} else { -login($con,$_SERVER['PHP_AUTH_USER'],$_SERVER['PHP_AUTH_PW']); -} -}//end if login - - ?> @@ -45,4 +29,5 @@ foltia:EPG予約:Error\n"; die_exit("登録番組がありません
      "); @@ -65,26 +49,6 @@ print " foltia:EPG予約:完了 \n"; +$con = m_connect(); $now = date("YmdHi"); -//タイトル取得 - $query = " - SELECT epgid,startdatetime,enddatetime,lengthmin, ontvchannel,epgtitle,epgdesc,epgcategory , - stationname , stationrecch ,stationid - FROM foltia_epg , foltia_station - WHERE epgid = ? AND foltia_station.ontvcode = foltia_epg.ontvchannel - "; - $rs = sql_query($con, $query, "DBクエリに失敗しました",array($epgid)); -$rowdata = $rs->fetch(); -if (! $rowdata) { - die_exit("登録番組がありません。もう一度EPGに戻り操作して下さい。
      "); -}else{ -$stationid = $rowdata[10]; -$subtitle = $rowdata[5] . $rowdata[6]; -$startdatetime = $rowdata[1]; -$enddatetime = $rowdata[2]; -$lengthmin = $rowdata[3]; -} - - - // - DB登録作業 @@ -94,25 +58,21 @@ //min pidを探す $query = "SELECT min(pid) FROM foltia_subtitle "; -// $rs = m_query($con, $query, "DBクエリに失敗しました"); - $rs = sql_query($con, $query, "DBクエリに失敗しました"); - $rowdata = $rs->fetch(); - if (! $rowdata) { + $rs = m_query($con, $query, "DBクエリに失敗しました"); + $maxrows = pg_num_rows($rs); + if ($maxrows == 0){ $insertpid = -1 ; }else{ + $rowdata = pg_fetch_row($rs, 0); $insertpid = $rowdata[0]; - if ($insertpid > 0){ - $insertpid = -1; - }else{ - $insertpid-- ; - } + $insertpid-- ; } // next 話数を探す $query = "SELECT max(countno) FROM foltia_subtitle WHERE tid = 0"; -// $rs = m_query($con, $query, "DBクエリに失敗しました"); - $rs = sql_query($con, $query, "DBクエリに失敗しました"); - $rowdata = $rs->fetch(); - if (! $rowdata) { + $rs = m_query($con, $query, "DBクエリに失敗しました"); + $maxrows = pg_num_rows($rs); + if ($maxrows == 0){ $nextcno = 1 ; }else{ + $rowdata = pg_fetch_row($rs, 0); $nextcno = $rowdata[0]; $nextcno++ ; @@ -121,45 +81,23 @@ //INSERT if ($demomode){ - print "下記予約を完了いたしました。
      "; }else{ -$userclass = getuserclass($con); -if ( $userclass <= 2){ -/* -pid -tid -stationid -countno -subtitle -startdatetime -enddatetime -startoffset -lengthmin -m2pfilename -pspfilename -epgaddedby -*/ +$query = " +insert into foltia_subtitle +values ( '$insertpid','0','$stationid', + '$nextcno','$subtitle','$startdatetime','$enddatetime','0' ,'$lengthmin')"; -$memberid = getmymemberid($con); - $query = " -insert into foltia_subtitle (pid ,tid ,stationid , countno ,subtitle , -startdatetime ,enddatetime ,startoffset , lengthmin , epgaddedby ) -values ( ?,'0',?,?,?,?,?,'0',?,?)"; -// $rs = m_query($con, $query, "DBクエリに失敗しました"); - $rs = sql_query($con, $query, "DBクエリに失敗しました",array($insertpid,$stationid,$nextcno,$subtitle,$startdatetime,$enddatetime,$lengthmin,$memberid)); + $rs = m_query($con, $query, "DBクエリに失敗しました"); - //addatq.pl - //キュー入れプログラムをキック - //引数 TID チャンネルID - //echo("$toolpath/perl/addatq.pl $tid $station"); +//addatq.pl +//キュー入れプログラムをキック +//引数 TID チャンネルID +//echo("$toolpath/perl/addatq.pl $tid $station"); $oserr = system("$toolpath/perl/addatq.pl 0 0"); - print "下記予約を完了いたしました。
      "; -}else{ - print "EPG予約を行う権限がありません。"; -}// end if $userclass <= 2 + }//end if demomode - +print "下記予約を完了いたしました。
      "; }else{ @@ -168,12 +106,17 @@ } +?> -print "\n"; -print ""; -print "\n"; -print "\n"; -print "\n"; -print "\n"; -print "\n
      放送開始".htmlspecialchars($startdatetime)."
      放送終了".htmlspecialchars($enddatetime)."
      局コード".htmlspecialchars($stationid)."
      尺(分)".htmlspecialchars($lengthmin)."
      番組名".htmlspecialchars($subtitle)."
      "; + + + 放送開始$startdatetime + 放送終了$enddatetime + 局コード$stationid + 尺(分)$lengthmin + 番組名$subtitle + + +"; ?> Index: trunk/install/php/m.php =================================================================== --- trunk/install/php/m.php (リビジョン 128) +++ (リビジョン ) @@ -1,311 +1,0 @@ - - - - - - "; - -print "foltia:番組手動予約 -"; -}//end function printtitle() - -printtitle(); -?> - -
      - -
      -

      -番組手動予約 -

      -
      -全項目手動指定で予約します。

      \n"; -}else{ - -$lengthmin = getgetnumform(lengthmin); -$recstid = getgetnumform(recstid); -$pname = getgetform(pname); -//$usedigital = getgetnumform(usedigital); - -//確認 -$startdatetime = "$startdate"."$starttime"; -if (foldatevalidation($startdatetime)){ -//print "valid"; -}else{ - $errflag = 1; - $errmsg = "日付が不正です。"; -} -if ($lengthmin < 361){ -//valid -}else{ - $errflag = 2; - $errmsg = "録画時間は360分で区切ってください。"; -} -//局確認 -if ($recstid != ""){ -$query = " -SELECT stationname -FROM foltia_station -WHERE stationid = ? "; -// $stationvalid = m_query($con, $query, "DBクエリに失敗しました"); - $stationvalid = sql_query($con, $query, "DBクエリに失敗しました",array($recstid)); - $recstationname = $stationvalid->fetch(); - $stationvalid->closeCursor(); - - if (!is_array($recstationname) || empty($recstationname)) { - $errflag = 3; - $errmsg = "放送局設定が異常です。"; - } -}else{ - $errflag = 2; - $errmsg = "録画する局を設定してください。"; -} -//デジタル優先 -/*if ($usedigital == 1){ -}else{ - $usedigital = 0; -} -*/ -//正しければ -if ($errflag == 0){ -//重複があるか? -//未チェック - -//デモモードじゃなかったら書き込み -$enddatetime = calcendtime($startdatetime,$lengthmin); - -//時刻検査 -if (($startdatetime > $now ) && ($enddatetime > $now ) && ($enddatetime > $startdatetime ) ){ - -//min pidを探す -$query = "SELECT min(pid) FROM foltia_subtitle "; -// $rs = m_query($con, $query, "DBクエリに失敗しました"); - $rs = sql_query($con, $query, "DBクエリに失敗しました"); - $rowdata = $rs->fetch(); - $rs->closeCursor(); - if (! $rowdata) { - $insertpid = -1 ; - }else{ - if ($rowdata[0] > 0) { - $insertpid = -1 ; - }else{ - $insertpid = $rowdata[0]; - $insertpid-- ; - } - } -// next 話数を探す -$query = "SELECT max(countno) FROM foltia_subtitle WHERE tid = 0"; -// $rs = m_query($con, $query, "DBクエリに失敗しました"); - $rs = sql_query($con, $query, "DBクエリに失敗しました"); - $rowdata = $rs->fetch(); - $rs->closeCursor(); - if (! $rowdata) { - $nextcno = 1 ; - }else{ - $nextcno = $rowdata[0]; - $nextcno++ ; - } - -//INSERT -if ($demomode){ -}else{ - $userclass = getuserclass($con); - if ( $userclass <= 2){ - $memberid = getmymemberid($con); - - $query = " - insert into foltia_subtitle (pid ,tid ,stationid , countno ,subtitle , -startdatetime ,enddatetime ,startoffset , lengthmin , epgaddedby ) - values ( ?,'0',?,?,?,?,?,'0',?,?)"; - -// $rs = m_query($con, $query, "DBクエリに失敗しました"); -//print "【DEBUG】$insertpid,$recstid,$nextcno,$pname,$startdatetime,$enddatetime ,$lengthmin,$memberid
      \n"; - $rs = sql_query($con, $query, "DBクエリに失敗しました",array($insertpid,$recstid,$nextcno,$pname,$startdatetime,$enddatetime ,$lengthmin,$memberid)); - - //addatq.pl - //キュー入れプログラムをキック - //引数 TID チャンネルID - //echo("$toolpath/perl/addatq.pl $tid $station"); - //exec("$toolpath/perl/addatq.pl 0 0"); - $oserr = system("$toolpath/perl/addatq.pl 0 0"); - }else{ - print "EPG予約を行う権限がありません。"; - }// end if $userclass <= 2 -}//end if demomode - -print "下記予約を完了いたしました。
      "; -//結果表示 -print "録画開始:"; -echo foldate2print($startdatetime); -print "
      -録画終了:"; -echo foldate2print($enddatetime); -print "
      -録画尺: $lengthmin 分
      -録画局:$recstationname[0]
      -番組名:$pname
      -"; -exit(); -}else{ -print "時刻が不正なために予約できませんでした。
      "; - -} - - -}else{ - print "入力項目が正しくなさそうです。$errmsg
      \n"; -} - -}// 初回表示かデータ処理か -?> - -

      放送日: - " /> - 年月日 Ex.

      -

      録画開始時刻: - " /> - 時分 Ex.

      -

      - 録画尺: - "/> - 分 (最長360分)

      - -

      録画局: - 0 -UNION -SELECT DISTINCT stationid,stationname,stationrecch ,digitalch -FROM foltia_station -WHERE digitalch > 0 -UNION -SELECT DISTINCT stationid,stationname,stationrecch ,digitalch -FROM foltia_station -WHERE stationrecch = -2 -ORDER BY x ASC"; - -$stations = sql_query($con, $query, "DBクエリに失敗しました"); -$rowdata = $stations->fetch(); - -if ($rowdata) { - do { - if ($recstid == $rowdata[0]){ - print " $rowdata[1] ($rowdata[2]ch / $rowdata[3]ch) \n"; - }elseif( $rowdata[2] == -2){ - print " $rowdata[1] (RADIKO) \n"; - }else{ - print " $rowdata[1] ($rowdata[2]ch / $rowdata[3]ch) \n"; - } - } while ($rowdata = $stations->fetch()); -}else{ -print "放送局データベースが正しくセットアップされていません。録画可能局がありません"; -} -$stations->closeCursor(); -//外部入力チャンネル -$query = " -SELECT stationid as x ,stationname,stationrecch -FROM foltia_station -WHERE stationrecch > -2 AND stationrecch < 1 -ORDER BY x ASC"; - -// $stations = m_query($con, $query, "DBクエリに失敗しました"); - $stations = sql_query($con, $query, "DBクエリに失敗しました"); -$rowdata = $stations->fetch(); -if ($rowdata) { - do { - if ($rowdata[0] != 0){ - if ($recstid == $rowdata[0]){ - print " $rowdata[1] \n"; - }else{ - print " $rowdata[1] \n"; - } - - } - } while ($rowdata = $stations->fetch()); -} -$stations->closeCursor(); -/* -print "

      デジタル録画を優先:"; - -if ($usedigital == 1){ -print " する  - しない  -"; -}else{ -print " する  - しない  -"; -} -*/ -?> -

      番組名: - " /> -

      - -  - - - - Index: trunk/install/php/accountregist.php =================================================================== --- trunk/install/php/accountregist.php (リビジョン 94) +++ (リビジョン ) @@ -1,153 +1,0 @@ - - - - - - - - "; - -print "foltia:新規アカウント登録 -"; -}//end function printtitle() - -printtitle(); -?> - - -

      -新規アカウント登録 -

      -
      -新規アカウント登録をします。

      \n"; - -}else{ -//すでにそのユーザが存在しているかどうか確認 -if ($username != ""){ -$query = " -SELECT count(memberid) -FROM foltia_envpolicy -WHERE foltia_envpolicy.name = ? -"; -// $isaccountexist = m_query($con, $query, "DBクエリに失敗しました"); - $isaccountexist = sql_query($con, $query, "DBクエリに失敗しました",array($username)); - - $isaccountexistncount = $isaccountexist->fetchColumn(0); - - if ($isaccountexistncount == 0){ - //valid - }else{ - $errflag = 1; - $errmsg = "そのユーザ名は既に使われています。"; - } -} -if ($userpasswd == ""){ - $errflag = 2; - $errmsg = "パスワードが不適切です。半角英数を指定して下さい。"; -} - - -if ($errflag == 0){ -// next midを探す -$query = " -SELECT max(memberid) -FROM foltia_envpolicy -"; - $rs = m_query($con, $query, "DBクエリに失敗しました"); - $maxid = $rs->fetchColumn(0); - if ($maxid) { - $nextcno = $maxid + 1; - }else{ - $nextcno = 1; - } - -//登録 -//INSERT -if ($demomode){ -}else{ -/* -ユーザクラス -0:特権管理者 -1:管理者:予約削除、ファイル削除が出来る -2:利用者:EPG追加、予約追加が出来る -3:ビュアー:ファイルダウンロードが出来る -4:ゲスト:インターフェイスが見れる -*/ -$remotehost = gethostbyaddr($_SERVER['REMOTE_ADDR']); - -$query = " -insert into foltia_envpolicy -values ( ?,'2',?,?,now(),?)"; -//print "$query
      \n"; -// $rs = m_query($con, $query, "DBクエリに失敗しました"); - $rs = sql_query($con, $query, "DBクエリに失敗しました",array($nextcno,$username,$userpasswd,$remotehost)); - -print "次のアカウントを登録しました。
      -ログイン名:$username
      -パスワード:$userpasswd"; - -if ($environmentpolicytoken != ""){ - print "+セキュリティコード
      \n"; -} -print "ログイン
      \n"; - -print " - -"; - $oserr = system("$toolpath/perl/envpolicyupdate.pl"); -exit; - -}//endif デモモード -}else{//errorフラグあったら -print "$errmsg / $errflag
      \n"; - -}//end if エラーじゃなければ - -}//end if "" -?> - -
      -

      登録ユーザ名: - - (半角英数のみ)

      -

      登録パスワード: - - (半角英数のみ)

      - -  -
      - - - Index: trunk/install/php/view_syabas.php =================================================================== --- trunk/install/php/view_syabas.php (リビジョン 94) +++ (リビジョン ) @@ -1,86 +1,0 @@ -|0|0|http://servername/foltia/tv/filename.m2p| - -参考URL -http://www.geocities.co.jp/SiliconValley-Cupertino/2647/tec.html - -*/ - -include("./foltialib.php"); -$con = m_connect(); - -if ($useenvironmentpolicy == 1){ - if (!isset($_SERVER['PHP_AUTH_USER'])) { - header("WWW-Authenticate: Basic realm=\"foltia\""); - header("HTTP/1.0 401 Unauthorized"); - redirectlogin(); - exit; - } else { - login($con,$_SERVER['PHP_AUTH_USER'],$_SERVER['PHP_AUTH_PW']); - } -}//end if login - - -$pid = getgetnumform(pid); - - -if ($pid == "") { - exit; -} - -$query = " -SELECT -foltia_program.tid, -stationname, -foltia_program.title, -foltia_subtitle.countno, -foltia_subtitle.subtitle, -foltia_subtitle.startdatetime , -foltia_subtitle.lengthmin , -foltia_subtitle.pid , -foltia_subtitle.m2pfilename , -foltia_subtitle.pspfilename -FROM foltia_subtitle , foltia_program ,foltia_station -WHERE foltia_program.tid = foltia_subtitle.tid AND foltia_station.stationid = foltia_subtitle.stationid - AND foltia_subtitle.pid = ? "; -// $rs = m_query($con, $query, "DBクエリに失敗しました"); -$rs = sql_query($con, $query, "DBクエリに失敗しました",array($pid)); -$rowdata = $rs->fetch(); -if (! $rowdata) { - print ""; - exit; -}else{ -$title = $rowdata[2]; -$episode = $rowdata[3]; -$subtitle = $rowdata[4]; -$m2pfilename = $rowdata[8]; -$serveruri = getserveruri(); -} - -print "\n"; -print "\n"; - -print "$title"; -print " 第". "$episode" . "話 "; -print "$subtitle"; -print "|0|0|"; -print "http://$serveruri$httpmediamappath/$m2pfilename"; -print "|"; - -?> - - - Index: trunk/install/php/mp4player.php =================================================================== --- trunk/install/php/mp4player.php (リビジョン 135) +++ (リビジョン ) @@ -1,140 +1,0 @@ -fetch(); - -//$title = htmlspecialchars(mb_convert_encoding($rowdata[0],"UTF-8", "EUC-JP")); -$title = htmlspecialchars($rowdata[0]); - if ($rowdata[1] == ""){ - $countno = ""; - }else{ - $countno = "第".htmlspecialchars($rowdata[1])."話"; - } -//$subtitle = htmlspecialchars(mb_convert_encoding($rowdata[2],"UTF-8", "EUC-JP")); -$subtitle = htmlspecialchars($rowdata[2]); -$tid = htmlspecialchars($rowdata[3]); -$filename = htmlspecialchars($rowdata[4]); - -}else{//引数なしエラー処理 - -header("Status: 404 Not Found",TRUE,404); -print " - - - \n"; - print " foltia HTML5 Video PlayerNo pid."; - exit ; -} - -if ($filename == "") {//ファイルなしなしエラー処理 -header("Status: 404 Not Found",TRUE,404); -print " - - - \n"; - print " foltia HTML5 Video PlayerFile not found."; - exit ; -} - - -print "\n\n\n\n -foltia HTML5 Video Player / $title $countno $subtitle\n"; -$mp4videofileurl = "http://". getserverfqdn() ."$httpmediamappath/$tid.localized/mp4/$filename"; -?> - - - - - - - - - - - - - -
      - - - -

      Download Video: - - HTML5 Video Player by VideoJS -

      -
      - -" -?> - - Index: trunk/install/php/myfoltia.php =================================================================== --- trunk/install/php/myfoltia.php (リビジョン 70) +++ (リビジョン ) @@ -1,19 +1,0 @@ - Index: trunk/install/mktable.txt =================================================================== --- trunk/install/mktable.txt (リビジョン 113) +++ trunk/install/mktable.txt (リビジョン 1) @@ -1,3 +1,2 @@ - drop table foltia_program ; @@ -33,8 +32,5 @@ lengthmin int8, m2pfilename text , -PSPfilename text , -epgaddedby int8 , -lastupdate timestamp, -filestatus int4 +PSPfilename text ); create unique index foltia_subtitle_pid_index on foltia_subtitle (pid); @@ -49,8 +45,7 @@ drop table foltia_tvrecord; create table foltia_tvrecord ( -tid int8 , +tid int8, stationid int8, -bitrate int8 , -digital int8 +bitrate int8 ); create index foltia_tvrecord_tid_index on foltia_tvrecord (tid); @@ -62,5 +57,5 @@ drop table foltia_epg; create table foltia_epg ( -epgid BIGSERIAL PRIMARY KEY , +epgid int8, startdatetime int8, enddatetime int8, @@ -80,5 +75,5 @@ drop table foltia_m2pfiles; create table foltia_m2pfiles ( -m2pfilename text PRIMARY KEY +m2pfilename text ); REVOKE ALL on "foltia_m2pfiles" from PUBLIC; @@ -88,5 +83,5 @@ create table foltia_mp4files ( tid int8, -mp4filename text PRIMARY KEY +mp4filename text ); REVOKE ALL on "foltia_mp4files" from PUBLIC; @@ -95,5 +90,5 @@ drop table foltia_station; CREATE TABLE foltia_station ( - stationid bigint PRIMARY KEY, + stationid bigint NOT NULL, stationname text, stationrecch bigint, @@ -103,7 +98,5 @@ tunerch text, device text, - ontvcode text, - digitalch bigint, - digitalstationband bigint + ontvcode text ); REVOKE ALL on "foltia_station" from PUBLIC; @@ -139,118 +132,73 @@ -- INSERT INTO foltia_program VALUES (0, 'EPG録画', '', '', NULL, '', '', 3, 1, '', ''); -INSERT INTO foltia_tvrecord VALUES (0,0,5,1); - - - -INSERT INTO foltia_station VALUES (0, '[全局]', 0, '', '', '', '', '', '',NULL,NULL); -INSERT INTO foltia_station VALUES (1, 'NHK総合', 1, 'NHK', '', NULL, NULL, NULL, '0031.ontvjapan.com',27,0); -INSERT INTO foltia_station VALUES (3, 'NHK教育', 3, 'ETV', '', NULL, NULL, NULL, '0041.ontvjapan.com',26,0); -INSERT INTO foltia_station VALUES (4, '日本テレビ', 4, 'NTV', '', NULL, NULL, NULL, '0004.ontvjapan.com',25,0); -INSERT INTO foltia_station VALUES (6, 'TBS', 6, 'TBS', '', NULL, NULL, NULL, '0005.ontvjapan.com',22,0); -INSERT INTO foltia_station VALUES (8, 'フジテレビ', 8, 'CX', '', NULL, NULL, NULL, '0006.ontvjapan.com',21,0); -INSERT INTO foltia_station VALUES (10, 'テレビ朝日', 10, 'EX', '', NULL, NULL, NULL, '0007.ontvjapan.com',24,0); -INSERT INTO foltia_station VALUES (12, 'テレビ東京', 12, 'TX', '', NULL, NULL, NULL, '0008.ontvjapan.com',23,0); -INSERT INTO foltia_station VALUES (42, 'tvk', 42, 'TVK', '', '', '', '', '0009.ontvjapan.com',18,0); -INSERT INTO foltia_station VALUES (14, 'TOKYO MX', 14, 'MX', '', '', '', '', '0016.ontvjapan.com',20,0); -INSERT INTO foltia_station VALUES (46, 'チバテレビ', -10, 'CTC', '', NULL, NULL, NULL, NULL,30,0); -INSERT INTO foltia_station VALUES (38, 'テレ玉', -10, 'TVS', '', NULL, NULL, NULL, NULL,32,0); -INSERT INTO foltia_station VALUES (418, '放送大学', -10, 'UAIR', '', NULL, NULL, NULL, '0013.ontvjapan.com',28,0); -INSERT INTO foltia_station VALUES (101, 'NHK-BS1', 0, 'BS7', '', '', '101', '', '3001.ontvjapan.com',101,1); -INSERT INTO foltia_station VALUES (102, 'NHK-BS2', 0, 'BS11', '', '', '102', '', '3002.ontvjapan.com',102,1); -INSERT INTO foltia_station VALUES (103, 'NHK-BShi', 0, '', '', '', '103', '', '3003.ontvjapan.com',103,1); -INSERT INTO foltia_station VALUES (409, 'BS日テレ', 0, '', '', '', '141', '', '3004.ontvjapan.com',141,1); -INSERT INTO foltia_station VALUES (384, 'BS朝日', 0, '', '', '', '151', '', '3005.ontvjapan.com',151,1); -INSERT INTO foltia_station VALUES (161, 'BS-TBS', 0, '', '', '', '161', '', '3006.ontvjapan.com',161,1); -INSERT INTO foltia_station VALUES (389, 'BS Japan', 0, '', '', '', '171', '','3007.ontvjapan.com',171,1); -INSERT INTO foltia_station VALUES (381, 'BSフジ', 0, '', '', '', '181', '', '3008.ontvjapan.com',181,1); -INSERT INTO foltia_station VALUES (191, 'WOWOW', 0, 'BS5', '', '', '191', '', '3009.ontvjapan.com',191,1); -INSERT INTO foltia_station VALUES (420, 'WOWOW2', 0, '', '', '', '192', '', '3010.ontvjapan.com',192,1); -INSERT INTO foltia_station VALUES (421, 'WOWOW3', 0, '', '', '', '193', '', '3011.ontvjapan.com',193,1); -INSERT INTO foltia_station VALUES (468, 'BS11デジタル', 0, '', '', '', '211', '', '3013.ontvjapan.com',211,1); -INSERT INTO foltia_station VALUES (469, 'Twellv', 0, '', '', '', '222', '', '3014.ontvjapan.com',222,1); -INSERT INTO foltia_station VALUES (408, 'ファミリー劇場', 0, '', '', '', '751', '', '1015.ontvjapan.com',NULL,NULL); -INSERT INTO foltia_station VALUES (397, 'カートゥーンネットワーク', 0, '', '', '', '780', '', '1046.ontvjapan.com',NULL,NULL); -INSERT INTO foltia_station VALUES (263, 'アニマックス', 0, '', '', '', '782', '', '1047.ontvjapan.com',NULL,NULL); -INSERT INTO foltia_station VALUES (261, 'キッズステーション', 0, '', '', 'c', '335', '', '1045.ontvjapan.com',NULL,NULL); -INSERT INTO foltia_station VALUES (449, 'ディスカバリーチャンネル', 0, '', '', '', '796', '', '1062.ontvjapan.com',NULL,NULL); -INSERT INTO foltia_station VALUES (448, 'MONDO21', 0, '', '', '', '722', '', '1049.ontvjapan.com',NULL,NULL); -INSERT INTO foltia_station VALUES (401, 'チャンネルNECO', 0, '', '', '', '750', '', '1008.ontvjapan.com',NULL,NULL); -INSERT INTO foltia_station VALUES (455, '330ch WOWOW', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (480, 'TBSラジオ(954)', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (477, '北海道文化放送', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (463, 'gooアニメ', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (461, '@nifty', -10, '', '', '', '', '', '',NULL,NULL); -INSERT INTO foltia_station VALUES (466, 'NHKラジオ第一', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (474, '日テレプラス', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (476, 'ニコニコアニメチャンネル', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (451, 'RKB毎日放送', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (452, '北海道放送', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (454, 'テレビ和歌山', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (456, '静岡放送', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (457, 'i-revo', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (459, '東北放送', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (464, 'テレビ山口', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (478, '札幌テレビ放送', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (395, 'カミングスーンTV', -10, '', '', '', '', '', '',NULL,NULL); -INSERT INTO foltia_station VALUES (443, 'スーパーチャンネル', -10, '', '', '', '', '', '',NULL,NULL); -INSERT INTO foltia_station VALUES (385, 'TBSチャンネル', 0, '', '', '', '765', '', '',NULL,NULL); -INSERT INTO foltia_station VALUES (462, '瀬戸内海放送', -10, '', '', '', '', '', '',NULL,NULL); -INSERT INTO foltia_station VALUES (473, 'フジCSHD', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (475, 'スカパー181ch', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (479, '北海道テレビ放送', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (450, 'NHK教育3', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (453, 'バンダイチャンネルキッズ', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (458, '日テレプラス&サイエンス', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (460, 'ビクトリーチャンネル', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (472, 'ytv', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (422, '東海テレビ', -10, '', '', '', '', '', '',NULL,NULL); -INSERT INTO foltia_station VALUES (423, 'ShowTime', -10, '', '', '', '', '', '',NULL,NULL); -INSERT INTO foltia_station VALUES (424, 'メ〜テレ', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (425, '三重テレビ', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (426, '中京テレビ', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (293, 'AT-X', -10, '', '', NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (295, 'フジ721', -10, '', '', NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (380, 'スカパー180ch', -10, '', '', NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (427, '岐阜放送', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (428, 'テレビ新広島', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (383, 'サンテレビ', -10, '', '', NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (429, 'CBCテレビ', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (386, 'テレ朝チャンネル', -10, '', '', NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (390, 'サンテレビジョン', -10, '', '', NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (392, 'スカパー183ch', -10, '', '', NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (394, 'スカパー160ch', -10, '', '', NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (396, 'KBS京都', -10, '', '', NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (398, 'テレビ大阪', -10, '', '', NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (399, 'ABCテレビ', -10, '', '', NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (400, 'なし', -10, '', '', NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (402, '関西テレビ', -10, '', '', NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (406, 'MBS毎日放送', -10, '', '', NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (407, 'animate.tv', -10, '', '', NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (410, 'テレビ愛知', -10, '', '', NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (411, 'インターネット', -10, '', '', NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (413, 'よみうりテレビ', -10, '', '', NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (414, 'LFX488', -10, '', '', NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (415, 'LFX', -10, '', '', NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (416, 'LFX BB', -10, '', '', NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (419, 'GyaO', -10, '', '', NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (417, 'とちぎテレビ', -10, 'TTV', '', NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (412, '群馬テレビ', -10, 'GTV', '', NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (430, '奈良テレビ', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (431, 'TVQ九州放送', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (432, 'テレビ北海道', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (433, 'BIGLOBEストリーム', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (434, 'テレビせとうち', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (435, '中国放送', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (436, '文化放送(1134)', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (437, '広島ホームテレビ', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (438, '広島テレビ', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (439, '岡山放送', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (440, '山陽放送', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (441, 'びわ湖放送', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (442, 'NHK-FM', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (444, 'バンダイチャンネル', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (445, 'フレッツ・スクウェア(NTT東日本)', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (446, 'フジ739', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (447, 'Yahoo!動画', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); +INSERT INTO foltia_tvrecord VALUES (0,0,5); + +INSERT INTO foltia_station VALUES (1, 'NHK総合', 1, 'NHK', '', NULL, NULL, NULL, '0031.ontvjapan.com'); +INSERT INTO foltia_station VALUES (3, 'NHK教育', 3, 'ETV', '', NULL, NULL, NULL, '0041.ontvjapan.com'); +INSERT INTO foltia_station VALUES (4, '日本テレビ', 4, 'NTV', '', NULL, NULL, NULL, '0004.ontvjapan.com'); +INSERT INTO foltia_station VALUES (6, 'TBS', 6, 'TBS', '', NULL, NULL, NULL, '0005.ontvjapan.com'); +INSERT INTO foltia_station VALUES (8, 'フジテレビ', 8, 'CX', '', NULL, NULL, NULL, '0006.ontvjapan.com'); +INSERT INTO foltia_station VALUES (10, 'テレビ朝日', 10, 'EX', '', NULL, NULL, NULL, '0007.ontvjapan.com'); +INSERT INTO foltia_station VALUES (12, 'テレビ東京', 12, 'TX', '', NULL, NULL, NULL, '0008.ontvjapan.com'); +INSERT INTO foltia_station VALUES (422, '東海テレビ', -10, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO foltia_station VALUES (42, 'tvk', 5, 'TVK', '', NULL, NULL, NULL, '0009.ontvjapan.com'); +INSERT INTO foltia_station VALUES (423, 'ShowTime', -10, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO foltia_station VALUES (424, 'メ〜テレ', -10, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO foltia_station VALUES (409, 'BS日テレ', 0, '', '', 'b', 'X141', NULL, '3004.ontvjapan.com'); +INSERT INTO foltia_station VALUES (384, 'BS朝日', 0, '', '', 'b', 'X151', NULL, '3005.ontvjapan.com'); +INSERT INTO foltia_station VALUES (425, '三重テレビ', -10, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO foltia_station VALUES (426, '中京テレビ', -10, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO foltia_station VALUES (293, 'AT-X', 0, '', '', NULL, NULL, NULL, NULL); +INSERT INTO foltia_station VALUES (161, 'BS-i', 0, '', '', 'b', 'X161', NULL, '3006.ontvjapan.com'); +INSERT INTO foltia_station VALUES (382, 'BSジャパン', 0, '', '', 'b', 'X171', NULL, '3007.ontvjapan.com'); +INSERT INTO foltia_station VALUES (295, 'フジ721', -10, '', '', NULL, NULL, NULL, NULL); +INSERT INTO foltia_station VALUES (380, 'スカパー180ch', -10, '', '', NULL, NULL, NULL, NULL); +INSERT INTO foltia_station VALUES (427, '岐阜放送', -10, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO foltia_station VALUES (428, 'テレビ新広島', -10, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO foltia_station VALUES (383, 'サンテレビ', -10, '', '', NULL, NULL, NULL, NULL); +INSERT INTO foltia_station VALUES (429, 'CBCテレビ', -10, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO foltia_station VALUES (385, 'TBSチャンネル', 0, '', '', NULL, NULL, NULL, NULL); +INSERT INTO foltia_station VALUES (386, 'テレ朝チャンネル', 0, '', '', NULL, NULL, NULL, NULL); +INSERT INTO foltia_station VALUES (387, 'TVKテレビ', 5, '', '', NULL, NULL, NULL, NULL); +INSERT INTO foltia_station VALUES (388, 'テレビ神奈川', 5, '', '', NULL, NULL, NULL, NULL); +INSERT INTO foltia_station VALUES (389, 'BS Japan', 0, '', '', 'b', 'X171', NULL, NULL); +INSERT INTO foltia_station VALUES (390, 'サンテレビジョン', -10, '', '', NULL, NULL, NULL, NULL); +INSERT INTO foltia_station VALUES (0, '[全局]', 0, NULL, NULL, NULL, NULL, NULL, NULL); +INSERT INTO foltia_station VALUES (392, 'スカパー183ch', 0, '', '', NULL, NULL, NULL, NULL); +INSERT INTO foltia_station VALUES (393, 'BSQR 489', -10, '', '', 'b', 'X489', NULL, NULL); +INSERT INTO foltia_station VALUES (394, 'スカパー160ch', -10, '', '', NULL, NULL, NULL, NULL); +INSERT INTO foltia_station VALUES (396, 'KBS京都', -10, '', '', NULL, NULL, NULL, NULL); +INSERT INTO foltia_station VALUES (398, 'テレビ大阪', -10, '', '', NULL, NULL, NULL, NULL); +INSERT INTO foltia_station VALUES (399, 'ABCテレビ', -10, '', '', NULL, NULL, NULL, NULL); +INSERT INTO foltia_station VALUES (400, 'なし', -10, '', '', NULL, NULL, NULL, NULL); +INSERT INTO foltia_station VALUES (402, '関西テレビ', -10, '', '', NULL, NULL, NULL, NULL); +INSERT INTO foltia_station VALUES (406, 'MBS毎日放送', -10, '', '', NULL, NULL, NULL, NULL); +INSERT INTO foltia_station VALUES (407, 'animate.tv', -10, '', '', NULL, NULL, NULL, NULL); +INSERT INTO foltia_station VALUES (410, 'テレビ愛知', -10, '', '', NULL, NULL, NULL, NULL); +INSERT INTO foltia_station VALUES (411, 'インターネット', -10, '', '', NULL, NULL, NULL, NULL); +INSERT INTO foltia_station VALUES (381, 'BSフジ', 0, '', '', 'b', 'X181', NULL, '3008.ontvjapan.com'); +INSERT INTO foltia_station VALUES (413, 'よみうりテレビ', -10, '', '', NULL, NULL, NULL, NULL); +INSERT INTO foltia_station VALUES (414, 'LFX488', -10, '', '', NULL, NULL, NULL, NULL); +INSERT INTO foltia_station VALUES (415, 'LFX', -10, '', '', NULL, NULL, NULL, NULL); +INSERT INTO foltia_station VALUES (416, 'LFX BB', -10, '', '', NULL, NULL, NULL, NULL); +INSERT INTO foltia_station VALUES (191, 'WOWOW', 0, 'BS5', '', 'b', 'X191', NULL, '3009.ontvjapan.com'); +INSERT INTO foltia_station VALUES (419, 'GyaO', -10, '', '', NULL, NULL, NULL, NULL); +INSERT INTO foltia_station VALUES (418, '放送大学', 0, 'UAIR', '', NULL, NULL, NULL, '0013.ontvjapan.com'); +INSERT INTO foltia_station VALUES (420, 'WOWOW2', 0, NULL, NULL, 'b', 'X192', NULL, '3010.ontvjapan.com'); +INSERT INTO foltia_station VALUES (417, 'とちぎテレビ', -10, 'TTV', '', NULL, NULL, NULL, NULL); +INSERT INTO foltia_station VALUES (412, '群馬テレビ', -10, 'GTV', '', NULL, NULL, NULL, NULL); +INSERT INTO foltia_station VALUES (46, '千葉テレビ', -10, 'CTC', '', NULL, NULL, NULL, NULL); +INSERT INTO foltia_station VALUES (38, 'テレビ埼玉', -10, 'TVS', '', NULL, NULL, NULL, NULL); +INSERT INTO foltia_station VALUES (14, '東京MXテレビ', 0, 'MX', '', NULL, NULL, NULL, NULL); +INSERT INTO foltia_station VALUES (421, 'WOWOW3', 0, NULL, NULL, 'b', 'X193', NULL, '3011.ontvjapan.com'); +INSERT INTO foltia_station VALUES (401, 'チャンネルNECO', 0, '', '', 'c', 'X242', NULL, '1008.ontvjapan.com'); +INSERT INTO foltia_station VALUES (395, 'カミングスーンTV', 0, '', '', 'c', 'X245', NULL, '1012.ontvjapan.com'); +INSERT INTO foltia_station VALUES (408, 'ファミリー劇場', 0, '', '', 'c', 'X254', NULL, '1015.ontvjapan.com'); +INSERT INTO foltia_station VALUES (397, 'カートゥーンネットワーク', 0, '', '', 'c', 'X262', NULL, '1046.ontvjapan.com'); +INSERT INTO foltia_station VALUES (103, 'NHK-BShi', 0, '', '', 'b', 'X103', '', '3003.ontvjapan.com'); +INSERT INTO foltia_station VALUES (101, 'NHK-BS1', 0, 'BS7', '', 'b', 'X101',NULL, '3001.ontvjapan.com'); +INSERT INTO foltia_station VALUES (102, 'NHK-BS2', 0, 'BS11', '', 'b', 'X102',NULL, '3002.ontvjapan.com'); +INSERT INTO foltia_station VALUES (261, 'キッズステーション', 0, '', '', 'c', 'X264', '', '1045.ontvjapan.com'); +INSERT INTO foltia_station VALUES (263, 'アニマックス', 0, '', '', 'c', 'X263', '', '1047.ontvjapan.com'); @@ -265,17 +213,4 @@ ADD CONSTRAINT foltia_station_pkey PRIMARY KEY (stationid); -drop table foltia_envpolicy; -CREATE TABLE foltia_envpolicy ( -memberid bigint PRIMARY KEY, -userclass bigint, -name text, -passwd1 text , -adddate timestamp, -remotehost text -); -REVOKE ALL on "foltia_envpolicy" from PUBLIC; -GRANT ALL on "foltia_envpolicy" to "foltia"; -create index foltia_envpolicy_index on foltia_envpolicy (name); -insert into foltia_envpolicy values ( '0','0','foltia','foltiapasswd',now(),''); - - + + Index: trunk/install/mktable.sqlite.txt =================================================================== --- trunk/install/mktable.sqlite.txt (リビジョン 111) +++ (リビジョン ) @@ -1,280 +1,0 @@ - -drop table foltia_program ; - -create table foltia_program ( -tid integer PRIMARY KEY, -title text , -startweektype text, -starttime text, -lengthmin integer, -firstlight text, -officialuri text , -aspect integer , -psp integer , -transfer text, -PSPdirname text -); -create unique index foltia_program_tid_index on foltia_program (tid); - --- REVOKE ALL on "foltia_program" from PUBLIC; --- GRANT UPDATE,SELECT,INSERT on "foltia_program" to "foltia"; - -drop table foltia_subtitle ; - -create table foltia_subtitle ( -pid integer PRIMARY KEY, -tid integer, -stationid integer, -countno integer, -subtitle text, -startdatetime integer, -enddatetime integer, -startoffset integer, -lengthmin integer, -m2pfilename text , -PSPfilename text , -epgaddedby integer , -lastupdate timestamp, -filestatus integer -); -create unique index foltia_subtitle_pid_index on foltia_subtitle (pid); -create index foltia_subtitle_tid_index on foltia_subtitle (tid); -create index foltia_subtitle_stationid_index on foltia_subtitle (stationid); -create index foltia_subtitle_enddatetime_index on foltia_subtitle (enddatetime); -create index foltia_subtitle_startdatetime_index on foltia_subtitle (startdatetime); - --- REVOKE ALL on "foltia_subtitle" from PUBLIC; --- GRANT UPDATE,SELECT,INSERT on "foltia_subtitle" to "foltia"; - -drop table foltia_tvrecord; -create table foltia_tvrecord ( -tid integer , -stationid integer, -bitrate integer , -digital integer -); -create index foltia_tvrecord_tid_index on foltia_tvrecord (tid); - --- REVOKE ALL on "foltia_tvrecord" from PUBLIC; --- GRANT ALL on "foltia_tvrecord" to "foltia"; - - -drop table foltia_epg; -create table foltia_epg ( -epgid integer PRIMARY KEY AUTOINCREMENT, -startdatetime integer, -enddatetime integer, -lengthmin integer , -ontvchannel text, -epgtitle text, -epgdesc text, -epgcategory text -); -create index foltia_epg_startdatetime_index on foltia_epg (startdatetime); -create index foltia_epg_enddatetime_index on foltia_epg (enddatetime); -create index foltia_epg_ontvchannel_index on foltia_epg (ontvchannel); - --- REVOKE ALL on "foltia_epg" from PUBLIC; --- GRANT ALL on "foltia_epg" to "foltia"; - -drop table foltia_m2pfiles; -create table foltia_m2pfiles ( -m2pfilename text PRIMARY KEY -); --- REVOKE ALL on "foltia_m2pfiles" from PUBLIC; --- GRANT ALL on "foltia_m2pfiles" to "foltia"; - -drop table foltia_mp4files; -create table foltia_mp4files ( -tid integer, -mp4filename text PRIMARY KEY -); --- REVOKE ALL on "foltia_mp4files" from PUBLIC; --- GRANT ALL on "foltia_mp4files" to "foltia"; - -drop table foltia_station; -CREATE TABLE foltia_station ( - stationid integer PRIMARY KEY, - stationname text, - stationrecch integer, - stationcallsign text, - stationuri text, - tunertype text, - tunerch text, - device text, - ontvcode text, - digitalch integer, - digitalstationband integer -); --- ADD CONSTRAINT foltia_station_pkey PRIMARY KEY (stationid); --- REVOKE ALL on "foltia_station" from PUBLIC; --- GRANT ALL on "foltia_station" to "foltia"; - --- --- PostgreSQL database dump --- - --- SET client_encoding = 'EUC_JP'; --- SET check_function_bodies = false; - --- SET SESSION AUTHORIZATION 'foltia'; - --- SET search_path = public, pg_catalog; - --- --- TOC entry 3 (OID 17158) --- Name: foltia_station; Type: TABLE; Schema: public; Owner: foltia --- - --- --- TOC entry 4 (OID 17158) --- Name: foltia_station; Type: ACL; Schema: public; Owner: foltia --- - - --- SET SESSION AUTHORIZATION 'foltia'; - --- --- Data for TOC entry 6 (OID 17158) --- Name: foltia_station; Type: TABLE DATA; Schema: public; Owner: foltia --- -INSERT INTO foltia_program VALUES (0, 'EPG録画', '', '', NULL, '', '', 3, 1, '', ''); -INSERT INTO foltia_tvrecord VALUES (0,0,5,1); - - - -INSERT INTO foltia_station VALUES (0, '[全局]', 0, '', '', '', '', '', '',NULL,NULL); -INSERT INTO foltia_station VALUES (1, 'NHK総合', 1, 'NHK', '', NULL, NULL, NULL, '0031.ontvjapan.com',27,0); -INSERT INTO foltia_station VALUES (3, 'NHK教育', 3, 'ETV', '', NULL, NULL, NULL, '0041.ontvjapan.com',26,0); -INSERT INTO foltia_station VALUES (4, '日本テレビ', 4, 'NTV', '', NULL, NULL, NULL, '0004.ontvjapan.com',25,0); -INSERT INTO foltia_station VALUES (6, 'TBS', 6, 'TBS', '', NULL, NULL, NULL, '0005.ontvjapan.com',22,0); -INSERT INTO foltia_station VALUES (8, 'フジテレビ', 8, 'CX', '', NULL, NULL, NULL, '0006.ontvjapan.com',21,0); -INSERT INTO foltia_station VALUES (10, 'テレビ朝日', 10, 'EX', '', NULL, NULL, NULL, '0007.ontvjapan.com',24,0); -INSERT INTO foltia_station VALUES (12, 'テレビ東京', 12, 'TX', '', NULL, NULL, NULL, '0008.ontvjapan.com',23,0); -INSERT INTO foltia_station VALUES (42, 'tvk', 42, 'TVK', '', '', '', '', '0009.ontvjapan.com',18,0); -INSERT INTO foltia_station VALUES (14, 'TOKYO MX', 14, 'MX', '', '', '', '', '0016.ontvjapan.com',20,0); -INSERT INTO foltia_station VALUES (46, 'チバテレビ', -10, 'CTC', '', NULL, NULL, NULL, NULL,30,0); -INSERT INTO foltia_station VALUES (38, 'テレ玉', -10, 'TVS', '', NULL, NULL, NULL, NULL,32,0); -INSERT INTO foltia_station VALUES (418, '放送大学', -10, 'UAIR', '', NULL, NULL, NULL, '0013.ontvjapan.com',28,0); -INSERT INTO foltia_station VALUES (101, 'NHK-BS1', 0, 'BS7', '', '', '101', '', '3001.ontvjapan.com',101,1); -INSERT INTO foltia_station VALUES (102, 'NHK-BS2', 0, 'BS11', '', '', '102', '', '3002.ontvjapan.com',102,1); -INSERT INTO foltia_station VALUES (103, 'NHK-BShi', 0, '', '', '', '103', '', '3003.ontvjapan.com',103,1); -INSERT INTO foltia_station VALUES (409, 'BS日テレ', 0, '', '', '', '141', '', '3004.ontvjapan.com',141,1); -INSERT INTO foltia_station VALUES (384, 'BS朝日', 0, '', '', '', '151', '', '3005.ontvjapan.com',151,1); -INSERT INTO foltia_station VALUES (161, 'BS-TBS', 0, '', '', '', '161', '', '3006.ontvjapan.com',161,1); -INSERT INTO foltia_station VALUES (389, 'BS Japan', 0, '', '', '', '171', '','3007.ontvjapan.com',171,1); -INSERT INTO foltia_station VALUES (381, 'BSフジ', 0, '', '', '', '181', '', '3008.ontvjapan.com',181,1); -INSERT INTO foltia_station VALUES (191, 'WOWOW', 0, 'BS5', '', '', '191', '', '3009.ontvjapan.com',191,1); -INSERT INTO foltia_station VALUES (420, 'WOWOW2', 0, '', '', '', '192', '', '3010.ontvjapan.com',192,1); -INSERT INTO foltia_station VALUES (421, 'WOWOW3', 0, '', '', '', '193', '', '3011.ontvjapan.com',193,1); -INSERT INTO foltia_station VALUES (468, 'BS11デジタル', 0, '', '', '', '211', '', '3013.ontvjapan.com',211,1); -INSERT INTO foltia_station VALUES (469, 'Twellv', 0, '', '', '', '222', '', '3014.ontvjapan.com',222,1); -INSERT INTO foltia_station VALUES (408, 'ファミリー劇場', 0, '', '', '', '751', '', '1015.ontvjapan.com',NULL,NULL); -INSERT INTO foltia_station VALUES (397, 'カートゥーンネットワーク', 0, '', '', '', '780', '', '1046.ontvjapan.com',NULL,NULL); -INSERT INTO foltia_station VALUES (263, 'アニマックス', 0, '', '', '', '782', '', '1047.ontvjapan.com',NULL,NULL); -INSERT INTO foltia_station VALUES (261, 'キッズステーション', 0, '', '', 'c', '335', '', '1045.ontvjapan.com',NULL,NULL); -INSERT INTO foltia_station VALUES (449, 'ディスカバリーチャンネル', 0, '', '', '', '796', '', '1062.ontvjapan.com',NULL,NULL); -INSERT INTO foltia_station VALUES (448, 'MONDO21', 0, '', '', '', '722', '', '1049.ontvjapan.com',NULL,NULL); -INSERT INTO foltia_station VALUES (401, 'チャンネルNECO', 0, '', '', '', '750', '', '1008.ontvjapan.com',NULL,NULL); -INSERT INTO foltia_station VALUES (455, '330ch WOWOW', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (480, 'TBSラジオ(954)', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (477, '北海道文化放送', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (463, 'gooアニメ', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (461, '@nifty', -10, '', '', '', '', '', '',NULL,NULL); -INSERT INTO foltia_station VALUES (466, 'NHKラジオ第一', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (474, '日テレプラス', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (476, 'ニコニコアニメチャンネル', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (451, 'RKB毎日放送', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (452, '北海道放送', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (454, 'テレビ和歌山', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (456, '静岡放送', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (457, 'i-revo', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (459, '東北放送', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (464, 'テレビ山口', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (478, '札幌テレビ放送', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (395, 'カミングスーンTV', -10, '', '', '', '', '', '',NULL,NULL); -INSERT INTO foltia_station VALUES (443, 'スーパーチャンネル', -10, '', '', '', '', '', '',NULL,NULL); -INSERT INTO foltia_station VALUES (385, 'TBSチャンネル', 0, '', '', '', '765', '', '',NULL,NULL); -INSERT INTO foltia_station VALUES (462, '瀬戸内海放送', -10, '', '', '', '', '', '',NULL,NULL); -INSERT INTO foltia_station VALUES (473, 'フジCSHD', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (475, 'スカパー181ch', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (479, '北海道テレビ放送', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (450, 'NHK教育3', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (453, 'バンダイチャンネルキッズ', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (458, '日テレプラス&サイエンス', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (460, 'ビクトリーチャンネル', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (472, 'ytv', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (422, '東海テレビ', -10, '', '', '', '', '', '',NULL,NULL); -INSERT INTO foltia_station VALUES (423, 'ShowTime', -10, '', '', '', '', '', '',NULL,NULL); -INSERT INTO foltia_station VALUES (424, 'メ〜テレ', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (425, '三重テレビ', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (426, '中京テレビ', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (293, 'AT-X', -10, '', '', NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (295, 'フジ721', -10, '', '', NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (380, 'スカパー180ch', -10, '', '', NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (427, '岐阜放送', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (428, 'テレビ新広島', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (383, 'サンテレビ', -10, '', '', NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (429, 'CBCテレビ', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (386, 'テレ朝チャンネル', -10, '', '', NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (390, 'サンテレビジョン', -10, '', '', NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (392, 'スカパー183ch', -10, '', '', NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (394, 'スカパー160ch', -10, '', '', NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (396, 'KBS京都', -10, '', '', NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (398, 'テレビ大阪', -10, '', '', NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (399, 'ABCテレビ', -10, '', '', NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (400, 'なし', -10, '', '', NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (402, '関西テレビ', -10, '', '', NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (406, 'MBS毎日放送', -10, '', '', NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (407, 'animate.tv', -10, '', '', NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (410, 'テレビ愛知', -10, '', '', NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (411, 'インターネット', -10, '', '', NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (413, 'よみうりテレビ', -10, '', '', NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (414, 'LFX488', -10, '', '', NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (415, 'LFX', -10, '', '', NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (416, 'LFX BB', -10, '', '', NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (419, 'GyaO', -10, '', '', NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (417, 'とちぎテレビ', -10, 'TTV', '', NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (412, '群馬テレビ', -10, 'GTV', '', NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (430, '奈良テレビ', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (431, 'TVQ九州放送', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (432, 'テレビ北海道', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (433, 'BIGLOBEストリーム', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (434, 'テレビせとうち', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (435, '中国放送', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (436, '文化放送(1134)', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (437, '広島ホームテレビ', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (438, '広島テレビ', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (439, '岡山放送', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (440, '山陽放送', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (441, 'びわ湖放送', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (442, 'NHK-FM', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (444, 'バンダイチャンネル', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (445, 'フレッツ・スクウェア(NTT東日本)', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (446, 'フジ739', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); -INSERT INTO foltia_station VALUES (447, 'Yahoo!動画', -10, NULL, NULL, NULL, NULL, NULL, NULL,NULL,NULL); - - - - --- --- TOC entry 5 (OID 17163) --- Name: foltia_station_pkey; Type: CONSTRAINT; Schema: public; Owner: foltia --- - --- ALTER TABLE ONLY foltia_station --- ADD CONSTRAINT foltia_station_pkey PRIMARY KEY (stationid); - -drop table foltia_envpolicy; -CREATE TABLE foltia_envpolicy ( -memberid integer PRIMARY KEY, -userclass integer, -name text, -passwd1 text , -adddate timestamp, -remotehost text -); --- REVOKE ALL on "foltia_envpolicy" from PUBLIC; --- GRANT ALL on "foltia_envpolicy" to "foltia"; -create index foltia_envpolicy_index on foltia_envpolicy (name); -insert into foltia_envpolicy values ( '0','0','foltia','foltiapasswd',datetime('now'),'');