| 1 |  | 
|---|
| 2 |  | 
|---|
| 3 |  | 
|---|
| 4 |  | 
|---|
| 5 |  | 
|---|
| 6 |  | 
|---|
| 7 |  | 
|---|
| 8 |  | 
|---|
| 9 |  | 
|---|
| 10 |  | 
|---|
| 11 |  | 
|---|
| 12 |  | 
|---|
| 13 |  | 
|---|
| 14 |  | 
|---|
| 15 |  | 
|---|
| 16 | use DBI; | 
|---|
| 17 | use DBD::Pg; | 
|---|
| 18 | use DBD::SQLite; | 
|---|
| 19 |  | 
|---|
| 20 | $path = $0; | 
|---|
| 21 | $path =~ s/updatem2pfiletable.pl$//i; | 
|---|
| 22 | if ($path ne "./"){ | 
|---|
| 23 | push( @INC, "$path"); | 
|---|
| 24 | } | 
|---|
| 25 |  | 
|---|
| 26 | require "foltialib.pl"; | 
|---|
| 27 | $dbh = DBI->connect($DSN,$DBUser,$DBPass) ||die $DBI::error;; | 
|---|
| 28 |  | 
|---|
| 29 | $dbh->{AutoCommit} = 0; | 
|---|
| 30 |  | 
|---|
| 31 | $sth = $dbh->prepare($stmt{'updatem2pfiletable.1'}); | 
|---|
| 32 | $sth->execute(); | 
|---|
| 33 | while ($file = glob("$recfolderpath/*.m2?")) { | 
|---|
| 34 | $file =~ s/$recfolderpath\///; | 
|---|
| 35 | $sth = $dbh->prepare($stmt{'updatem2pfiletable.2'}); | 
|---|
| 36 | $sth->execute($file); | 
|---|
| 37 |  | 
|---|
| 38 | } | 
|---|
| 39 | while ($file = glob("$recfolderpath/*.aac")) { | 
|---|
| 40 | $file =~ s/$recfolderpath\///; | 
|---|
| 41 | $sth = $dbh->prepare($stmt{'updatem2pfiletable.2'}); | 
|---|
| 42 | $sth->execute($file); | 
|---|
| 43 |  | 
|---|
| 44 | } | 
|---|
| 45 |  | 
|---|
| 46 | $oserr = $dbh->commit; | 
|---|
| 47 |  | 
|---|
| 48 |  | 
|---|
| 49 | @mp4filelist = `find ${recfolderpath}/ | grep MP4`; | 
|---|
| 50 |  | 
|---|
| 51 |  | 
|---|
| 52 | $sth = $dbh->prepare($stmt{'updatem2pfiletable.3'}); | 
|---|
| 53 | $sth->execute(); | 
|---|
| 54 |  | 
|---|
| 55 |  | 
|---|
| 56 | foreach (@mp4filelist) { | 
|---|
| 57 | chomp(); | 
|---|
| 58 | s/$recfolderpath\///; | 
|---|
| 59 | @fileline = split (/\//); | 
|---|
| 60 | $filetid = $fileline[0]; | 
|---|
| 61 | $filetid =~ s/[^0-9]//g; | 
|---|
| 62 | if (($filetid ne "" )&& ($fileline[2] ne "" )){ | 
|---|
| 63 | $sth = $dbh->prepare($stmt{'updatem2pfiletable.4'}); | 
|---|
| 64 | $oserr = $sth->execute($filetid, $fileline[2]); | 
|---|
| 65 |  | 
|---|
| 66 |  | 
|---|
| 67 | } | 
|---|
| 68 | } | 
|---|
| 69 | $oserr = $dbh->commit; | 
|---|
| 70 |  | 
|---|