チェンジセット 94: trunk/install/perl/singletranscode.pl
- コミット日時:
- 2010/02/28 22:28:26 (15 年前)
- ファイル:
凡例:
- 変更無し
- 追加
- 削除
- 更新
- コピー
- 移動
trunk/install/perl/singletranscode.pl
r1 r94 28 28 use DBI; 29 29 use DBD::Pg; 30 use DBD::SQLite; 30 31 use Schedule::At; 31 32 use Time::Local; … … 34 35 $path = $0; 35 36 $path =~ s/singletranscode.pl$//i; 36 if ($p wdne "./"){37 if ($path ne "./"){ 37 38 push( @INC, "$path"); 38 39 } … … 63 64 64 65 #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;; 69 67 70 68 if ($ARGV[1] != ""){ 71 69 $pid = $ARGV[1] ; 72 70 }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]); 76 73 @pidarray = $sth->fetchrow_array; 77 74 unless ($pidarray[0] == "" ){ … … 86 83 # 追加部分 87 84 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); 91 87 @subticount= $sth->fetchrow_array; 92 88 unless ($subticount[0] >= 1){ 93 89 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); 97 92 @subticount= $sth->fetchrow_array; 98 93 … … 120 115 # PSP ------------------------------------------------------ 121 116 #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); 125 119 @psptrcn= $sth->fetchrow_array; 126 120 if ($psptrcn[0] == 1 ){#トラコン番組 … … 227 221 my $newestmp4filename = `cd $pspdirname ; ls -t *.MP4 | head -1`; 228 222 if ($newestmp4filename =~ /M4V$tid/){ 229 $nowcountno = $' ;223 $nowcountno = $' ;#' 230 224 $nowcountno++; 231 225 $pspfilnameft = sprintf("%02d",$nowcountno); … … 261 255 #最適化 262 256 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); 266 259 @programtitle = $sth->fetchrow_array; 267 260 … … 285 278 286 279 if (-e "$pspdirname/M4V".$pspfilname.".THM"){ 287 $timestamp =`date "+%Y%m%d-%H%M%S"`;280 $timestamp = strftime("%Y%m%d-%H%M%S", localtime); 288 281 chomp $timestamp; 289 282 system("convert -crop 160x120+1+3 -resize 165x126\! $pspdirname/00000002.jpg $pspdirname/M4V".$pspfilname.".THM.".$timestamp.".THM"); … … 297 290 system("rm -rf $pspdirname/0000000*.jpg "); 298 291 299 300 301 302 292 # MP4ファイル名をPIDレコードに書き込み 303 293 unless ($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'}"); 311 297 }else{ 312 298 &writelog("singletranscode PID not found"); 313 299 } 314 300 # 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'}"); 319 304 320 305 }#PSPトラコンあり 321 322