MyTV - tsreader dvb-s plugin in development...
#1
this threads purpose is to discuss the development and integration of a python script to interface with the tsreader application.

tsreader, for those who don't know, is an excellent commercial (read:not free) application for the reception and control of dvb content (video and audio). the dvb standard is used by various distribution methods including satelite providers such as free to air, echostar dishnet, bell expressvu, and others worldwide check here. we can utilize this by obtaining a dvb compliant pc card, and connecting it to the appropriate source (satelite dish)

in addition to satelite, tsreader is also capable of tuning to other dvb sources such as terestrial (dvb-t), and cable (dvb-c).

tsreader provides the ability to tune to specific 'programs' and either view, record or stream the content (audio and video) within the program.

why is this cool? bigbellybilly has created a python script (mytv)to manipulate tv content by reading program guide information, displaying it within xbmc, and allowing the script to interact with different plugins.

the goal of this thread is to write a script that interfaces with mytv in a two ways;

1. provides program information from tsreader for display within the mytv guide.
2. (based on this previous goal) allows mytv actions to trigger the viewing, recording, and streaming of tsreader programs.

the ability to do both of the above is made possible through tsreader's control server, which is a telnet-like interface that listens on port 1399 on the tsreader pc. this server has a defined command set that allows for manipulation of the application. the details of this command set can be found here.

there is also some sample perl code available that provides an example of how the control server can be communicated with.

the two objectives stated previously can be broken down into a number of activities;

1. obtain program information

a) tsreader provides a function that dumps the current program information into an xmltv format. this formal is already usable by mytv. the question comes down to where the file is stored, how much (start and end) information is requested, how does it get refreshed and how often, but these are questions for the mytv script.

b) additional program information about listed programs can be obtained two ways, one from the dumped program information, and the other from tv.com. again, this question is for mytv.

2. trigger the viewing, recording of content

a) the action to watch a program from mytv can result in a few options (in my opinion and based on current tsreader functionality);

first a vlc stream can be configured and xbmc pointed to (but this is limited when trying to provide timeshifting,

second, a .ts or .mpeg file can be recorded on an smb share and then xbmc directed to playback the recorded file (what happens to the recording during and after viewing?)

b) the action to record a program from mytv commands tsreader to record the selected program to a file share. how does this file get indexed? is there a way to track what has been recorded, and information on the program, episode, season, actors, etc, similar to the way movies are indexed?

i don't have the skillz in python (yet) to be successful. hopefully i can solicit a python expert with a dvb card and tsreader to assist.

thanks

jt
Reply
#2
sample perl code:

Quote:#a sample perl script showing some of the features
#in tsreader's control server

use telnet ();

#connect to tsreader's control server
$t = new net::telnet (timeout => 1,
port => 1399);
eval{$t->open("127.0.0.1");};
if ($@)
{die("unable to connect to tsreader - is the control server running?\n$@\n");};

#display what tsreader sent us
@line = $t->getline();
print "tsreader connected.\nresponse: @line\n";

#display functions in this program
print "functions supported are:\n";
print " 1 - print programs in mux\n";
print " 2 - display graph\n";
print " 3 - switch to a multicast udp mux\n";
print " 4 - play channel via vlc\n";
print "function? ";
$function = <stdin>;
chop $function;

if ($function eq 1)
{
#get and print a list of programs
$t->print("program");
print "these programs are defined:\n";
$doit = 1;
while($doit eq 1)
{
eval {@line = $t->getline(timeout => 1);};
if ($@)
{$doit=0;}
else
{print @line;}
}
}
elsif ($function eq 2)
{
#draw a graph
$dont_send = 0;
print "available graphs are:\n";
print " 0 - close any existing graph\n";
print " 1 - active pids by rate\n";
print " 2 - active pids by pid\n";
print " 3 - pid usage 2d pie\n";
print " 4 - pid usage 3d pie\n";
print " 5 - mux usage stacked area\n";
print " 6 - mux usage line\n";
print " 7 - video rate area\n";
print " 8 - video rate line\n";
print " 9 - program usage\n";
print " 10 - video composition\n";
print "which chart? ";
$chart = <stdin>;
chop $chart;
if ($chart eq 10)
{
print "program number? ";
$program_number = <stdin>;
chop $program_number;

$t->print("program $program_number");
@line = $t->getline(timeout => 1);
if (@line =~ /502/)
{
print("?invalid program number!\n");
$dont_send = 1;
}
}
if ($dont_send eq 0)
{
$t->print("graph $chart");
@line = $t->getline(timeout => 1);
}
}
elsif ($function eq 3)
{
#switch to the multicast source and restart tsreader
print "multicast address to listen to? ";
$multicast_address = <stdin>;
chop $multicast_address;
print "udp port to listen to? ";
$multicast_port = <stdin>;
chop $multicast_port;

$t->print("source tsreader_udpmulticast.dll");
@line = $t->getline(timeout => 1);
print "response to source: @line";

$t->print("tune $multicast_address $multicast_port");
@line = $t->getline(timeout => 1);
print "response to tune: @line";
}
elsif ($function eq 4)
{
$dont_send = 0;
print "program number? ";
$program_number = <stdin>;
chop $program_number;

$t->print("program $program_number");
@line = $t->getline(timeout => 1);
if (@line =~ /502/)
{
print("?invalid program number!\n");
$dont_send = 1;
}
if ($dont_send eq 0)
{
$t->print("play vlc1");
@line = $t->getline(timeout => 1);
print "response to play: @line";
}
}

