root/trunk/install/perl/changestbch.pl

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

SQLite採用

  • svn:executable 属性の設定値:
Line 
1 #!/usr/bin/perl
2 #
3 # Anime recording system foltia
4 # http://www.dcc-jpl.com/soft/foltia/
5 #
6 #changestbch.pl
7 #
8 # リモコンユニットを操作して外部チューナの信号を切り替える。
9 #対応ユニット
10 # Tira-2.1: Remote Control Receiver/Transmitter
11 #http://www.home-electro.com/tira2.php
12 #
13 #usage :changestbch.pl  [PID]
14 #引数
15 #[PID]番組プログラムID
16 #
17 # チャンネル切り替えの流れ
18 # changestbch.pl :局から送出信号を調べて transfer.pl にチャンネル変更引き数を渡す。
19 # ↓
20 # transfer.pl 指定ファイルを送出 <http://www.geocities.jp/coffee_style/Tira-2-0.html>
21 #
22 #
23 # DCC-JPL Japan/foltia project
24 #
25
26 use DBI;
27 use DBD::Pg;
28 use DBD::SQLite;
29
30 $path = $0;
31 $path =~ s/changestbch.pl$//i;
32 if ($path ne "./"){
33 push( @INC, "$path");
34 }
35 require 'foltialib.pl';
36
37
38 #       &writelog("changestbch DEBUG START");
39
40
41 #引き数がアルか?
42 $pid = $ARGV[0] ;
43 if ($pid eq "" ){
44         #引き数なし出実行されたら、終了
45         print "usage :changestbch.pl  [PID]\n";
46         &writelog("changestbch ERR PID null");
47         exit;
48 }
49
50 # $haveirdaunit = 1;リモコンつないでるかどうか
51 if ($haveirdaunit == 1){
52 #デバイス見えるかどうか
53 if (-e "/dev/ttyUSB0"){
54
55 # pidから局(送出コマンド)調べる
56 #DB初期化
57         $dbh = DBI->connect($DSN,$DBUser,$DBPass) ||die $DBI::error;;
58
59         $sth = $dbh->prepare($stmt{'changestbch.1'});
60         $sth->execute($pid);
61  @chstatus = $sth->fetchrow_array;
62         $tunertype = $chstatus[0];
63         $tunercmd =  $chstatus[1];
64         $recch =  $chstatus[2];
65         $stationid =  $chstatus[3];     
66 $cmdjoined = "$tunertype"."$tunercmd";
67
68 &writelog("changestbch DEBUG  $cmdjoined :$recch:$stationid");
69
70 $length = length($cmdjoined);
71 $sendcmdfile = "";
72 for ($i=0 ; $i < $length ; $i++ ){
73         $cmdtxt = substr($cmdjoined,$i,1);
74 #       print "$cmdtxt\n";
75         $sendcmdfile .= " $toolpath/perl/irda/$cmdtxt".".dat ";
76 }#for
77
78 #if (-e "$toolpath/perl/irda/$sendcmdfile"){
79         system("$toolpath/perl/irda/transfer.pl $sendcmdfile");
80 &writelog("changestbch DEBUG  $toolpath/perl/irda/transfer.pl $toolpath/perl/irda/$sendcmdfile");
81 #}else{
82 #       &writelog("changestbch ERR cmd file not found:$toolpath/perl/irda/$sendcmdfile");
83 #}#if -e
84
85
86
87 #BS-hi b x103 || b 3
88 #キッズステーション c x264 || c 2
89
90 #コマンドから実行するコマンド組み立て
91 }else{
92 #デバイス見えない
93                 &writelog("changestbch ERR Tira2 Not found.");
94 }#end if (-e "/dev/ttyUSB0")
95
96 }#endif if ($haveirdaunit == 1
97
98
Note: リポジトリブラウザについてのヘルプは TracBrowser を参照してください。
track feed