Index: trunk/install/perl/addpidatq.pl =================================================================== --- trunk/install/perl/addpidatq.pl (リビジョン 94) +++ trunk/install/perl/addpidatq.pl (リビジョン 1) @@ -14,5 +14,4 @@ use DBI; use DBD::Pg; -use DBD::SQLite; use Schedule::At; use Time::Local; @@ -20,5 +19,5 @@ $path = $0; $path =~ s/addpidatq.pl$//i; -if ($path ne "./"){ +if ($pwd ne "./"){ push( @INC, "$path"); } @@ -37,45 +36,36 @@ #DB検索(PID) -$dbh = DBI->connect($DSN,$DBUser,$DBPass) ||die $DBI::error;; + my $data_source = sprintf("dbi:%s:dbname=%s;host=%s;port=%d", + $DBDriv,$DBName,$DBHost,$DBPort); + $dbh = DBI->connect($data_source,$DBUser,$DBPass) ||die $DBI::error;; -$sth = $dbh->prepare($stmt{'addpidatq.1'}); -$sth->execute($pid); +$DBQuery = "SELECT count(*) FROM foltia_subtitle WHERE pid = '$pid' "; + $sth = $dbh->prepare($DBQuery); + $sth->execute(); @titlecount= $sth->fetchrow_array; if ($titlecount[0] == 1 ){ - $sth = $dbh->prepare($stmt{'addpidatq.2'}); - $sth->execute($pid); + +$DBQuery = "SELECT bitrate FROM foltia_tvrecord , foltia_subtitle WHERE foltia_tvrecord.tid = foltia_subtitle.tid AND pid='$pid' "; + $sth = $dbh->prepare($DBQuery); +$sth->execute(); @titlecount= $sth->fetchrow_array; $bitrate = $titlecount[0];#ビットレート取得 -if ($titlecount[1] >= 1){ - $usedigital = $titlecount[1];#デジタル優先フラグ -}else{ - $usedigital = 0; -} #PID抽出 - $now = &epoch2foldate(time()); +$now = &epoch2foldate(`date +%s`); + +$DBQuery = "SELECT stationrecch FROM foltia_station,foltia_subtitle WHERE foltia_subtitle.pid = '$pid' AND foltia_subtitle.stationid = foltia_station.stationid "; + #stationIDからrecch - $stationh = $dbh->prepare($stmt{'addpidatq.3'}); - $stationh->execute($pid); - @stationl = $stationh->fetchrow_array(); + $stationh = $dbh->prepare($DBQuery); + $stationh->execute(); +@stationl = $stationh->fetchrow_array; $recch = $stationl[0]; -if ($recch eq ""){ - &writelog("addpidatq ERROR recch is NULL:$stmt{'addpidatq.3'}."); - exit 1; -} -if ($stationl[1] => 1){ - $digitalch = $stationl[1]; -}else{ - $digitalch = 0; -} -if ($stationl[2] => 1){ - $digitalstationband = $stationl[2]; -}else{ - $digitalstationband = 0; -} - $sth = $dbh->prepare($stmt{'addpidatq.4'}); - $sth->execute($pid); + +$DBQuery = "SELECT * FROM foltia_subtitle WHERE pid='$pid' "; + $sth = $dbh->prepare($DBQuery); +$sth->execute(); ($pid , $tid , @@ -119,11 +109,11 @@ } -Schedule::At::add (TIME => "$atdateparam", COMMAND => "$toolpath/perl/recwrap.pl $recch $reclength $bitrate $tid $countno $pid $stationid $usedigital $digitalstationband $digitalch" , TAG => "$pid"."_R"); - &writelog("addpidatq TIME $atdateparam COMMAND $toolpath/perl/recwrap.pl $recch $reclength $bitrate $tid $countno $pid $stationid $usedigital $digitalstationband $digitalch"); +Schedule::At::add (TIME => "$atdateparam", COMMAND => "$toolpath/perl/recwrap.pl $recch $reclength $bitrate $tid $countno $pid" , TAG => "$pid"."_R"); + &writelog("addpidatq TIME $atdateparam COMMAND $toolpath/perl/recwrap.pl $recch $reclength $bitrate $tid $countno $pid"); }#end #もし新開始時刻が15分移譲先なら再キュー }else{ -&writelog("addpidatq drop:expire $pid $startafter $now $startdatetime"); +&writelog("addpidatq drop:expire $pid $startafter $now $startdatetime"); }#放送が未来の日付なら