#all done
$t->print("quit");
Reply
#3
it would be one works wonderfulSmile to when previewing the escape?
Reply
#4
my attempt at translation:

"that would be wonderful, when will it be released?"

my english answer:

as soon as i find a python developer that can help me build the script.

jt
Reply
#5
sorry for my bad englishSmile are italian, i have used google for the translation, i hope that it finds someone soon, if you could i would help you gladly, but does not know null on the python


english by google the number one for the translations! Smile
Reply
#6
i have the python to control tsreader.

i just need a python epg that will read tsreader's xmltv file.

anyone?
Reply
#7
great! this script needs to be written to interface with the mytv script by bigbellybilly. have you had a look at that script?
Reply
#8
have you gotten mytv to work with the xmltv.xml file that tsreader exports?

here is the basis...

import xbmc, xbmcgui, telnetlib
try: emulating = xbmcgui.emulating
except: emulating = false

#get actioncodes from keymap.xml
action_previous_menu = 10

class myclass(xbmcgui.window):
def (self):
if emulating: xbmcgui.window.(self)
self.addcontrol(xbmcgui.controlimage(0,0,720,480, "q:\\scripts\\util\\background.jpg"))
self.stractioninfo = xbmcgui.controllabel(50, 230, 200, 200, "", "font13", "0xffffcc66")
self.addcontrol(self.stractioninfo)
self.stractioninfo.setlabel("push back to quit.")

# make all the buttons
self.button0 = xbmcgui.controlbutton(250, 150, 140, 30, "1. watch mtv!")
self.addcontrol(self.button0)
self.button1 = xbmcgui.controlbutton(250, 200, 140, 30, "2. watch bet!")
self.addcontrol(self.button1)
self.button2 = xbmcgui.controlbutton(550, 230, 140, 30, "3. launch dvb!")

self.addcontrol(self.button2)
self.setfocus(self.button0)
self.button0.controldown(self.button1)
self.button1.controlup(self.button0)
self.button1.controlright(self.button2)
self.button2.controlleft(self.button1)

def onaction(self, action):
if action == action_previous_menu:
self.close()

def oncontrol(self, control):
if control == self.button0:
tn = telnetlib.telnet('192.168.0.2', 23)
tn.write('tune 12443 l 20000 11250 0\r')
tn.read_until('tracy', timeout=5)
tn.write('program 160\r')
tn.read_until('tracy', timeout=5)
tn.write('play xns\r')
tn.read_until('tracy', timeout=1)
tn.close()
filename = "xns://192.168.0.2:1400/00160 - mtv.mpg"
xbmc.player().play(filename)
if control == self.button1:
tn = telnetlib.telnet('192.168.0.2', 23)
tn.write('tune 12239 l 20000 11250 0\r')
tn.read_until('tracy', timeout=5)
tn.write('program 124\r')
tn.read_until('tracy', timeout=5)
tn.write('play xns\r')
tn.read_until('tracy', timeout=1)
tn.close()
filename = "xns://192.168.0.2:1400/00124 - bet.mpg"
xbmc.player().play(filename)
if control == self.button2:
tn = telnetlib.telnet('192.168.0.2', 23)
tn.write('tune 12239 l 20000 11250 0\r')
tn.read_until('tracy', timeout=5)
tn.write('program 124\r')
tn.read_until('tracy', timeout=5)
tn.write('play xns\r')
tn.read_until('tracy', timeout=1)
tn.close()
filename = "xns://192.168.0.2:1400/00124 - bet.mpg"
xbmc.player().play(filename)

mydisplay = myclass()
mydisplay.domodal()
del mydisplay
Reply

Logout Mark Read Team Forum Stats Members Help
MyTV - tsreader dvb-s plugin in development...0