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; +}