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/deletemovie.pl$//i; |
---|
22 |
if ($path ne "./"){ |
---|
23 |
push( @INC, "$path"); |
---|
24 |
} |
---|
25 |
|
---|
26 |
require "foltialib.pl"; |
---|
27 |
|
---|
28 |
|
---|
29 |
$fname = $ARGV[0] ; |
---|
30 |
if ($fname eq "" ){ |
---|
31 |
|
---|
32 |
print "usage;deletemovie.pl <FILENAME>\n"; |
---|
33 |
exit; |
---|
34 |
} |
---|
35 |
|
---|
36 |
|
---|
37 |
if ($fname =~ /.m2p$|.m2t$|.MP4$|.aac$/){ |
---|
38 |
|
---|
39 |
}else{ |
---|
40 |
|
---|
41 |
&writelog("deletemovie invalid filetype:$fname."); |
---|
42 |
exit (1); |
---|
43 |
} |
---|
44 |
|
---|
45 |
|
---|
46 |
$dbh = DBI->connect($DSN,$DBUser,$DBPass) ||die $DBI::error;; |
---|
47 |
|
---|
48 |
|
---|
49 |
my $tid = &mp4filename2tid($fname); |
---|
50 |
my $mp4dirname = &makemp4dir($tid); |
---|
51 |
if (-e "$recfolderpath/$fname"){ |
---|
52 |
$filemovepath = $recfolderpath; |
---|
53 |
}elsif(-e "$mp4dirname/$fname"){ |
---|
54 |
$filemovepath = $mp4dirname; |
---|
55 |
}else{ |
---|
56 |
|
---|
57 |
&writelog("deletemovie file not found:$fname."); |
---|
58 |
exit (1); |
---|
59 |
} |
---|
60 |
|
---|
61 |
|
---|
62 |
if ($rapidfiledelete > 0){ |
---|
63 |
system ("mv $filemovepath/$fname $recfolderpath/mita/"); |
---|
64 |
&writelog("deletemovie mv filemovepath/$fname $recfolderpath/mita/."); |
---|
65 |
}else{ |
---|
66 |
system ("rm $filemovepath/$fname "); |
---|
67 |
&writelog("deletemovie rm $filemovepath/$fname "); |
---|
68 |
|
---|
69 |
|
---|
70 |
} |
---|
71 |
|
---|
72 |
|
---|
73 |
|
---|