def P_epgnownext(self, request): res = self.testMandatoryArguments(request, ["bRef"]) if res: return res info = getCurrentService(self.session) ret = getBouquetNowNextEpg(request.args["bRef"][0], -1, self.isJson) ret["info"]=info return ret
def P_getpid(self, request): request.setHeader("content-type", "text/html") info = getCurrentService(self.session) return { "ppid": "%x" % info["pmtpid"], "vpid": "%x" % info["vpid"], "apid": "%x" % info["apid"], "host": request.getRequestHostname() }
def P_epgnownext(self, request): res = self.testMandatoryArguments(request, ["bRef"]) if res: return res self.isGZ=True info = getCurrentService(self.session) ret = getBouquetNowNextEpg(request.args["bRef"][0], -1) ret["info"]=info return ret
def P_getcurrent(self, request): info = getCurrentService(self.session) now = getNowNextEpg(info["ref"], 0) if len(now["events"]) > 0: now = now["events"][0] now["provider"] = info["provider"] else: now = { "id": 0, "begin_timestamp": 0, "duration_sec": 0, "title": "", "shortdesc": "", "longdesc": "", "sref": "", "sname": "", "now_timestamp": 0, "remaining": 0, "provider": "" } next = getNowNextEpg(info["ref"], 1) if len(next["events"]) > 0: next = next["events"][0] next["provider"] = info["provider"] else: next = { "id": 0, "begin_timestamp": 0, "duration_sec": 0, "title": "", "shortdesc": "", "longdesc": "", "sref": "", "sname": "", "now_timestamp": 0, "remaining": 0, "provider": "" } # replace EPG NOW with Movie info mnow = now if mnow["sref"].startswith('1:0:0:0:0:0:0:0:0:0:/'): try: service = self.session.nav.getCurrentService() minfo = service and service.info() movie = minfo and minfo.getEvent(0) if movie and minfo: mnow["title"] = movie.getEventName() mnow["shortdesc"] = movie.getShortDescription() mnow["longdesc"] = movie.getExtendedDescription() mnow["begin_timestamp"] = movie.getBeginTime() mnow["duration_sec"] = movie.getDuration() mnow["remaining"] = movie.getDuration() mnow["id"] = movie.getEventId() except Exception, e: mnow = now
def P_epgnownext(self, request): res = self.testMandatoryArguments(request, ["bRef"]) if res: return res info = getCurrentService(self.session) ret = getBouquetNowNextEpg(request.args["bRef"][0], -1) #now = getNowNextEpg(info["ref"], 0) #if len(now["events"]) > 0: # ret["now"] = now["events"][0] #next = getNowNextEpg(info["ref"], 1) #if len(next["events"]) > 0: # ret["next"] = next["events"][0] ret["info"]=info return ret
def P_epgnownext(self, request): res = self.testMandatoryArguments(request, ["bRef"]) if res: return res info = getCurrentService(self.session) ret = getBouquetNowNextEpg(request.args["bRef"][0], -1) #now = getNowNextEpg(info["ref"], 0) #if len(now["events"]) > 0: # ret["now"] = now["events"][0] #next = getNowNextEpg(info["ref"], 1) #if len(next["events"]) > 0: # ret["next"] = next["events"][0] ret["info"] = info return ret
def P_getcurrent(self, request): info = getCurrentService(self.session) now = getNowNextEpg(info["ref"], 0) if len(now["events"]) > 0: now = now["events"][0] now["provider"] = info["provider"] else: now = { "id": 0, "begin_timestamp": 0, "duration_sec": 0, "title": "", "shortdesc": "", "longdesc": "", "sref": "", "sname": "", "now_timestamp": 0, "remaining": 0, "provider": "" } next = getNowNextEpg(info["ref"], 1) if len(next["events"]) > 0: next = next["events"][0] next["provider"] = info["provider"] else: next = { "id": 0, "begin_timestamp": 0, "duration_sec": 0, "title": "", "shortdesc": "", "longdesc": "", "sref": "", "sname": "", "now_timestamp": 0, "remaining": 0, "provider": "" } return { "info": info, "now": now, "next": next }
def P_about(self, request): return { "info": getInfo(), "service": getCurrentService(self.session) }
def P_about(self, request): return { "info": getInfo(self.session, need_fullinfo=True), "service": getCurrentService(self.session) }
def getCurrentFullInfo(session): now = next = {} inf = getCurrentService(session) inf['tuners'] = list(map(chr, range(65, 65 + nimmanager.getSlotCount()))) try: info = session.nav.getCurrentService().info() except BaseException: info = None try: subservices = session.nav.getCurrentService().subServices() except BaseException: subservices = None try: audio = session.nav.getCurrentService().audioTracks() except BaseException: audio = None try: ref = session.nav.getCurrentlyPlayingServiceReference().toString() except BaseException: ref = None if ref is not None: inf['sref'] = '_'.join(ref.split(':', 10)[:10]) inf['srefv2'] = ref inf['picon'] = getPicon(ref) inf['wide'] = inf['aspect'] in (3, 4, 7, 8, 0xB, 0xC, 0xF, 0x10) inf['ttext'] = getServiceInfoString(info, iServiceInformation.sTXTPID) inf['crypt'] = getServiceInfoString( info, iServiceInformation.sIsCrypted) inf['subs'] = str( subservices and subservices.getNumberOfSubservices() > 0) else: inf['sref'] = None inf['picon'] = None inf['wide'] = None inf['ttext'] = None inf['crypt'] = None inf['subs'] = None inf['date'] = strftime("%d.%m.%Y", (localtime())) inf['dolby'] = False if audio: n = audio.getNumberOfTracks() idx = 0 while idx < n: i = audio.getTrackInfo(idx) description = i.getDescription() if "AC3" in description \ or "DTS" in description \ or "Dolby Digital" in description: inf['dolby'] = True idx += 1 try: feinfo = session.nav.getCurrentService().frontendInfo() except BaseException: feinfo = None frontendData = feinfo and feinfo.getAll(True) if frontendData is not None: cur_info = feinfo.getTransponderData(True) inf['tunertype'] = frontendData.get("tuner_type", "UNKNOWN") if frontendData.get("system", -1) == 1: inf['tunertype'] = "DVB-S2" inf['tunernumber'] = frontendData.get("tuner_number") orb = getOrbitalText(cur_info) inf['orbital_position'] = orb if cur_info: if cur_info.get('tuner_type') == "DVB-S": inf['orbital_position'] = _("Orbital Position") + ': ' + orb else: inf['tunernumber'] = "N/A" inf['tunertype'] = "N/A" try: frontendStatus = feinfo and feinfo.getFrontendStatus() except BaseException: frontendStatus = None if frontendStatus is not None: percent = frontendStatus.get("tuner_signal_quality") if percent is not None: inf['snr'] = int(percent * 100 / 65535) inf['snr_db'] = inf['snr'] percent = frontendStatus.get("tuner_signal_quality_db") if percent is not None: inf['snr_db'] = "%3.02f dB" % (percent / 100.0) percent = frontendStatus.get("tuner_signal_power") if percent is not None: inf['agc'] = int(percent * 100 / 65535) percent = frontendStatus.get("tuner_bit_error_rate") if percent is not None: inf['ber'] = int(percent * 100 / 65535) else: inf['snr'] = 0 inf['snr_db'] = inf['snr'] inf['agc'] = 0 inf['ber'] = 0 try: recordings = session.nav.getRecordings() except BaseException: recordings = None inf['rec_state'] = False if recordings: inf['rec_state'] = True ev = getChannelEpg(ref) if len(ev['events']) > 1: now = ev['events'][0] next = ev['events'][1] if len(now['title']) > 50: now['title'] = now['title'][0:48] + "..." if len(next['title']) > 50: next['title'] = next['title'][0:48] + "..." return {"info": inf, "now": now, "next": next}
def P_about(self, request): return { "info": getInfo(need_fullinfo=True), "service": getCurrentService(self.session) }