- 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 pygst
import os import os
import clutter import clutter
import gobject
from clutter import cluttergst from clutter import cluttergst
from modules.myth_tv_player.MythBackendConn import MythBackendConnection from modules.myth_tv_player.MythBackendConn import MythBackendConnection
@ -19,10 +20,12 @@ class Module:
self.dbMgr = dbMgr self.dbMgr = dbMgr
self.setup_ui() self.setup_ui()
self.osd = osd()
self.videoController = VideoController(glossMgr) self.videoController = VideoController(glossMgr)
self.dbController = tv_db_controller(dbMgr) self.dbController = tv_db_controller(dbMgr)
self.dbController.get_current_show(1033) #self.dbController.get_current_show(1033)
channels = self.dbController.get_channels() self.channels = self.dbController.get_channels()
self.currentChannel = 0
self.isRunning = False self.isRunning = False
@ -55,18 +58,24 @@ class Module:
def stop(self): def stop(self):
self.videoController.stop_video() 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): def stop_video(self):
self.myConn.stop() self.myConn.stop()
def on_key_press_event (self, stage, event): def on_key_press_event (self, stage, event):
if self.isRunning: 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) self.videoController.on_key_press_event(event)
if event.keyval == clutter.keysyms.Escape: if event.keyval == clutter.keysyms.Escape:
return True return True
#print event.hardware_keycode #print event.hardware_keycode
"""if event.keyval == clutter.keysyms.p: """if event.keyval == clutter.keysyms.p:
if self.paused: if self.paused:
self.unpause() self.unpause()
@ -95,14 +104,33 @@ class Module:
return tempMenu return tempMenu
class channel: class osd:
def __init__(self, chanID, channum, name, iconLocation, xmltvid): def __init__(self):
self.chanID = chanID self.background = clutter.Texture()
self.channum = channum self.text = clutter.Label()
self.name = name self.text.set_font_name("Mono 40")
self.iconLocation = iconLocation self.text.show()
self.xmltvid = xmltvid
def get_name(): self.on_screen = False
return self.name 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) tmpChannel.import_from_mythObject(entry)
channels.append(tmpChannel) channels.append(tmpChannel)
return channels
def get_current_show(self, chanID): def get_current_show(self, chanID):
timeString = time.strftime( "%Y-%m-%d %H:%M:%S" ) timeString = time.strftime( "%Y-%m-%d %H:%M:%S" )
tim = time.strptime(time.ctime()) tim = time.strptime(time.ctime())
@ -74,30 +76,35 @@ class show:
pass pass
def import_from_mythObject(self, mythObject): def import_from_mythObject(self, mythObject):
self.chanID = mythObject[0] try:
self.channum = mythObject[1] self.chanID = mythObject[0]
self.freqid = mythObject[2] self.starttime = mythObject[1]
self.sourceid = mythObject[3] self.endtime = mythObject[2]
self.callsign = mythObject[4] self.title = mythObject[3]
self.name = mythObject[5] self.subtitle = mythObject[4]
self.icon = mythObject[6] self.description = mythObject[5]
self.finetune = mythObject[7] self.category = mythObject[6]
self.videofilters = mythObject[8] self.category_type = mythObject[7]
self.xmltvid = mythObject[9] self.airdate = mythObject[8]
self.recpriority = mythObject[10] self.stars = mythObject[9]
self.contrast = mythObject[11] self.previouslyshown = mythObject[10]
self.brightness = mythObject[12] self.title_pronounce = mythObject[11]
self.colour = mythObject[13] self.stereo = mythObject[12]
self.hue = mythObject[14] self.subtitled = mythObject[13]
self.tvformat = mythObject[15] self.hdtv = mythObject[14]
self.commfree = mythObject[16] self.closecaptioned = mythObject[15]
self.visible = mythObject[17] self.partnumber = mythObject[16]
self.outputfilters = mythObject[18] self.parttotal = mythObject[17]
self.useonairguide = mythObject[19] self.seriesid = mythObject[18]
self.mplexid = mythObject[20] self.originalairdate = mythObject[19]
self.serviceid = mythObject[21] self.showtype = mythObject[20]
self.atscsrcid = mythObject[22] self.colorcode = mythObject[21]
self.tmoffset = mythObject[23] self.syndicatedepisodenumber = mythObject[22]
self.atsc_major_chan = mythObject[24] self.programid = mythObject[23]
self.atsc_minor_chan = mythObject[25] self.manualid = mythObject[24]
self.last_record = mythObject[26] 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."