nwahec
July 13th, 2004, 05:53 PM
#
# Copyright (C) 2002 Alex Shah. All rights reserved.
#
our $VCR_HOME = "C:/Program Files/Creative/VideoBlaster Digital VCR";
use Win32;
use Win32::Setupsup;
use XML::Simple;
use Data::Dumper;
use Time::Local;
use Tk;
use strict;
# global variables
our $window;
our $timeout = 0;
our $standby = 0;
our $freq= 'daily';
# read parameters from titantv xml
my $input;
if (scalar(@ARGV) == 0)
{
$input = \*STDIN;
}
else
{
$input = $ARGV[0];
}
my $config = XMLin($input)->{program};
# clean up config
foreach my $key (keys(%$config))
{
if (ref($config->{$key}) || !defined($config->{$key}))
{
$config->{$key} = '';
}
}
print Dumper($config);
# convert the start and end time to seconds
my ($start_year, $start_mon, $start_day) = unpack("A4A2A2", $config->{'start-date'});
my ($end_year, $end_mon, $end_day) = unpack("A4A2A2", $config->{'end-date'});
my ($start_hour, $start_min) = unpack("A2xA2", $config->{'start-time'});
my ($end_hour, $end_min) = unpack("A2xA2", $config->{'end-time'});
# sanity check, are start and end time before after or now?
my $start = timegm(0, $start_min, $start_hour, $start_day, $start_mon-1, $start_year-1900);
my $end = timegm(0, $end_min, $end_hour, $end_day, $end_mon-1, $end_year-1900);
my $curr = time();
# did program already pass?
if ($end < $curr)
{
print "cannot record program that occurred in the past\n";
exit();
}
# is program currently playing?
if ($start < $curr && $end > $curr)
{
print "flip to this channel.\n";
start();
flip($config->{'rf-channel'});
exit();
}
else
{
# prompt for whether you want to record one, daily, weekdays, or weekly
$config->{date} = scalar(localtime($start));
showGUI($config);
print "frequency = $freq\n";
# figure out if we are recording today
my ($sec,$min,$hour,$mday,$mon,$year,$wday);
($sec,$min,$hour) = localtime();
my $curr_time = $hour*3600 + $min*60 + $sec;
($sec, $min, $hour, $mday, $mon, $year, $wday) = localtime($start);
my @weekdays = ("Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday");
my $start_time = $hour*3600 + $min*60 + $sec;
my $skip = int(($start - $curr)/(24*60*60));
print "start = $start_time, curr = $curr_time\n";
# if time has already passed today, skip to tomorrow
if ($start_time < $curr_time)
{
print "skipping an extra day\n";
$skip++;
}
# start application and set recording
start();
record(
$config->{'rf-channel'},
$skip,
mytime($start),
mytime($end),
$config->{'program-title'},
$config->{'program-description'},
$freq,
$weekdays[$wday]
);
if ($standby)
{
print "standing by\n";
standby();
}
exit();
}
sub mytime
{
my $time = shift(@_);
my ($sec,$min,$hour) = localtime($time);
my $ampm = "A";
if ($hour >= 12)
{
$ampm = "B";
}
if ($hour > 12)
{
$hour = $hour - 12;
}
if ($hour == 0)
{
$hour = 12;
}
return sprintf("%02d%02d%s", $hour, $min, $ampm);
}
sub showGUI
{
my $config = shift(@_);
my $main = MainWindow->new();
# add text
foreach my $text (
"Program Title",
"Program Description",
"Date",
"Duration"
)
{
my $key = $text;
$key =~ s/ /-/;
$key =~ tr/A-Z/a-z/;
my $frame = $main->Frame();
my $txt2 = $config->{$key};
my $height = int(length($txt2) / 40) + 1;
my $box = $frame->Text(-width => 40, -height => $height, -wrap => 'word');
$box->insert('end', $txt2);
$box->configure(state => 'disabled');
$box->pack(-side => 'right');
$frame->Label(-text => $text )->pack(-side => 'right');
$frame->pack(-fill => 'x');
}
my $frame = $main->Frame();
foreach my $myfreq ('once', 'daily', 'weekdays', 'weekly')
{
$frame->Button(-text => ucfirst($myfreq), -command => sub {our $freq = $myfreq; $main->destroy();})->pack(-side => 'left');
}
$frame->Button(-text => 'Cancel', -command => sub{ exit(); })->pack(side=>'left');
$frame->pack();
MainLoop();
}
sub flip
{
my $channel = shift(@_);
Win32::Setupsup::SendKeys($window, "$channel\\RET\\", 0, $timeout);
}
sub start
{
Win32::Setupsup::WaitForWindow('Digital VCR', \$window, 100, 10);
if (!defined($window))
{
$standby = 1;
}
chdir($VCR_HOME);
system("btLaunch.exe");
Win32::Setupsup::WaitForWindow('Digital VCR', \$window, 1000, 100);
if (!defined($window))
{
print "digital vcr not responding\n";
exit();
}
if ($standby)
{
sleep(3);
}
}
sub standby
{
Win32::Setupsup::SendKeys($window, "m", 0, $timeout);
for (my $i=0;$i<10;$i++)
{
Win32::Setupsup::SendKeys($window, "\\DN\\", 0, $timeout);
}
Win32::Setupsup::SendKeys($window, "\\UP\\\\RET\\", 0, $timeout);
}
sub record
{
my ($channel, $date, $from, $to, $title, $desc, $freq, $dayofweek) = @_;
print "channel: $channel\n";
print "date = $date\n";
print "from = $from\n";
print "to = $to\n";
print "title = $title\n";
print "description = $desc\n";
print "frequency = $freq\n";
if ($date > 7)
{
print "Invalid date in record()\n";
exit();
}
# choose "schedule"
Win32::Setupsup::SendKeys($window, "m", 0, $timeout);
for (my $i=0;$i<10;$i++)
{
Win32::Setupsup::SendKeys($window, "\\UP\\", 0, $timeout);
}
Win32::Setupsup::SendKeys($window, "\\DN\\\\DN\\\\RET\\", 0, $timeout);
# choose "schedule recording"
for (my $i=0;$i<50;$i++)
{
Win32::Setupsup::SendKeys($window, "\\UP\\", 0, $timeout);
}
Win32::Setupsup::SendKeys($window,
"\\RET\\\\UP\\\\UP\\\\UP\\\\UP\\\\UP\\\\UP\\\\UP\\" .
"$channel\\DN\\", 0, $timeout);
# enter date
for (my $i=0; $i<$date; $i++)
{
Win32::Setupsup::SendKeys($window, "\\RIGHT\\", 0, $timeout);
}
Win32::Setupsup::SendKeys($window, "\\DN\\", 0, $timeout);
# enter from
Win32::Setupsup::SendKeys($window, $from, 0, $timeout);
Win32::Setupsup::SendKeys($window, "\\DN\\", 0, $timeout);
# enter to
Win32::Setupsup::SendKeys($window, $to, 0, $timeout);
Win32::Setupsup::SendKeys($window, "\\DN\\\\DN\\", 0, $timeout);
# frequency
if ($freq ne "once")
{
# create recording group
Win32::Setupsup::SendKeys($window, "\\RET\\\\UP\\\\UP\\\\UP\\\\UP\\\\RIGHT\\\\RIGHT\\\ \RIGHT\\",
0, $timeout);
if ($freq eq "weekdays")
{
Win32::Setupsup::SendKeys($window, "\\LEFT\\", 0, $timeout);
}
elsif ($freq eq "daily")
{
Win32::Setupsup::SendKeys($window, "\\LEFT\\\\LEFT6\\", 0, $timeout);
}
Win32::Setupsup::SendKeys($window, "\\DN\\\\DN\\\\DN\\", 0, $timeout);
for (my $i=0; $i<30; $i++)
{
Win32::Setupsup::SendKeys($window, "\\BACK\\", 0, $timeout);
}
Win32::Setupsup::SendKeys($window, $title, 0, $timeout);
$freq = ucfirst($freq);
my $extra = "";
if ($freq eq "Weekly")
{
$extra = "$dayofweek "
}
Win32::Setupsup::SendKeys($window, " ($extra $freq)", 0, $timeout);
Win32::Setupsup::SendKeys($window, "\\DN\\", 0, $timeout);
}
else
{
Win32::Setupsup::SendKeys($window, "r", 0, $timeout);
# erase untitled
for (my $i=0; $i<8; $i++)
{
Win32::Setupsup::SendKeys($window, "\\BACK\\", 0, $timeout);
}
# send title
Win32::Setupsup::SendKeys($window, $title, 0, $timeout);
Win32::Setupsup::SendKeys($window, "\\DN\\", 0, $timeout);
# send description
if (length($desc) > 0)
{
Win32::Setupsup::SendKeys($window, $desc, 0, $timeout);
}
}
# confirm
Win32::Setupsup::SendKeys($window, "\\RET\\", 0, $timeout);
Win32::Setupsup::SendKeys($window, "\\BACK\\\\BACK\\", 0, $timeout);
}
nwahec
July 16th, 2004, 08:05 PM
I emailed titan tv directly to ask for a spec for their tvvi and tvpi files. the response i got follows:
Thank you for your interest in TitanTV. TitanTV is the definite source for
knowing what's on TV now and in the future. TitanTV has also set the
standard for interactive EPGs allowing members to interact with features
such as our Watch Now, PVR scheduling, Remote scheduling and Burn to DVD.
With that said we stand ready to support any viable TV tuner or PVR product.
To become a TitanTV Partner, we have a standard license agreement along with
marketing and technical guidelines. To aid the approval process, please
complete the attached Partner Questionnaire. Once completed please submit
via email back to me. Upon receipt I will send the license agreement and
guidelines for you and your team to review and approve.
Best regards,
Deb
Deb Rolfes
Lady Titan
Decisionmark Corp.
I filled out the short questionairre but i'm not sure i will qualify to get thier spec. If i get it i will post here. I'll post the questionairre below just for info.
TitanTV Partner Questionnaire page 1 of 1
In an effort to aid the process of becoming a TitanTV Partner, please fill out this form to the best of your abilities. The detailed information provided will help speed the application process.
Company Information
Full Company Name:
Company Address:
Main Contact:
Phone:
Public: Private:
Product Information
Product Name:
(List all that are seeking EPG support)
Hardware: Software:
Product Spec:
(PDF versions can be submitted.)
Price:
Units Sold: Projected Volumes:
Distribution Channel:
Retailers:
International Offerings:
Additional EPG Support:
Future Product Releases:
Customer Support
Support Email:
Support FAQs:
vBulletin® v3.8.4, Copyright ©2000-2010, Jelsoft Enterprises Ltd.