MyTheatre DVB streaming?
#16
(deleted)
Reply
#17
has anyone tried the mytheatre.py script ? i"ve got mytheatre 3.20 and avbroadcast 0.12 and xbmc 1.1 and well the favorites i see are not what i have. any ideas ? what's this remote view option in mytheatre and how do i use it ?


th3_h0und
Reply
#18
Question 
this is just copied from a readme text file.
my setup is is allmost the same except i have a twinhan 1020a. i must say this works very well and picture quality of the stream is great.

mytheatre control script by marplar
script enables channel change of mytheatre favourite channels
version 1.0 06-june-04
initial release

version 2.0 06-dec-04
fixed: impossible to exit script on xbox if mytheatre exits on pc
fixed: favourite group name not displayed properly if it contains a space (actually an avbroadcaster bug)
fixed: it was possible to select a favourite group whilst channel list being retrieved
added: epg guide
added: channel change delay - this is to address problems reported by some people where mytheatre channel changes on pc but is not displayed on xbox

tested with
xbmc 2004-11-15 cvs
skystar2
mytheatre 3.20.02
avbroadcaster 0.12

epg server written using python 2.3 and distributed using py2exe

**pc setup**
1. ensure favourite channels are set up in mytheatre. only favourites are available to view in xbmc

2. configure mytheatre avbroadcaster to stream http to the xbox
network settings - enter ip address of xbox
set http port (default 8000)
network protocol - http/rtsp on, xns off
epg server setup

3. place the xbmcepg directory into you mytheatre directory (normally c:\program files\mytheatre). this will leave xbmcepg as a new subdirectory (normally c:\program files\mytheatre\xbmcepg).

4. run the program mytheatreepgserv.exe

5. if it is working a message 'mytheatre server active' will appear

6. if using winxp firewall open tcp ports for avb and epg (defaults 8000 and 8001)

notes:
-epg is optional.
-mytheatreepgserv.exe must be running for the epg to work.
-epg uses port 8001 by default. if you want to use a different port then pass it as a parameter to the program:
e.g. mytheatreepgserv.exe 8001
-if you want to install xbmcepg in a different location then pass the path to mytheatre as a second parameter
e.g. mytheatreepgserv.exe 8001 "c:\program files\mytheatre"

**xbox setup**
1. ensure you can receive http broadcast in xbmc by following the instructions here:
http://www.xboxmediaplayer.de/cgi-bin....;t=3945

2. edit the start of mytheatre.py for the ip and port of the computer running mytheatre.

servip = ip of the computer running mytheatre
e.g. servip = '192.168.0.1'

avbservport = http set in avbroadcaster (default=8000)
e.g. avbservport = 8000

epgservport = port for python epg server, if in use (default=8001)
e.g. epgservport = 8001

changedelay = delay for channel change in seconds (default=4, max = 18)
e.g. changedelay=4
this causes a delay between changing channels. if you experience problems viewing tv immediately after channel changes try increasing this value.

example settings:

############################################################
#set ip address of pc running mytheatre
servip = '192.168.0.1'
#
#set port for avbroadcaster http
avbservport = 8000
#
#set port for python epg server
epgservport = 8001
#
#set delay for channel change in seconds (default = 4, max = 18)
changedelay=4
############################################################

3. put mytheatre.py in xbmc scripts directory and run it.

4. on running script you should see the mytheatre favourites groups. use remote 'select' or controller 'a' to enter channel listing or to watch tv channel. when watching tv channels use remote 'display' or controller 'x' to toggle between channel list and tv. use remote 'menu' or controller 'back' to return to the favourites groups list or to exit.

5. use remote 'info' button or controller white button whilst highlighting a channel name to see the epg. use remote 'select' or controller 'a' whilst highlighting epg items to see more detail.

notes
-epg is optional (you can change channels and watch tv without it)

known bugs:
radio channels do not work due to limitation in avbroadcaster
Reply
#19
hello!

hmmm, ive been doing some research on this cuz i was planning on getting an analog-tvturnercard and stream it from my server to my xboxes/xbmc's but after just looking for a few minutes i find out that it seems that the setup with mytheatre etc only works with dvb-tvturnercards?!

please correct me if i have missread this. i cant wait to get my new digitalvcr up and running.

appreciate all the response!

thanks,
beef
Reply
#20
how about dvb-t support?

yes?

