差分発生行の前後
無視リスト:
コミット日時:
2010/02/28 22:28:26 (14 年前)
コミッタ:
sorshi
ログメッセージ:

SQLite採用

ファイル:

凡例:

変更無し
追加
削除
更新
コピー
移動
  • trunk/install/perl/singletranscode.pl

    r1 r94  
    2828use DBI; 
    2929use DBD::Pg; 
     30use DBD::SQLite; 
    3031use Schedule::At; 
    3132use Time::Local; 
     
    3435$path = $0; 
    3536$path =~ s/singletranscode.pl$//i; 
    36 if ($pwd ne "./"){ 
     37if ($path ne "./"){ 
    3738push( @INC, "$path"); 
    3839} 
     
    6364 
    6465#PSPトラコン必要かどうか 
    65         my $data_source = sprintf("dbi:%s:dbname=%s;host=%s;port=%d", 
    66  
    67                 $DBDriv,$DBName,$DBHost,$DBPort); 
    68          $dbh = DBI->connect($data_source,$DBUser,$DBPass) ||die $DBI::error;; 
     66$dbh = DBI->connect($DSN,$DBUser,$DBPass) ||die $DBI::error;; 
    6967 
    7068if ($ARGV[1] != ""){ 
    7169        $pid = $ARGV[1] ; 
    7270}else{ 
    73 $DBQuery =  "SELECT pid FROM  foltia_subtitle WHERE m2pfilename = '$ARGV[0]' "; 
    74          $sth = $dbh->prepare($DBQuery); 
    75         $sth->execute(); 
     71    $sth = $dbh->prepare($stmt{'singletranscode.1'}); 
     72    $sth->execute($ARGV[0]); 
    7673 @pidarray = $sth->fetchrow_array; 
    7774        unless ($pidarray[0]  == "" ){ 
     
    8683# 追加部分 
    8784 
    88 $query =  "SELECT count(*)  FROM  foltia_subtitle WHERE tid = '$tid' AND countno = '$countno' "; 
    89          $sth = $dbh->prepare($query); 
    90         $sth->execute(); 
     85$sth = $dbh->prepare($stmt{'singletranscode.2'}); 
     86$sth->execute($tid, $countno); 
    9187 @subticount= $sth->fetchrow_array; 
    9288 unless ($subticount[0]  >= 1){ 
    9389 
    94 $query =  "SELECT count(*)  FROM  foltia_subtitle WHERE tid = '$tid'  "; 
    95          $sth = $dbh->prepare($query); 
    96         $sth->execute(); 
     90    $sth = $dbh->prepare($stmt{'singletranscode.3'}); 
     91    $sth->execute($tid); 
    9792 @subticount= $sth->fetchrow_array; 
    9893 
     
    120115# PSP ------------------------------------------------------ 
    121116#PSPトラコン必要かどうか 
    122 $DBQuery =  "SELECT psp,aspect,title FROM  foltia_program WHERE tid = '$tid' "; 
    123          $sth = $dbh->prepare($DBQuery); 
    124         $sth->execute(); 
     117$sth = $dbh->prepare($stmt{'singletranscode.4'}); 
     118$sth->execute($tid); 
    125119 @psptrcn= $sth->fetchrow_array; 
    126120 if ($psptrcn[0]  == 1 ){#トラコン番組 
     
    227221my $newestmp4filename = `cd $pspdirname ; ls -t *.MP4 | head -1`; 
    228222 if ($newestmp4filename =~ /M4V$tid/){ 
    229         $nowcountno = $' ; 
     223               $nowcountno = $' ;#' 
    230224                $nowcountno++; 
    231225                $pspfilnameft = sprintf("%02d",$nowcountno); 
     
    261255#最適化 
    262256 
    263 $DBQuery =  "SELECT subtitle  FROM  foltia_subtitle WHERE tid = '$tid' AND countno = '$countno' "; 
    264          $sth = $dbh->prepare($DBQuery); 
    265         $sth->execute(); 
     257    $sth = $dbh->prepare($stmt{'singletranscode.5'}); 
     258    $sth->execute($tid, $countno); 
    266259 @programtitle = $sth->fetchrow_array; 
    267260 
     
    285278 
    286279if (-e "$pspdirname/M4V".$pspfilname.".THM"){ 
    287 $timestamp =`date "+%Y%m%d-%H%M%S"`
     280       $timestamp = strftime("%Y%m%d-%H%M%S", localtime)
    288281chomp $timestamp; 
    289282        system("convert -crop 160x120+1+3 -resize 165x126\! $pspdirname/00000002.jpg $pspdirname/M4V".$pspfilname.".THM.".$timestamp.".THM"); 
     
    297290system("rm -rf $pspdirname/0000000*.jpg "); 
    298291 
    299  
    300  
    301  
    302292# MP4ファイル名をPIDレコードに書き込み 
    303293unless ($pid eq ""){ 
    304         $DBQuery =  " 
    305         UPDATE  foltia_subtitle   
    306         SET PSPfilename = 'M4V$pspfilname.MP4'  
    307         WHERE pid =  '$pid' "; 
    308          $sth = $dbh->prepare($DBQuery); 
    309         $sth->execute(); 
    310 &writelog("singletranscode UPDATEsubtitleDB  $DBQuery"); 
     294        $sth = $dbh->prepare($stmt{'singletranscode.6'}); 
     295        $sth->execute("M4V$pspfilname.MP4", $pid); 
     296        &writelog("singletranscode UPDATEsubtitleDB $stmt{'singletranscode.6'}"); 
    311297}else{ 
    312298&writelog("singletranscode PID not found"); 
    313299} 
    314300# MP4ファイル名をfoltia_mp4files挿入 
    315         $DBQuery =  "insert into  foltia_mp4files values ('$tid','M4V$pspfilname.MP4') "; 
    316          $sth = $dbh->prepare($DBQuery); 
    317         $sth->execute(); 
    318 &writelog("singletranscode UPDATEmp4DB  $DBQuery"); 
     301    $sth = $dbh->prepare($stmt{'singletranscode.7'}); 
     302    $sth->execute($tid, "M4V$pspfilname.MP4"); 
     303    &writelog("singletranscode UPDATEmp4DB $stmt{'singletranscode.7'}"); 
    319304 
    320305}#PSPトラコンあり 
    321  
    322  
track feed