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 |
|
---|
34 |
while ($file = glob("$recfolderpath/*.m2?")) { |
---|
35 |
$file =~ s/$recfolderpath\///; |
---|
36 |
$sth = $dbh->prepare($stmt{'updatem2pfiletable.2'}); |
---|
37 |
$sth->execute($file); |
---|
38 |
|
---|
39 |
} |
---|
40 |
$oserr = $dbh->commit; |
---|
41 |
|
---|
42 |
|
---|
43 |
@mp4filelist = `find ${recfolderpath}/ | grep MP4`; |
---|
44 |
|
---|
45 |
|
---|
46 |
$sth = $dbh->prepare($stmt{'updatem2pfiletable.3'}); |
---|
47 |
$sth->execute(); |
---|
48 |
|
---|
49 |
|
---|
50 |
foreach (@mp4filelist) { |
---|
51 |
chomp(); |
---|
52 |
s/$recfolderpath\///; |
---|
53 |
@fileline = split (/\//); |
---|
54 |
$filetid = $fileline[0]; |
---|
55 |
$filetid =~ s/[^0-9]//g; |
---|
56 |
if (($filetid ne "" )&& ($fileline[2] ne "" )){ |
---|
57 |
$sth = $dbh->prepare($stmt{'updatem2pfiletable.4'}); |
---|
58 |
$oserr = $sth->execute($filetid, $fileline[2]); |
---|
59 |
|
---|
60 |
|
---|
61 |
} |
---|
62 |
} |
---|
63 |
$oserr = $dbh->commit; |
---|
64 |
|
---|