1 |
|
---|
2 |
|
---|
3 |
|
---|
4 |
|
---|
5 |
|
---|
6 |
|
---|
7 |
|
---|
8 |
|
---|
9 |
|
---|
10 |
|
---|
11 |
|
---|
12 |
|
---|
13 |
use DBI; |
---|
14 |
use DBD::Pg; |
---|
15 |
use DBD::SQLite; |
---|
16 |
use Jcode; |
---|
17 |
|
---|
18 |
$path = $0; |
---|
19 |
$path =~ s/ipodtranscode.pl$//i; |
---|
20 |
if ($path ne "./"){ |
---|
21 |
push( @INC, "$path"); |
---|
22 |
} |
---|
23 |
require "foltialib.pl"; |
---|
24 |
|
---|
25 |
|
---|
26 |
|
---|
27 |
$processes = &processfind("ipodtranscode.pl"); |
---|
28 |
|
---|
29 |
|
---|
30 |
if ($processes > 1 ){ |
---|
31 |
&writelog("ipodtranscode processes exist. exit:"); |
---|
32 |
exit; |
---|
33 |
}else{ |
---|
34 |
|
---|
35 |
} |
---|
36 |
|
---|
37 |
|
---|
38 |
$dbh = DBI->connect($DSN,$DBUser,$DBPass) ||die $DBI::error;; |
---|
39 |
|
---|
40 |
|
---|
41 |
|
---|
42 |
|
---|
43 |
|
---|
44 |
|
---|
45 |
|
---|
46 |
|
---|
47 |
|
---|
48 |
&writelog("ipodtranscode starting up."); |
---|
49 |
|
---|
50 |
$counttranscodefiles = &counttranscodefiles(); |
---|
51 |
if ($counttranscodefiles == 0){ |
---|
52 |
&writelog("ipodtranscode No MPEG2 files to transcode."); |
---|
53 |
exit; |
---|
54 |
} |
---|
55 |
sleep 30; |
---|
56 |
|
---|
57 |
while ($counttranscodefiles >= 1){ |
---|
58 |
$sth = $dbh->prepare($stmt{'ipodtranscode.1'}); |
---|
59 |
$sth->execute($FILESTATUSRECEND, $FILESTATUSTRANSCODECOMPLETE, ); |
---|
60 |
@dbparam = $sth->fetchrow_array; |
---|
61 |
|
---|
62 |
|
---|
63 |
&writelog("ipodtranscode DEBUG $dbparam[0],$dbparam[1],$dbparam[2],$dbparam[3],$dbparam[4],$dbparam[5]"); |
---|
64 |
$pid = $dbparam[0]; |
---|
65 |
$tid = $dbparam[1]; |
---|
66 |
$inputmpeg2 = $recfolderpath."/".$dbparam[2]; |
---|
67 |
$mpeg2filename = $dbparam[2]; |
---|
68 |
$filestatus = $dbparam[3]; |
---|
69 |
$aspect = $dbparam[4]; |
---|
70 |
$countno = $dbparam[5]; |
---|
71 |
$mp4filenamestring = &mp4filenamestringbuild($pid); |
---|
72 |
|
---|
73 |
&writelog("ipodtranscode DEBUG mp4filenamestring $mp4filenamestring"); |
---|
74 |
|
---|
75 |
$pspdirname = &makemp4dir($tid); |
---|
76 |
$mp4outdir = $pspdirname ; |
---|
77 |
|
---|
78 |
|
---|
79 |
if ($pid ne ""){ |
---|
80 |
$sth = $dbh->prepare($stmt{'ipodtranscode.2'}); |
---|
81 |
$sth->execute($pid); |
---|
82 |
@programtitle = $sth->fetchrow_array; |
---|
83 |
$programtitle[0] =~ s/\"/\\"/gi; |
---|
84 |
$programtitle[2] =~ s/\"/\\"/gi; |
---|
85 |
|
---|
86 |
if ($pid > 0){ |
---|
87 |
if ($programtitle[1] ne ""){ |
---|
88 |
$movietitle = " -title \"$programtitle[0] 第$programtitle[1]話 $programtitle[2]\" "; |
---|
89 |
$movietitleeuc = " -t \"$programtitle[0] 第$programtitle[1]話 $programtitle[2]\" "; |
---|
90 |
}else{ |
---|
91 |
$movietitle = " -title \"$programtitle[0] $programtitle[2]\" "; |
---|
92 |
$movietitleeuc = " -t \"$programtitle[0] $programtitle[2]\" "; |
---|
93 |
} |
---|
94 |
}elsif($pid < 0){ |
---|
95 |
|
---|
96 |
$movietitle = " -title \"$programtitle[2]\" "; |
---|
97 |
$movietitleeuc = " -t \"$programtitle[2]\" "; |
---|
98 |
}else{ |
---|
99 |
|
---|
100 |
$movietitle = ""; |
---|
101 |
$movietitleeuc = ""; |
---|
102 |
} |
---|
103 |
|
---|
104 |
$movietitle = ""; |
---|
105 |
$movietitleeuc = ""; |
---|
106 |
|
---|
107 |
} |
---|
108 |
|
---|
109 |
if ($filestatus <= $FILESTATUSRECEND){ |
---|
110 |
} |
---|
111 |
|
---|
112 |
if ($filestatus <= $FILESTATUSWAITINGCAPTURE){ |
---|
113 |
|
---|
114 |
} |
---|
115 |
|
---|
116 |
if ($filestatus <= $FILESTATUSCAPTURE){ |
---|
117 |
|
---|
118 |
|
---|
119 |
if (-e "$toolpath/perl/captureimagemaker.pl"){ |
---|
120 |
&writelog("ipodtranscode Call captureimagemaker $mpeg2filename"); |
---|
121 |
&changefilestatus($pid,$FILESTATUSCAPTURE); |
---|
122 |
system ("$toolpath/perl/captureimagemaker.pl $mpeg2filename"); |
---|
123 |
&changefilestatus($pid,$FILESTATUSCAPEND); |
---|
124 |
} |
---|
125 |
} |
---|
126 |
|
---|
127 |
if ($filestatus <= $FILESTATUSCAPEND){ |
---|
128 |
|
---|
129 |
&makethumbnail(); |
---|
130 |
&changefilestatus($pid,$FILESTATUSTHMCREATE); |
---|
131 |
} |
---|
132 |
|
---|
133 |
if ($filestatus <= $FILESTATUSWAITINGTRANSCODE){ |
---|
134 |
} |
---|
135 |
|
---|
136 |
|
---|
137 |
$filenamebody = $inputmpeg2 ; |
---|
138 |
$filenamebody =~ s/.m2t$|.ts$|.m2p$|.mpg$//gi; |
---|
139 |
|
---|
140 |
|
---|
141 |
if ($inputmpeg2 =~ /m2t$|ts$/i){ |
---|
142 |
|
---|
143 |
|
---|
144 |
|
---|
145 |
if ($filestatus <= $FILESTATUSTRANSCODETSSPLITTING){ |
---|
146 |
unlink("${filenamebody}_tss.m2t"); |
---|
147 |
unlink("${filenamebody}_HD.m2t"); |
---|
148 |
} |
---|
149 |
if ($filestatus <= $FILESTATUSTRANSCODEFFMPEG){ |
---|
150 |
|
---|
151 |
|
---|
152 |
$trcnmpegfile = $inputmpeg2 ; |
---|
153 |
|
---|
154 |
if ($aspect == 1){ |
---|
155 |
$cropopt = " -croptop 150 -cropbottom 150 -cropleft 200 -cropright 200 "; |
---|
156 |
}elsif($aspect == 4){ |
---|
157 |
$cropopt = " -croptop 6 -cropbottom 6 -cropleft 8 -cropright 8 "; |
---|
158 |
}else{ |
---|
159 |
$cropopt = " -croptop 6 -cropbottom 6 -cropleft 8 -cropright 8 "; |
---|
160 |
} |
---|
161 |
|
---|
162 |
if (($trconqty eq "")||($trconqty == 1)){ |
---|
163 |
$ffmpegencopt = " -s 360x202 -deinterlace -r 24.00 -vcodec libx264 -g 300 -b 330000 -level 13 -loop 1 -sc_threshold 60 -partp4x4 1 -rc_eq 'blurCplx^(1-qComp)' -refs 3 -maxrate 700000 -async 50 -f h264 $filenamebody.264"; |
---|
164 |
}elsif($trconqty == 2){ |
---|
165 |
|
---|
166 |
|
---|
167 |
$ffmpegencopt = " -s 480x272 -deinterlace -r 29.97 -vcodec libx264 -vpre default -g 300 -b 400000 -level 13 -sc_threshold 60 -rc_eq 'blurCplx^(1-qComp)' -refs 3 -maxrate 700000 -async 50 -f h264 $filenamebody.264"; |
---|
168 |
}elsif($trconqty == 3){ |
---|
169 |
|
---|
170 |
|
---|
171 |
$ffmpegencopt = " -s 640x352 -deinterlace -r 29.97 -vcodec libx264 -vpre default -g 100 -b 600000 -level 13 -sc_threshold 60 -rc_eq 'blurCplx^(1-qComp)' -refs 3 -maxrate 700000 -async 50 -f h264 $filenamebody.264"; |
---|
172 |
} |
---|
173 |
&changefilestatus($pid,$FILESTATUSTRANSCODEFFMPEG); |
---|
174 |
&writelog("ipodtranscode ffmpeg $filenamebody.264"); |
---|
175 |
system ("ffmpeg -y -i $trcnmpegfile $cropopt $ffmpegencopt"); |
---|
176 |
|
---|
177 |
|
---|
178 |
if (! -e "$filenamebody.264"){ |
---|
179 |
&changefilestatus($pid,$FILESTATUSTRANSCODETSSPLITTING); |
---|
180 |
unlink("${filenamebody}_tss.m2t"); |
---|
181 |
unlink("${filenamebody}_HD.m2t"); |
---|
182 |
if (-e "$toolpath/perl/tool/tss.py"){ |
---|
183 |
&writelog("ipodtranscode tss $inputmpeg2"); |
---|
184 |
system("$toolpath/perl/tool/tss.py $inputmpeg2"); |
---|
185 |
|
---|
186 |
}else{ |
---|
187 |
|
---|
188 |
&writelog("ipodtranscode TsSplitter $inputmpeg2"); |
---|
189 |
system("wine $toolpath/perl/tool/TsSplitter.exe -EIT -ECM -EMM -SD -1SEG -WAIT2 $inputmpeg2"); |
---|
190 |
} |
---|
191 |
if(-e "${filenamebody}_tss.m2t"){ |
---|
192 |
$trcnmpegfile = "${filenamebody}_tss.m2t"; |
---|
193 |
}elsif (-e "${filenamebody}_HD.m2t"){ |
---|
194 |
$trcnmpegfile = "${filenamebody}_HD.m2t"; |
---|
195 |
}else{ |
---|
196 |
&writelog("ipodtranscode ERR NOT Exist ${filenamebody}_HD.m2t"); |
---|
197 |
$trcnmpegfile = inputmpeg2 ; |
---|
198 |
} |
---|
199 |
|
---|
200 |
&changefilestatus($pid,$FILESTATUSTRANSCODEFFMPEG); |
---|
201 |
&writelog("ipodtranscode ffmpeg retry $filenamebody.264"); |
---|
202 |
system ("ffmpeg -y -i $trcnmpegfile $cropopt $ffmpegencopt"); |
---|
203 |
} |
---|
204 |
|
---|
205 |
if (! -e "$filenamebody.264"){ |
---|
206 |
|
---|
207 |
&changefilestatus($pid,$FILESTATUSTRANSCODEFFMPEG); |
---|
208 |
&writelog("ipodtranscode ffmpeg retry no crop $filenamebody.264"); |
---|
209 |
system ("ffmpeg -y -i $trcnmpegfile $ffmpegencopt"); |
---|
210 |
} |
---|
211 |
} |
---|
212 |
if ($filestatus <= $FILESTATUSTRANSCODEWAVE){ |
---|
213 |
|
---|
214 |
unlink("${filenamebody}.wav"); |
---|
215 |
&changefilestatus($pid,$FILESTATUSTRANSCODEWAVE); |
---|
216 |
&writelog("ipodtranscode mplayer $filenamebody.wav"); |
---|
217 |
system ("mplayer $trcnmpegfile -vc null -vo null -ao pcm:file=$filenamebody.wav:fast"); |
---|
218 |
|
---|
219 |
} |
---|
220 |
if ($filestatus <= $FILESTATUSTRANSCODEAAC){ |
---|
221 |
|
---|
222 |
unlink("${filenamebody}.aac"); |
---|
223 |
&changefilestatus($pid,$FILESTATUSTRANSCODEAAC); |
---|
224 |
if (-e "$toolpath/perl/tool/neroAacEnc"){ |
---|
225 |
if (-e "$filenamebody.wav"){ |
---|
226 |
&writelog("ipodtranscode neroAacEnc $filenamebody.wav"); |
---|
227 |
system ("$toolpath/perl/tool/neroAacEnc -br 128000 -if $filenamebody.wav -of $filenamebody.aac"); |
---|
228 |
}else{ |
---|
229 |
&writelog("ipodtranscode ERR Not Found $filenamebody.wav"); |
---|
230 |
} |
---|
231 |
}else{ |
---|
232 |
|
---|
233 |
&writelog("ipodtranscode faac $filenamebody.wav"); |
---|
234 |
system ("faac -b 128 -o $filenamebody.aac $filenamebody.wav "); |
---|
235 |
} |
---|
236 |
|
---|
237 |
} |
---|
238 |
if ($filestatus <= $FILESTATUSTRANSCODEMP4BOX){ |
---|
239 |
|
---|
240 |
unlink("${filenamebody}.base.mp4"); |
---|
241 |
if (-e "$toolpath/perl/tool/MP4Box"){ |
---|
242 |
&changefilestatus($pid,$FILESTATUSTRANSCODEMP4BOX); |
---|
243 |
&writelog("ipodtranscode MP4Box $filenamebody"); |
---|
244 |
|
---|
245 |
system ("cd $recfolderpath ;$toolpath/perl/tool/MP4Box -fps 29.97 -add $filenamebody.264 -new $filenamebody.base.mp4"); |
---|
246 |
$exit_value = $? >> 8; |
---|
247 |
$signal_num = $? & 127; |
---|
248 |
$dumped_core = $? & 128; |
---|
249 |
&writelog("ipodtranscode DEBUG MP4Box -fps 29.97 -add $filenamebody.264 -new $filenamebody.base.mp4:$exit_value:$signal_num:$dumped_core"); |
---|
250 |
|
---|
251 |
|
---|
252 |
if (-e "$filenamebody.base.mp4"){ |
---|
253 |
|
---|
254 |
system ("cd $recfolderpath ;$toolpath/perl/tool/MP4Box -add $filenamebody.aac $filenamebody.base.mp4"); |
---|
255 |
$exit_value = $? >> 8; |
---|
256 |
$signal_num = $? & 127; |
---|
257 |
$dumped_core = $? & 128; |
---|
258 |
&writelog("ipodtranscode DEBUG MP4Box -add $filenamebody.aac:$exit_value:$signal_num:$dumped_core"); |
---|
259 |
}else{ |
---|
260 |
$filelist = `ls -lhtr $recfolderpath/${filenamebody}*`; |
---|
261 |
$debugenv = `env`; |
---|
262 |
&writelog("ipodtranscode ERR File not exist.$debugenv.$filelist ;$filenamebody.base.mp4;$filelist;cd $recfolderpath ;$toolpath/perl/tool/MP4Box -fps 29.97 -add $filenamebody.264 -new $filenamebody.base.mp4"); |
---|
263 |
} |
---|
264 |
}else{ |
---|
265 |
&writelog("ipodtranscode WARN; Pls. install $toolpath/perl/tool/MP4Box"); |
---|
266 |
} |
---|
267 |
|
---|
268 |
|
---|
269 |
|
---|
270 |
if (-e "$toolpath/perl/tool/MP4Box"){ |
---|
271 |
|
---|
272 |
|
---|
273 |
&writelog("ipodtranscode ATOM $filenamebody"); |
---|
274 |
|
---|
275 |
|
---|
276 |
system ("cd $recfolderpath ; $toolpath/perl/tool/MP4Box -ipod $filenamebody.base.mp4"); |
---|
277 |
$exit_value = $? >> 8; |
---|
278 |
$signal_num = $? & 127; |
---|
279 |
$dumped_core = $? & 128; |
---|
280 |
&writelog("ipodtranscode DEBUG MP4Box -ipod $filenamebody.base.mp4:$exit_value:$signal_num:$dumped_core"); |
---|
281 |
if (-e "$filenamebody.base.mp4"){ |
---|
282 |
unlink("${mp4outdir}MAQ${mp4filenamestring}.MP4"); |
---|
283 |
system("mv $filenamebody.base.mp4 ${mp4outdir}MAQ${mp4filenamestring}.MP4"); |
---|
284 |
&writelog("ipodtranscode mv $filenamebody.base.mp4 ${mp4outdir}MAQ${mp4filenamestring}.MP4"); |
---|
285 |
}else{ |
---|
286 |
&writelog("ipodtranscode ERR $filenamebody.base.mp4 Not found."); |
---|
287 |
} |
---|
288 |
|
---|
289 |
}else{ |
---|
290 |
&writelog("ipodtranscode WARN; Pls. install $toolpath/perl/tool/MP4Box"); |
---|
291 |
} |
---|
292 |
} |
---|
293 |
if ($filestatus <= $FILESTATUSTRANSCODECOMPLETE){ |
---|
294 |
if (-e "${mp4outdir}MAQ${mp4filenamestring}.MP4"){ |
---|
295 |
|
---|
296 |
&changefilestatus($pid,$FILESTATUSTRANSCODECOMPLETE); |
---|
297 |
unlink("${filenamebody}_HD.m2t"); |
---|
298 |
unlink("${filenamebody}_tss.m2t"); |
---|
299 |
unlink("$filenamebody.264"); |
---|
300 |
unlink("$filenamebody.wav"); |
---|
301 |
unlink("$filenamebody.aac"); |
---|
302 |
unlink("$filenamebody.base.mp4"); |
---|
303 |
|
---|
304 |
&updatemp4file(); |
---|
305 |
}else{ |
---|
306 |
&writelog("ipodtranscode ERR ; Fail MAQ${mp4filenamestring}.MP4"); |
---|
307 |
} |
---|
308 |
} |
---|
309 |
|
---|
310 |
}else{ |
---|
311 |
|
---|
312 |
|
---|
313 |
if ($aspect == 16){ |
---|
314 |
$cropopt = " -croptop 70 -cropbottom 60 -cropleft 8 -cropright 14 -aspect 16:9 "; |
---|
315 |
}else{ |
---|
316 |
$cropopt = " -croptop 8 -cropbottom 8 -cropleft 8 -cropright 14 "; |
---|
317 |
} |
---|
318 |
|
---|
319 |
if (($trconqty eq "")||($trconqty == 1)){ |
---|
320 |
|
---|
321 |
$mp4file = "${mp4outdir}M4V${mp4filenamestring}.MP4"; |
---|
322 |
$encodeoption = "-y -i $inputmpeg2 vcodec libxvid $cropopt -s 320x240 -b 300 -bt 128 -r 14.985 -deinterlace -acodec libfaac -f ipod ${mp4outdir}M4V${mp4filenamestring}.MP4"; |
---|
323 |
|
---|
324 |
|
---|
325 |
|
---|
326 |
}elsif($trconqty == 2){ |
---|
327 |
|
---|
328 |
$mp4file = "${mp4outdir}MAQ${mp4filenamestring}.MP4"; |
---|
329 |
$encodeoption = "-y -i $inputmpeg2 -vcodec libx264 -croptop 8 $cropopt -s 320x240 -b 300 -bt 128 -r 24 -deinterlace -acodec libfaac -f ipod ${mp4outdir}MAQ${mp4filenamestring}.MP4"; |
---|
330 |
|
---|
331 |
|
---|
332 |
|
---|
333 |
}elsif($trconqty == 3){ |
---|
334 |
|
---|
335 |
$mp4file = "${mp4outdir}MAQ${mp4filenamestring}.MP4"; |
---|
336 |
$encodeoption = "-y -i $inputmpeg2 -vcodec libx264 $cropopt -s 320x240 -b 380 -bt 128 -r 29.97 -deinterlace -acodec libfaac -f ipod ${mp4outdir}MAQ${mp4filenamestring}.MP4"; |
---|
337 |
|
---|
338 |
|
---|
339 |
|
---|
340 |
}elsif($trconqty == 4){ |
---|
341 |
|
---|
342 |
$mp4file = "${mp4outdir}MAQ${mp4filenamestring}.MP4"; |
---|
343 |
$encodeoption = "-y -i $inputmpeg2 -vcodec libx264 $cropopt -s 640x480 -b 500 -maxrate 700 -bt 128 -r 29.97 -deinterlace -acodec libfaac -f ipod ${mp4outdir}MAQ${mp4filenamestring}.MP4"; |
---|
344 |
|
---|
345 |
|
---|
346 |
|
---|
347 |
}elsif($trconqty == 5){ |
---|
348 |
|
---|
349 |
$mp4file = "${mp4outdir}MAQ${mp4filenamestring}.MP4"; |
---|
350 |
$encodeoption = "-y -i $inputmpeg2 -vcodec libx264 -croptop 8 $cropopt -s 640x480 -b 500 -maxrate 700 -bt 128 -r 29.97 -deinterlace -flags loop -trellis 2 -partitions parti4x4+parti8x8+partp4x4+partp8x8+partb8x8 -acodec libfaac -f ipod ${mp4outdir}MAQ${mp4filenamestring}.MP4"; |
---|
351 |
|
---|
352 |
|
---|
353 |
|
---|
354 |
} |
---|
355 |
|
---|
356 |
$encodeoptionlog = $encodeoption; |
---|
357 |
Jcode::convert(\$encodeoptionlog,'euc'); |
---|
358 |
|
---|
359 |
&writelog("ipodtranscode START QTY=$trconqty $encodeoptionlog"); |
---|
360 |
|
---|
361 |
&changefilestatus($pid,$FILESTATUSTRANSCODEFFMPEG); |
---|
362 |
system ("ffmpeg $encodeoption "); |
---|
363 |
&writelog("ipodtranscode FFEND $inputmpeg2"); |
---|
364 |
&changefilestatus($pid,$FILESTATUSTRANSCODECOMPLETE); |
---|
365 |
|
---|
366 |
|
---|
367 |
|
---|
368 |
|
---|
369 |
|
---|
370 |
&updatemp4file(); |
---|
371 |
} |
---|
372 |
|
---|
373 |
$counttranscodefiles = &counttranscodefiles(); |
---|
374 |
|
---|
375 |
|
---|
376 |
|
---|
377 |
} |
---|
378 |
|
---|
379 |
&writelog("ipodtranscode ALL COMPLETE"); |
---|
380 |
exit; |
---|
381 |
|
---|
382 |
|
---|
383 |
sub mp4filenamestringbuild(){ |
---|
384 |
|
---|
385 |
|
---|
386 |
my @mpegfilename = split(/\./,$dbparam[2]) ; |
---|
387 |
my $pspfilname = "-".$mpegfilename[0] ; |
---|
388 |
return("$pspfilname"); |
---|
389 |
} |
---|
390 |
|
---|
391 |
|
---|
392 |
sub makethumbnail(){ |
---|
393 |
|
---|
394 |
my $outputfilename = $inputmpeg2 ; |
---|
395 |
my $thmfilename = "MAQ${mp4filenamestring}.THM"; |
---|
396 |
&writelog("ipodtranscode DEBUG thmfilename $thmfilename"); |
---|
397 |
|
---|
398 |
|
---|
399 |
|
---|
400 |
|
---|
401 |
if($outputfilename =~ /.m2t$/){ |
---|
402 |
|
---|
403 |
system ("mplayer -ss 00:01:20 -vo jpeg:outdir=$pspdirname -ao null -vf framestep=300step,scale=160:90,expand=160:120 -frames 1 $outputfilename"); |
---|
404 |
&writelog("ipodtranscode DEBUG mplayer -ss 00:01:20 -vo jpeg:outdir=$pspdirname -ao null -vf framestep=300step,scale=160:90,expand=160:120 -frames 1 $outputfilename"); |
---|
405 |
}else{ |
---|
406 |
|
---|
407 |
system ("mplayer -ss 00:01:20 -vo jpeg:outdir=$pspdirname -ao null -vf framestep=300step,scale=165:126,crop=160:120 -frames 1 $outputfilename"); |
---|
408 |
&writelog("ipodtranscode DEBUG mplayer -ss 00:01:20 -vo jpeg:outdir=$pspdirname -ao null -vf framestep=300step,scale=165:126,crop=160:120 -frames 1 $outputfilename"); |
---|
409 |
} |
---|
410 |
|
---|
411 |
|
---|
412 |
|
---|
413 |
|
---|
414 |
|
---|
415 |
|
---|
416 |
|
---|
417 |
|
---|
418 |
|
---|
419 |
|
---|
420 |
|
---|
421 |
system("mv $pspdirname/00000001.jpg $pspdirname/$thmfilename"); |
---|
422 |
|
---|
423 |
} |
---|
424 |
|
---|
425 |
sub updatemp4file(){ |
---|
426 |
my $mp4filename = "MAQ${mp4filenamestring}.MP4"; |
---|
427 |
|
---|
428 |
if (-e "${mp4outdir}MAQ${mp4filenamestring}.MP4"){ |
---|
429 |
|
---|
430 |
$sth = $dbh->prepare($stmt{'ipodtranscode.updatemp4file.1'}); |
---|
431 |
$sth->execute($mp4filename, $pid); |
---|
432 |
&writelog("ipodtranscode UPDATEsubtitleDB $stmt{'ipodtranscode.updatemp4file.1'}"); |
---|
433 |
|
---|
434 |
|
---|
435 |
$sth = $dbh->prepare($stmt{'ipodtranscode.updatemp4file.2'}); |
---|
436 |
$sth->execute($tid, $mp4filename); |
---|
437 |
&writelog("ipodtranscode UPDATEmp4DB $stmt{'ipodtranscode.updatemp4file.2'}"); |
---|
438 |
|
---|
439 |
&changefilestatus($pid,$FILESTATUSALLCOMPLETE); |
---|
440 |
}else{ |
---|
441 |
&writelog("ipodtranscode ERR MP4 NOT EXIST $pid/$mp4filename"); |
---|
442 |
} |
---|
443 |
|
---|
444 |
|
---|
445 |
} |
---|
446 |
|
---|
447 |
sub counttranscodefiles(){ |
---|
448 |
$sth = $dbh->prepare($stmt{'ipodtranscode.counttranscodefiles.1'}); |
---|
449 |
$sth->execute($FILESTATUSRECEND, $FILESTATUSTRANSCODECOMPLETE); |
---|
450 |
my @titlecount= $sth->fetchrow_array; |
---|
451 |
|
---|
452 |
return ($titlecount[0]); |
---|
453 |
|
---|
454 |
|
---|
455 |
} |
---|