def message(self, format, params=None): if not self.mDebugEnable: return if params is None: vbcfg.DEBUG(format) else: vbcfg.DEBUG(format % (params))
def start_application_selected(self, selected): vbcfg.DEBUG(selected) try: if selected[1] is not None: self._cb_hbbtv_activated(selected[1]["url"], selected[1]) except Exception as ErrMsg: vbcfg.ERR(ErrMsg)
def _cb_register_infobar(self): if InfoBar.instance: self._timer_infobar.stop() if self._cb_hbbtv_activated not in InfoBar.instance.onHBBTVActivation: InfoBar.instance.onHBBTVActivation.append( self._cb_hbbtv_activated) vbcfg.DEBUG("registred HbbTV in InfoBar")
def get_autostart_application(self): if self._applicationList is None: service = self.session.nav.getCurrentService() info = service and service.info() if info is not None: sid = info.getInfo(iServiceInformation.sSID) onid = info.getInfo(iServiceInformation.sONID) tsid = info.getInfo(iServiceInformation.sTSID) name = info.getName() vbcfg.g_channel_info = (sid, onid, tsid, name) pmtid = info.getInfo(iServiceInformation.sPMTPID) demux = info.getInfoString( iServiceInformation.sLiveStreamDemuxId) vbcfg.DEBUG("demux = %s, pmtid = 0x%x, sid = 0x%x" % (demux, pmtid, sid)) from aitreader import eAITSectionReader reader = eAITSectionReader(demux, pmtid, sid) if reader.doOpen(info, self.m_vuplus): reader.doParseApplications() #reader.doDump() else: vbcfg.ERR("no AIT") try: self._applicationList = reader.getApplicationList() except: pass if self._applicationList is not None: for app in self._applicationList: if app["control"] in (1, -1): return app return None
def parse(self, data): hlen = struct.calcsize('ibi') packet = "" opcode, result, length = struct.unpack('ibi', data[:hlen]) vbcfg.DEBUG("%s %s %d" % (opcode, result, length)) if length > 0: packet = data[hlen:hlen + length] return [opcode, result, packet]
def start_hbbtv_application(self): vbcfg.g_main.vbhandler.soft_volume = -1 self.setTitle(_('HbbTV Plugin')) vbcfg.LOG("Starting HbbTV") vbcfg.DEBUG("url : %s" % self._url and self._url) vbcfg.DEBUG("info: %s" % self._info and self._info) if self._info and self._info["control"] == 1 and vbcfg.g_channel_info is not None: (sid, onid, tsid, name) = vbcfg.g_channel_info params = struct.pack('iiiiii', 0, self._info["orgid"], sid, onid, tsid, 0) + vbcfg.g_channel_info[3] ret = VBController.command('HBBTV_LOADAIT', params) else: ret = VBController.command('HBBTV_OPENURL', self._url) if ret is False: self._close_timer.start(1000) vbcfg.ERR("Failed to start hbbtv")
def __init__(self, opcode_list, szcbh): opcode = 0 for opcode_str in opcode_list: if opcode_str is None and len(opcode_str) == 0: continue _OPCODE[opcode_str] = [opcode, None] opcode = opcode + 1 registreted_idx = 0 for fname in dir(self): try: if not fname.startswith(szcbh): continue fref = getattr(self, fname) if fref is None: continue opcodestr = fname[len(szcbh):] vbcfg.DEBUG("registrated at %s" % opcodestr) SetHandler(opcodestr, fref) registreted_idx += 1 except: pass vbcfg.DEBUG("%d registreated" % registreted_idx)
def start_hbbtv_application(self): #print "=========== start_hbbtv_application ================" vbcfg.g_main.vbhandler.soft_volume = -1 self.setTitle(_('HbbTV Plugin')) vbcfg.DEBUG("Starting HbbTV") #vbcfg.DEBUG("url : %s" % self._url and self._url) vbcfg.DEBUG("info: %s" % self._info and self._info) if self._info and self._info[ "control"] == 1 and vbcfg.g_channel_info is not None: os.system("run.sh restart %d %d %s" % (self.width, self.height, self._info["url"])) else: if self._url is not None: os.system("run.sh restart %d %d %s" % (self.width, self.height, self._url)) else: os.system("run.sh restart %d %d %s" % (self.width, self.height, self._info["url"])) vbcfg.g_main._timer_update_video_size.start(100)
def doDump(self): for x in self.getApplicationList(): vbcfg.DEBUG("Name : %s" % x["name"]) vbcfg.DEBUG("URL : %s" % x["url"]) vbcfg.DEBUG("OrgID : %s" % x["orgid"]) vbcfg.DEBUG("AppID : %s " % x["appid"]) vbcfg.DEBUG("Control Code : %s" % x["control"]) vbcfg.DEBUG("Profile Code : %s" % x["profile"])
def toggle_browser(self, url=None, title=None): self._current_url = url if title is None: idx = len(url) if idx > 10: idx = 10 title = url[:idx] self._current_title = title if self._current_url: vbcfg.DEBUG(self._current_url) self.toggle_top() self["menulist"].pageUp() self.keyUp() self.keyDown()
def command(opcodestr, data=""): cmd_fd = None vbcfg.DEBUG("send ipc: [%s]" % opcodestr) try: send_data = VBController.assamble(opcodestr, data) if not os.path.exists(vbcfg.CONTROLFILE): raise Exception("no found controller file.") cmd_fd = os.open(vbcfg.CONTROLFILE, os.O_WRONLY) if cmd_fd is None: raise Exception("fail to open controller file.") os.write(cmd_fd, send_data) except Exception, err: vbcfg.ERR("VBHController: %s" % err) vbcfg.setPosition(vbcfg.g_position) vbcfg.osd_unlock() return False
def stop_hbbtv_application(self): #print "=========== stop_hbbtv_application ================" self._close_timer.stop() self._close_timer = None vbcfg.g_main._timer_update_video_size.stop() try: if self._cb_set_title in vbcfg.g_main.vbhandler.onSetTitleCB: vbcfg.g_main.vbhandler.onSetTitleCB.remove(self._cb_set_title) except Exception: pass try: if self._cb_close_window in vbcfg.g_main.vbhandler.onCloseCB: vbcfg.g_main.vbhandler.onCloseCB.remove(self._cb_close_window) except Exception: pass from enigma import getDesktop, gMainDC dsk = getDesktop(0) desktop_size = dsk.size() gMainDC.getInstance().setResolution(desktop_size.width(), desktop_size.height()) #print "========= stop_hbbtv_application:: g_position: ", vbcfg.g_position, " ===================" vbcfg.setvmpegPosition(vbcfg.g_vmpegposition) vbcfg.setPosition(vbcfg.g_position) vbcfg.osd_unlock() dsk.paint() if getMachineBuild() not in ('dags7252'): vbcfg.set_bgcolor("0") vbcfg.DEBUG("Stop HbbTV") os.system("run.sh stop") if getMachineBuild() in ('dags7252'): cur_channel = self.servicelist.getCurrentSelection() cur_channel = cur_channel.toString() self.session.nav.playService(eServiceReference(cur_channel)) self.close()
def command(opcodestr, data=""): cmd_fd = None vbcfg.DEBUG("send ipc: [%s]" % opcodestr) try: send_data = VBController.assamble(opcodestr, data) if not os.path.exists(vbcfg.CONTROLFILE): raise Exception("no found controller file.") cmd_fd = os.open(vbcfg.CONTROLFILE, os.O_WRONLY) if cmd_fd is None: raise Exception("fail to open controller file.") os.write(cmd_fd, send_data) except Exception as err: vbcfg.ERR("VBHController: %s" % err) vbcfg.setPosition(vbcfg.g_position) fbClass.getInstance().unlock() eRCInput.getInstance().unlock() return False finally: if cmd_fd is not None: os.close(cmd_fd) return True
def __init__(self, session, _mode, _type, _data, _bm): self.mMode = _mode self.mType = _type self.mData = _data self.mSession = session self.mBookmarkManager = _bm if _data is not None: vbcfg.DEBUG("0x%x" % _data.mId) Screen.__init__(self, session) self.menulist = [] ConfigListScreen.__init__(self, self.menulist) self["actions"] = ActionMap( [ "OkCancelActions", "ColorActions", ], { "ok": self.keyGreen, "green": self.keyGreen, "red": self.keyRed, "cancel": self.keyRed, }, -2) self["VKeyIcon"] = Boolean(False) self["key_red"] = StaticText(_("Cancel")) self["key_green"] = StaticText(_("Save")) self.menuItemTitle = None self.menuItemUrl = None self.menuItemName = None self.menuEntryName = None self.menuEntryTitle = None self.menuEntryUrl = None self.makeConfigList() self.onLayoutFinish.append(self.layoutFinished)
def stop_hbbtv_application(self): #print "=========== stop_hbbtv_application ================" self._close_timer.stop() self._close_timer = None vbcfg.g_main._timer_update_video_size.stop() try: if self._cb_set_title in vbcfg.g_main.vbhandler.onSetTitleCB: vbcfg.g_main.vbhandler.onSetTitleCB.remove(self._cb_set_title) except Exception: pass try: if self._cb_close_window in vbcfg.g_main.vbhandler.onCloseCB: vbcfg.g_main.vbhandler.onCloseCB.remove(self._cb_close_window) except Exception: pass from enigma import getDesktop, gMainDC dsk = getDesktop(0) desktop_size = dsk.size() gMainDC.getInstance().setResolution(desktop_size.width(), desktop_size.height()) #print "========= stop_hbbtv_application:: g_position: ", vbcfg.g_position, " ===================" vbcfg.setPosition(vbcfg.g_position) vbcfg.osd_unlock() dsk.paint() vbcfg.set_bgcolor("0") vbcfg.DEBUG("Stop HbbTV") os.system("run.sh stop") self.close()
def GetHandler(opcode): for key, value in _OPCODE.items(): if value[0] == opcode: vbcfg.DEBUG("recv socket: [%s]" % key) return value[1] return None
def _cb_info_updated(self): vbcfg.g_service = self.session.nav.getCurrentlyPlayingServiceReference( ) vbcfg.DEBUG("updated channel info")
def _cb_ait_detected(self): vbcfg.g_channel_info = None self._applicationList = None self._app_info = self.get_autostart_application() vbcfg.DEBUG("detected AIT")
def _cb_set_title(self, title=None): vbcfg.DEBUG("pate title: %s" % title) if title is None: return self.setTitle(title)