- Beginnings of TV OSD

This commit is contained in:
noisymime 2008-02-13 21:11:17 +00:00
parent e56d73ea53
commit 77c7802f90
2 changed files with 74 additions and 39 deletions

View File

@ -3,6 +3,7 @@ import pygtk
import pygst
import os
import clutter
import gobject
from clutter import cluttergst
from modules.myth_tv_player.MythBackendConn import MythBackendConnection
@ -19,10 +20,12 @@ class Module:
self.dbMgr = dbMgr
self.setup_ui()
self.osd = osd()
self.videoController = VideoController(glossMgr)
self.dbController = tv_db_controller(dbMgr)
self.dbController.get_current_show(1033)
channels = self.dbController.get_channels()
#self.dbController.get_current_show(1033)
self.channels = self.dbController.get_channels()
self.currentChannel = 0
self.isRunning = False
@ -55,18 +58,24 @@ class Module:
def stop(self):
self.videoController.stop_video()
self.myConn.stop() # Stops the backend / frontend streaming
if self.myConn:
self.myConn.stop() # Stops the backend / frontend streaming
def stop_video(self):
self.myConn.stop()
def on_key_press_event (self, stage, event):
if self.isRunning:
#Handle up/down presses for OSD
if (event.keyval == clutter.keysyms.Up) or (event.keyval == clutter.keysyms.Down):
self.osd.on_key_press_event(self.stage, event, self)
self.videoController.on_key_press_event(event)
if event.keyval == clutter.keysyms.Escape:
return True
#print event.hardware_keycode
"""if event.keyval == clutter.keysyms.p:
if self.paused:
self.unpause()
@ -95,14 +104,33 @@ class Module:
return tempMenu
class channel:
class osd:
def __init__(self, chanID, channum, name, iconLocation, xmltvid):
self.chanID = chanID
self.channum = channum
self.name = name
self.iconLocation = iconLocation
self.xmltvid = xmltvid
def __init__(self):
self.background = clutter.Texture()
self.text = clutter.Label()
self.text.set_font_name("Mono 40")
self.text.show()
def get_name():
return self.name
self.on_screen = False
self.channelOffset = 0
def on_key_press_event(self, stage, event, tv_player):
if self.on_screen:
if (event.keyval == clutter.keysyms.Up):
self.channelOffset += 1
elif (event.keyval == clutter.keysyms.Down):
self.channelOffset -= 1
else:
stage.add(self.text)
self.channelOffset = 0
self.currentChannel = tv_player.channels[tv_player.currentChannel+self.channelOffset]
self.text.set_text(self.currentChannel.name)
self.on_screen = True
gobject.timeout_add(1500, self.exit, stage)
def exit(self, stage):
stage.remove(self.text)
self.on_screen = False

View File

@ -18,6 +18,8 @@ class tv_db_controller:
tmpChannel.import_from_mythObject(entry)
channels.append(tmpChannel)
return channels
def get_current_show(self, chanID):
timeString = time.strftime( "%Y-%m-%d %H:%M:%S" )
tim = time.strptime(time.ctime())
@ -74,30 +76,35 @@ class show:
pass
def import_from_mythObject(self, mythObject):
self.chanID = mythObject[0]
self.channum = mythObject[1]
self.freqid = mythObject[2]
self.sourceid = mythObject[3]
self.callsign = mythObject[4]
self.name = mythObject[5]
self.icon = mythObject[6]
self.finetune = mythObject[7]
self.videofilters = mythObject[8]
self.xmltvid = mythObject[9]
self.recpriority = mythObject[10]
self.contrast = mythObject[11]
self.brightness = mythObject[12]
self.colour = mythObject[13]
self.hue = mythObject[14]
self.tvformat = mythObject[15]
self.commfree = mythObject[16]
self.visible = mythObject[17]
self.outputfilters = mythObject[18]
self.useonairguide = mythObject[19]
self.mplexid = mythObject[20]
self.serviceid = mythObject[21]
self.atscsrcid = mythObject[22]
self.tmoffset = mythObject[23]
self.atsc_major_chan = mythObject[24]
self.atsc_minor_chan = mythObject[25]
self.last_record = mythObject[26]
try:
self.chanID = mythObject[0]
self.starttime = mythObject[1]
self.endtime = mythObject[2]
self.title = mythObject[3]
self.subtitle = mythObject[4]
self.description = mythObject[5]
self.category = mythObject[6]
self.category_type = mythObject[7]
self.airdate = mythObject[8]
self.stars = mythObject[9]
self.previouslyshown = mythObject[10]
self.title_pronounce = mythObject[11]
self.stereo = mythObject[12]
self.subtitled = mythObject[13]
self.hdtv = mythObject[14]
self.closecaptioned = mythObject[15]
self.partnumber = mythObject[16]
self.parttotal = mythObject[17]
self.seriesid = mythObject[18]
self.originalairdate = mythObject[19]
self.showtype = mythObject[20]
self.colorcode = mythObject[21]
self.syndicatedepisodenumber = mythObject[22]
self.programid = mythObject[23]
self.manualid = mythObject[24]
self.generic = mythObject[25]
self.listingsource = mythObject[26]
self.first = mythObject[27]
self.last = mythObject[28]
except IndexError, e:
print "Found difference in DB structure. Attempting to continue."