root/trunk/install/perl/schedulecheck.pl

リビジョン 1, 1.2 kB (コミッタ: jplcom, コミット時期: 17 年 前)

initial import

  • svn:executable 属性の設定値:
Line 
1 #!/usr/bin/perl
2 #
3 # Anime recording system foltia
4 # http://www.dcc-jpl.com/soft/foltia/
5 #
6 #schedulecheck.pl
7 #
8 #DBの予約から定期的に予約キューを作り出します
9 #
10 # DCC-JPL Japan/foltia project
11 #
12 #
13
14 use DBI;
15 use DBD::Pg;
16 use Schedule::At;
17 use Time::Local;
18
19 $path = $0;
20 $path =~ s/schedulecheck.pl$//i;
21 if ($pwd  ne "./"){
22 push( @INC, "$path");
23 }
24
25 require "foltialib.pl";
26
27 #XMLゲット&更新
28 system("$toolpath/perl/getxml2db.pl");
29
30 #予約番組探し
31 $now = &epoch2foldate(`date +%s`);
32 $now = &epoch2foldate($now);
33 $checkrangetime = $now   + 15*60;#15分後まで
34 $checkrangetime =  &epoch2foldate($checkrangetime);
35
36         my $data_source = sprintf("dbi:%s:dbname=%s;host=%s;port=%d",
37                 $DBDriv,$DBName,$DBHost,$DBPort);
38          $dbh = DBI->connect($data_source,$DBUser,$DBPass) ||die $DBI::error;;
39
40 $DBQuery =  "SELECT count(*)  FROM foltia_tvrecord ";
41
42
43          $sth = $dbh->prepare($DBQuery);
44         $sth->execute();
45  @titlecount= $sth->fetchrow_array;
46
47  if ($titlecount[0]  == 0 ){
48 exit;
49 }else{
50
51 $DBQuery =  "SELECT  tid ,stationid  FROM foltia_tvrecord ";
52          $sth = $dbh->prepare($DBQuery);
53         $sth->execute();
54 while (($tid,$stationid  ) = $sth->fetchrow_array()) {
55 #キュー再投入
56 system ("$toolpath/perl/addatq.pl $tid $stationid  ");
57 &writelog("schedulecheck  $toolpath/perl/addatq.pl $tid $stationid ");
58
59 }#while
60
61
62 }
Note: リポジトリブラウザについてのヘルプは TracBrowser を参照してください。
track feed