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