root/trunk/install/perl/captureimagemaker.pl

リビジョン 94, 4.2 kB (コミッタ: sorshi, コミット時期: 15 年 前)

SQLite採用

  • svn:executable 属性の設定値:
Line 
1 #!/usr/bin/perl
2 #usage captureimagemaker.pl  MPEG2filename
3 #
4 # Anime recording system foltia
5 # http://www.dcc-jpl.com/soft/foltia/
6 #
7 #
8 # キャプチャ画像作成モジュール
9 # recwrap.plから呼び出される。
10 #
11 # DCC-JPL Japan/foltia project
12 #
13
14 $path = $0;
15 $path =~ s/captureimagemaker.pl$//i;
16 if ($path ne "./"){
17 push( @INC, "$path");
18 }
19
20 require "foltialib.pl";
21
22 #$tid = $ARGV[0] ;
23 $filename = $ARGV[0] ;
24
25 # filenameの妥当性をチェック
26 @filenametmp = split(/\./,$filename);
27 @filename = split(/-/,$filenametmp[0]);
28 $tid = $filename[0];
29
30 # tidが数字のみかチェック
31 $tid =~ s/[^0-9]//ig;
32 #print "$tid\n";
33
34 if ($tid eq "" ){
35         #引き数なし出実行されたら、終了
36         print "usage captureimagemaker.pl  MPEG2filename\n";
37         exit;
38 }
39
40 if ($tid >= 0){
41 #       print "TID is valid\n";
42 }else{
43         &writelog("captureimagemaker TID invalid");
44         exit;
45 }
46
47
48 $countno = $filename[1];
49 $countno =~ s/[^0-9]//ig;
50 #if ($countno eq "" ){
51 #$countno = "x";
52 #}
53 #       print "CNTNO:$countno\n";
54
55 $date = $filename[2];
56 $date =~ s/[^0-9]//ig;
57 if ($date eq "" ){
58     $date = strftime("%Y%m%d", localtime);
59 }
60 #       print "DATE:$date\n";
61
62
63 $time = $filename[3];
64 $time = substr($time, 0, 4);
65 $time =~ s/[^0-9]//ig;
66 if ($time eq "" ){
67     $time =  strftime("%H%M", localtime);
68 }
69 #       print "TIME:$time\n";
70
71 # 録画ファイルがアルかチェック
72 if (-e "$recfolderpath/$filename"){
73 #       print "EXIST $recfolderpath/$filename\n";
74 }else{
75 #       print "NO $recfolderpath/$filename\n";
76         &writelog("captureimagemaker notexist $recfolderpath/$filename");
77
78         exit;
79 }
80
81 # 展開先ディレクトリがあるか確認
82
83 $capimgdirname = "$tid.localized/";
84 $capimgdirname = $recfolderpath."/".$capimgdirname;
85 #なければ作る
86 unless (-e $capimgdirname ){
87         system("$toolpath/perl/mklocalizeddir.pl $tid");
88         &writelog("captureimagemaker mkdir $capimgdirname");
89 }
90 $capimgdirname = "$tid.localized/img";
91 $capimgdirname = $recfolderpath."/".$capimgdirname;
92 #なければ作る
93 unless (-e $capimgdirname ){
94         mkdir $capimgdirname ,0777;
95         &writelog("captureimagemaker mkdir $capimgdirname");
96 }
97
98
99 # キャプチャ入れるディレクトリ作成
100 # $captureimgdir = "$tid"."-"."$countno"."-"."$date"."-"."$time";
101 $captureimgdir = $filename;
102 $captureimgdir =~ s/\.m2p$|\.m2t$//;
103
104 unless (-e "$capimgdirname/$captureimgdir"){
105         mkdir "$capimgdirname/$captureimgdir" ,0777;
106         &writelog("captureimagemaker mkdir $capimgdirname/$captureimgdir");
107
108 }
109
110 # 変換
111 #system ("mplayer -ss 00:00:10 -vo jpeg:outdir=$capimgdirname/$captureimgdir/ -vf crop=702:468:6:6,scale=160:120,pp=lb -ao null -sstep 14 -v 3 $recfolderpath/$filename");
112
113 #system ("mplayer -ss 00:00:10 -vo jpeg:outdir=$capimgdirname/$captureimgdir/ -vf crop=702:468:6:6,scale=160:120 -ao null -sstep 14 -v 3 $recfolderpath/$filename");
114
115
116 # ETVとか黒線入るから左右、もうすこしづつ切ろう。
117 #system ("mplayer -ss 00:00:10 -vo jpeg:outdir=$capimgdirname/$captureimgdir/ -vf crop=690:460:12:10,scale=160:120 -ao null -sstep 14 -v 3 $recfolderpath/$filename");
118
119 # 10秒ごとに
120 if ($filename =~ /m2t$/){
121         &writelog("captureimagemaker DEBUG mplayer -ss 00:00:10 -vo jpeg:outdir=$capimgdirname/$captureimgdir/ -vf scale=192:108 -ao null -sstep 9  $recfolderpath/$filename");
122         system ("mplayer -ss 00:00:10 -vo jpeg:outdir=$capimgdirname/$captureimgdir/ -vf scale=192:108 -ao null -sstep 9  $recfolderpath/$filename");
123         if(-e "$capimgdirname/$captureimgdir/00000001.jpg" ){ #$capimgdirname/$captureimgdir/があったらなにもしない       
124         }else{ #空っぽなら再試行
125                         &writelog("captureimagemaker DEBUG RETRY mplayer -ss 00:00:10 -vo jpeg:outdir=$capimgdirname/$captureimgdir/ -vf framestep=300step,scale=192:108 -ao null $recfolderpath/$filename");
126                 system ("mplayer -ss 00:00:10 -vo jpeg:outdir=$capimgdirname/$captureimgdir/ -vf framestep=300step,scale=192:108 -ao null $recfolderpath/$filename");
127         }
128        
129 }else{
130         &writelog("captureimagemaker DEBUG mplayer -ss 00:00:10 -vo jpeg:outdir=$capimgdirname/$captureimgdir/ -vf crop=690:460:12:10,scale=160:120 -ao null -sstep 9 -v 3 $recfolderpath/$filename");
131         system ("mplayer -ss 00:00:10 -vo jpeg:outdir=$capimgdirname/$captureimgdir/ -vf crop=690:460:12:10,scale=160:120 -ao null -sstep 9 $recfolderpath/$filename");
132         if(-e "$capimgdirname/$captureimgdir/00000001.jpg" ){ #$capimgdirname/
133         }else{
134         system ("mplayer -ss 00:00:10 -vo jpeg:outdir=$capimgdirname/$captureimgdir/ -vf framestep=300step,crop=690:460:12:10,scale=160:120 -ao null $recfolderpath/$filename");
135         }
136 }
137
Note: リポジトリブラウザについてのヘルプは TracBrowser を参照してください。
track feed