well, how about support for the nova-t drivers (or even better) technotrend's bda drivers...

somehow i think i'm asking too much....

but if you don't ask....
Reply
#21
anyone here able to send me the latest xbmc mytheatre script by marplar? since the website downtime make it impossible to download it from there... you could either pm me with a download link, or pm me to request my email address so you can attach it.. or just drop off an alternate download location here.. either way, thanks ;))
Reply
#22
(obstler @ feb. 26 2005,22:10 Wrote:anyone here able to send me the latest xbmc mytheatre script by marplar? since the website downtime make it impossible to download it from there... you could either pm me with a download link, or pm me to request my email address so you can attach it.. or just drop off an alternate download location here.. either way, thanks Wink)
can someone send me one too?
thanks
Reply
#23
i live in japan an already have satellite tv (i pay a subscription) does this mean that this would be useless for me? i'd love to watch on my xbox, but i can't see it working with the decoder card thing.
Reply
#24
well my setup is like spidertnt and i have it working fine. i'd like to see a change the mytheatre.py script so that it is more like a guide or if that is not possible at least the channel description. ie like the epg information on the screen everytime you scroll through your channel listings.
a full guide like sat's have would be perfect. anyone have some ideas ?
Reply
#25
i was playing with the script a little this evening and i've gotten a somewhere i think anyways.
i added in the def onaction(self, action):

if action == action_move_up or action == action_move_down:
#display epg
if self.epglistvisible == false:
self.txtprogdesc.setvisible(false)
self.epglist.setvisible(true)
self.epglistvisible = true
if self.listings[1][0] == 'channel':
listingspos = self.list.getselectedposition()+1
#clear list
self.epglist.reset()
#get listings
self.displayepg(self.listings[listingspos][2][17:])
self.strepgtitle.setlabel(self.listings[listingspos][1][3:])
if len(self.epglistings) > 0:
self.setfocus(self.list)
else:
self.epglist.additem('no guide information')
self.setfocus(self.ist)

that will display what is playing on that specific channel. now if you scroll up and down a few times you will see that they channel info on the right does not change i haven't figured that out yet any help would be great. i'd like to change it even more i'm open to ideas ! anyone ?
Reply
#26
(th3_h0und @ mar. 03 2005,00:34 Wrote:i was playing with the script a little this evening and i've gotten a somewhere i think anyways.
i added in the def onaction(self, action):

if action == action_move_up or action == action_move_down:
#display epg
if self.epglistvisible == false:
self.txtprogdesc.setvisible(false)
self.epglist.setvisible(true)
self.epglistvisible = true
if self.listings[1][0] == 'channel':
listingspos = self.list.getselectedposition()+1
#clear list
self.epglist.reset()
#get listings
self.displayepg(self.listings[listingspos][2][17:])
self.strepgtitle.setlabel(self.listings[listingspos][1][3:])
if len(self.epglistings) > 0:
self.setfocus(self.list)
else:
self.epglist.additem('no guide information')
self.setfocus(self.ist)

that will display what is playing on that specific channel. now if you scroll up and down a few times you will see that they channel info on the right does not change i haven't figured that out yet any help would be great. i'd like to change it even more i'm open to ideas ! anyone ?
can someone tell me where to download these file?
thanks
Reply
#27
hey guys, can someone email me the script and the epgserver ? highlanderatteknoragedotcom

thanks
Reply
#28
it seems that dwl.xboxmediacenter.de had not been restored...
may someone publish the script somewhere?
Reply
#29
#mytheatre python client for xbmc
#version 2.0 by marplar 11-dec-2004

############################################################
#set ip address of pc running mytheatre
servip = '192.168.123.100'
#
#set port for avbroadcaster http
avbservport = 8000
#
#set port for python epg server
epgservport = 8001
#
#set delay for channel change in seconds (default = 4, max = 18)
changedelay=4
############################################################

import urllib, time, xbmc, xbmcgui, xml.parsers.expat, string, thread
from socket import *
from htmlparser import htmlparser
try: emulating = xbmcgui.emulating
except: emulating = false

#get actioncodes from keymap.xml
action_previous_menu = 10
action_select_item = 7
action_show_file_info = 11
action_popup_context=117

#reads avbroadcaster web page and creates list of favorite groups or channels
class myparser(htmlparser):

#read tag
def handle_starttag(self, tag, attrs):
#create dictionary of tag attributes
attrdict=dict(attrs)
if tag == 'html':
#initialse list
self.parselist = []
self.chtype = ''
elif tag == 'a':
#hyperlink tag - get link
self.href=attrdict['href']
elif tag == 'td' and len(attrdict) == 2 and self.tag == 'tr':
#table tag - check colour to determine if encrypted
if attrdict['bgcolor'] == '#00bf00':
self.encrypt = ' '
else:
self.encrypt = '!'
#store tag type
self.tag=tag

#read data (outside tag)
def handle_data(self,data):
if self.tag == 'title':
#add title to list
self.parselist.append(['title', data])
#store title to determine if page is favorite group list or channels
self.title = data
elif self.tag == 'center':
#get channel type (v/r) and add to encrypted flag (!/ )
self.chtype=data + self.encrypt + ' '
elif self.tag == 'a':
#hyperlink data
if self.href[:16] == '/list.htm?favid=':
#link is for favorite lists
if data[:9] == 'next page' and len(self.parselist) > 10:
#add next page link to list
self.parselist.append(['nextpage', data, self.href])
elif self.title == 'favorite groups list':
# add favorite group name and link to list
self.parselist.append(['favlist', data, self.href])
elif self.href[:17] == '/set_ch.htm?chid=':
#link is for channel
self.parselist.append(['channel', self.chtype + data,self.href])

def close(self):
#return list to caller
return self.parselist
self.close()

#reads mytheatre epg data
class listingsxmlparser:
def getprograms(self, chid):
#set up parser
p = xml.parsers.expat.parsercreate('utf-8')
p.startelementhandler = self.start_element
p.endelementhandler = self.end_element
p.characterdatahandler = self.char_data
#get epg data
sockobj = socket(af_inet, sock_stream)
try:
sockobj.connect((servip, epgservport))
sockobj.send('/?chid=' + chid)
data = sockobj.recv(200000)
sockobj.close()
p.parse(data)
except:
self.parselist = []
self.parselist.append(['','','','','error connecting to epg server', '',''])
return self.parselist
def start_element(self, name, attrs):
if name == 'xml':
#initialse list
self.parselist = []
elif name == 'program':
#new program
self.language=''
self.startdate=''
self.starttime=''
self.endtime=''
self.eventname=''
self.shortdescr=''
self.extdescr=''
#store name
self.name=name

def end_element(self, name):
if name =='program':
#add data to list if not in past
if float(self.endtime)>time.time():
self.startdate=time.strftime('%d %b',time.localtime(float(self.starttime)))
self.starttime=time.strftime('%h:%m',time.localtime(float(self.starttime)))
self.endtime=time.strftime('%h:%m',time.localtime(float(self.endtime)))
self.parselist.append([self.language,self.startdate,self.starttime,self.endtime,self
.eventname,self.shortdescr,self.extdescr])

#clear name
self.name = ''

def char_data(self, data):
#store attributes
if self.name == 'language':
self.language=data
elif self.name == 'starttime':
self.starttime=data
elif self.name == 'endtime':
self.endtime=data
elif self.name == 'eventname':
self.eventname=data
elif self.name == 'shortdescr':
self.shortdescr=data
elif self.name == 'extdescr':
self.extdescr=data


class myclass(xbmcgui.window):
def (self):
if emulating: xbmcgui.window.(self)
#set default mode
self.tvradiomode = 'tv only'
self.encryptmode = 'all channels'
#set up screen
self.addcontrol(xbmcgui.controlimage(0,0,800,600, 'background.png'))
self.addcontrol(xbmcgui.controllabel(50, 60, 10, 80, 'my', 'font14', '0xffff2000'))
self.addcontrol(xbmcgui.controllabel(75, 60, 100, 80, 'theatre', 'font14', '0xff000000'))
self.buttvradio = xbmcgui.controlbutton(300, 60, 120, 35, self.tvradiomode, 'button-focus.png', 'button-nofocus.png')
self.addcontrol(self.buttvradio)
self.butencrypt = xbmcgui.controlbutton(500, 60, 120, 35, self.encryptmode, 'button-focus.png', 'button-nofocus.png')
self.addcontrol(self.butencrypt)
self.strtitle = xbmcgui.controllabel(50, 120, 200, 200, '', 'font14', '0xffa5ff00')
self.addcontrol(self.strtitle)
self.list = xbmcgui.controllist(50, 150, 250, 370)
self.addcontrol(self.list)
self.strepgtitle = xbmcgui.controllabel(350, 190, 200, 200, 'program guide', 'font14', '0xffa5ff00')
self.addcontrol(self.strepgtitle)
self.txtprogdesc = xbmcgui.controllabel(350, 220, 350, 350,'','font13','0xffa5ff00')
self.addcontrol(self.txtprogdesc)
self.txtprogdesc.setvisible(false)
self.epglistvisible=true
self.epglist = xbmcgui.controllist(350, 220, 320, 300)
self.addcontrol(self.epglist)


#set navigation
self.list.controlleft(self.buttvradio)
self.epglist.controlleft(self.list)
self.epglist.controlright(self.butencrypt)
self.butencrypt.controlleft(self.buttvradio)
self.butencrypt.controldown(self.list)
self.buttvradio.controldown(self.list)
self.buttvradio.controlright(self.butencrypt)

#initialise parsers
self.myparser=myparser()
self.epgparser=listingsxmlparser()

#get favorites group list
self.file = '/list.htm'
self.parselist(url)
self.setfocus(self.list)

#read html page
def getlist(self,url,file):
opener = urllib.fancyurlopener({})
try:
doc = opener.open(url + file)
webpage = doc.read() # read file
doc.close()
self.myparser.feed(webpage)
listings=self.myparser.close()
return listings
except:
self.message('unable to retrieve channel list')
return 'nolist'

#check if stream is being received
def testchannel(self, url):
opener = urllib.fancyurlopener({})
try:
doc = opener.open(url + '/dvbcore.mpg')
datacount = len(doc.readline())
doc.close
if datacount > 0:
return 'ok'
else:
return ' '
except:
return ' '

#display listing
def parselist(self,url):
#get listings
self.listings =self.getlist(url,self.file)

#check listing was retreived
if self.listings == 'nolist':
return

self.list.reset()

#check if list is complete
while self.listings[len(self.listings)-1][0] == 'nextpage':
nextpage = self.getlist(url, self.listings[len(self.listings)-1][2])
self.listings.pop(len(self.listings)-1) #remove nextpage from original list
nextpage.pop(0) #remove title from extended list
self.listings.extend(nextpage) #join original and extended lists

#filter channels to show tv/radio and fta/encryted
count = 0
while count < len(self.listings):
if self.listings[count][0] == 'channel':
if self.parsecheckmode(self.listings[count][1]) == 0:
self.listings.pop(count)
else:
count = count + 1
else:
count = count + 1

#populate list
for listing in self.listings:
if listing[0] == 'title':
if listing[1] == 'favorite groups list':
self.strtitle.setlabel(listing[1])
else:
self.list.additem(listing[1])



#check channel to show tv/radio and fta/encryted
def parsecheckmode(self, listing):
if self.tvradiomode == 'tv only' and listing[0:1] <> 'v':
return 0
elif self.tvradiomode == 'radio only' and listing[0:1] <> 'r':
return 0
elif self.encryptmode == 'fta only' and listing[1:2] =='!':
return 0
elif self.tvradiomode == 'tv and radio':
if listing[0:1] <> 'v' and listing[0:1] <> 'r':
return 0
else:
return 1

#display epg info
def displayepg(self,chid):
#populate new listings
self.epglistings=self.epgparser.getprograms(chid)
for listing in self.epglistings:
self.epglist.additem(listing[2] + ' ' + listing[4])

#split epg description lines
def linesplit(self,text,width):

lines = []
while len(text) > width:
cutoff1 = string.rfind(text[:width]," ")
cutoff2 = string.find(text[:width],"\n")
if cutoff2 > cutoff1:
cutoff = cutoff2
elif cutoff1 < width*4/5:
cutoff = width
else:
cutoff = cutoff1
lines.append(text[:cutoff])
text = " " + string.lstrip(text[cutoff:])
if width < 3: text = string.lstrip(text)

lines.append(text)
return lines


#handle user input
def oncontrol(self, control):
if control == self.list:
#user selected group/channel list
try:
listingspos = self.list.getselectedposition()+1
if self.listings[listingspos][0] == 'channel':
#user selected channel change
dialog = xbmcgui.dialogprogress()
dialog.create('mytheatre', 'tuning to ' + self.listings[listingspos][1][3:])
self.getlist(url, self.listings[listingspos][2])
searchpos = 0
#wait for change delay
while searchpos <= changedelay * 5 and dialog.iscanceled() == 0:
searchpos = searchpos + 5
dialog.update(searchpos)
time.sleep(1)

#wait for stream to be detected
while searchpos <= 95 and dialog.iscanceled() == 0 and self.testchannel(url) != 'ok':
searchpos = searchpos + 5
dialog.update(searchpos)
time.sleep(1)

if searchpos < 100 and dialog.iscanceled() == 0:
#play stream
dialog.close()
xbmc.player().play(url + '/dvbcore.mpg')
elif dialog.iscanceled() == 0:
#time out
dialog.close()
self.message('channel not decryptable or not broadcasting')
else:
#user cancelled
dialog.close()
else:
#user selected group list
self.file = self.listings[self.list.getselectedposition()+1][2]
self.strtitle.setlabel(self.listings[self.list.getselectedposition()+1][1])
self.parselist(url)
except:
self.message('error tuning channel.')

if control == self.epglist:
if self.epglistvisible == true:
#display extended epg info
listingspos = self.epglist.getselectedposition()
if len(self.epglistings) > 0:
self.strepgtitle.setlabel(self.epglistings[listingspos][4])
epgdata = 'start: ' + self.epglistings[listingspos][1]
epgdata = epgdata + ' ' + self.epglistings[listingspos][2]
epgdata = epgdata + ' end: ' + self.epglistings[listingspos][3] + '\n'
epgdata = epgdata + 'description: \n'
epgdesclist=self.linesplit(self.epglistings[listingspos][5] + '\n' + self.epglistings[listingspos][6], 40)
for epgdesc in epgdesclist:
epgdata = epgdata + epgdesc + '\n'
epgdata = epgdata + 'language : ' + self.epglistings[listingspos][0]

self.epglist.setvisible(false)
self.epglistvisible = false
self.txtprogdesc.setvisible(true)
self.txtprogdesc.setlabel(epgdata)
else:
#return to list
self.setfocus(self.list)
self.txtprogdesc.setvisible(false)
self.epglist.setvisible(true)
self.epglistvisible = true
self.setfocus(self.epglist)
listingspos = self.list.getselectedposition()+1
self.strepgtitle.setlabel(self.listings[listingspos][1][3:])

elif control == self.buttvradio:
#user selected tv/radio mode button - toggle button and display list
if self.tvradiomode == 'tv and radio':
self.tvradiomode = 'tv only'
elif self.tvradiomode == 'tv only':
self.tvradiomode = 'radio only'
else:
self.tvradiomode = 'tv and radio'

self.buttvradio.setlabel(self.tvradiomode)
self.parselist(url)

elif control == self.butencrypt:
#user selected encrypt mode button - toggle button and display list
if self.encryptmode == 'all channels':
self.encryptmode = 'fta only'
else:
self.encryptmode = 'all channels'

self.butencrypt.setlabel(self.encryptmode)
self.parselist(url)

def onaction(self, action):

if action == action_previous_menu:
#user selected back - show favourite groups or exit
if self.listings[1][0] == 'channel':
self.file = '/list.htm'
self.parselist(url)
self.setfocus(self.list)
else:
self.close()

if action == action_show_file_info or action == action_popup_context:
#display epg
if self.epglistvisible == false:
self.txtprogdesc.setvisible(false)
self.epglist.setvisible(true)
self.epglistvisible = true
if self.listings[1][0] == 'channel':
listingspos = self.list.getselectedposition()+1
#clear list
self.epglist.reset()
#get listings
self.displayepg(self.listings[listingspos][2][17:])
self.strepgtitle.setlabel(self.listings[listingspos][1][3:])
if len(self.epglistings) > 0:
self.setfocus(self.epglist)
else:
self.epglist.additem('no program guide')
self.setfocus(self.list)

#display message
def message(self, message):
dialog = xbmcgui.dialog()
dialog.ok(" mytheatre", message)

###############
#main
###############

url='http://' + servip + ':' + str(avbservport)
mydisplay = myclass()
mydisplay.domodal()
del mydisplay
Reply
#30
well it's nice too see that some people are still reading this post highlander i've sent you the script via e-mail. you need more than just the script there is the server broadcast side with it as well.

so to further this does anyone or can anyone help to better this script ?
Reply

Logout Mark Read Team Forum Stats Members Help
MyTheatre DVB streaming?0