def prepareJson(self, channelItems): utils.log('prepareJson') try: channelItems.sort( key=lambda x: x['channelnumber'] ) #todo user option sort by chnum or chname or backend default if self.incHDHR == True: HDHRitems = (list(utils.HDHR().getChannelItems()) or []) HDHRitems.sort( key=lambda x: x['channelnumber'] ) #todo user option sort by chnum or chname or backend default if len(HDHRitems) == 0: utils.okDialog(utils.LANGUAGE(30013), utils.LANGUAGE(30014), utils.LANGUAGE(30015) % (self.pluginName)) else: channelItems.extend(HDHRitems) if self.validateChannels(channelItems) == True: self.setupChannelList(channelItems) return True except Exception as e: utils.log("prepareJson, failed! " + str(e), xbmc.LOGERROR) utils.notificationDialog(utils.LANGUAGE(30002) % (self.pluginName, self.pluginAuthor), icon=self.pluginIcon) return False
def prepareJson(self, channelItems): utils.log('prepareJson') try: channelItems.sort(key=lambda x: x['channelnumber']) if self.validateChannels(channelItems) == True: self.setupChannelList(channelItems) return True except Exception as e: utils.log("prepareJson, failed! " + str(e), xbmc.LOGERROR) utils.notificationDialog(utils.LANGUAGE(30002) % (self.pluginName, self.pluginAuthor), icon=self.pluginIcon) return False
def onInit(self): utils.log('onInit') utils.setProperty('uEPGRunning','True') self.closeCount = 0 curtime = time.time() self.lastActTime = time.time() self.windowID = self.getWindowID() self.windowIDS = ["ActivateWindow(fullscreenvideo)","ActivateWindow(%s)"%self.windowID] self.windowToggle = itertools.cycle(self.windowIDS).next if self.onInitReturn == False: utils.log('onInit, onInitReturn = False') self.guideLimit = 14400 self.rowCount = self.chkRows(self.rowCount) self.epgButtonwidth = float((utils.getProperty("uEPG.buttonWidth")) or "5400.0") self.timeCount = int((utils.getProperty("uEPG.timeCount")) or "3") self.textColor = hex(int((utils.getProperty("uEPG.textColor") or "0xFFFFFFFF"),16))[2:] self.disabledColor = hex(int((utils.getProperty("uEPG.disabledColor") or "0xFFFFFFFF"),16))[2:] self.focusedColor = hex(int((utils.getProperty("uEPG.focusedColor") or "0xFFFFFFFF"),16))[2:] self.shadowColor = hex(int((utils.getProperty("uEPG.shadowColor") or "0xFF000000"),16))[2:] self.pastColor = hex(int((utils.getProperty("uEPG.pastColor") or "0xFF0f85a5"),16))[2:] self.timeColor = hex(int((utils.getProperty("uEPG.timeColor") or "0xFF0f85a5"),16))[2:] self.futureColor = hex(int((utils.getProperty("uEPG.futureColor") or "0xFF0f85a5"),16))[2:] self.singleLineFade = (utils.getProperty("uEPG.singleLineFade") or "false") == "true" self.textFont = (utils.getProperty("uEPG.timeCount") or "font12") self.timeFormat = (urllib.unquote(utils.getProperty("uEPG.timeFormat")) or "%A, %B %d") self.clockMode = int(utils.REAL_SETTINGS.getSetting("ClockMode")) self.channelButtons = [None] * self.rowCount for i in range(self.rowCount): self.channelButtons[i] = [] try: self.removeControl(self.fadePast) self.removeControl(self.currentTimeBar) except: pass self.focusChannel = self.getControl(33009) self.currentHighLT = self.getControl(33010) self.currentTime = self.getControl(33007) timetx, timety = self.currentTime.getPosition() timetw = self.currentTime.getWidth() timeth = self.currentTime.getHeight() self.currentLine = self.getControl(33013) timex, timey = self.currentLine.getPosition() timew = self.currentLine.getWidth() timeh = self.currentLine.getHeight() self.timeButtonBar = os.path.join(self.channelLST.mediaFolder,utils.TIME_BAR) self.currentTimeBar = xbmcgui.ControlImage(timex, timey, timew, timeh, self.timeButtonBar, colorDiffuse=self.timeColor) self.addControl(self.currentTimeBar) self.pastLine = self.getControl(33011) timex, timey = self.pastLine.getPosition() timew = self.pastLine.getWidth() timeh = self.pastLine.getHeight() self.pastTime = os.path.join(self.channelLST.mediaFolder,utils.PAST_FADE) self.fadePast = xbmcgui.ControlImage(timex, timey, timew, timeh, self.pastTime, colorDiffuse=self.pastColor) self.addControl(self.fadePast) self.futureLine = self.getControl(33012) timex, timey = self.futureLine.getPosition() timew = self.futureLine.getWidth() timeh = self.futureLine.getHeight() self.futureTime = os.path.join(self.channelLST.mediaFolder,utils.FUTURE_FADE) self.fadeFuture = xbmcgui.ControlImage(timex, timey, timew, timeh, self.futureTime, colorDiffuse=self.futureColor) self.addControl(self.fadeFuture) self.TimeXYW = {} for i in range(self.timeCount): self.TimeXYW['Time%dX'%(i + 1)] = self.getControl(33101 + i).getPosition()[0] self.TimeXYW['Time%dY'%(i + 1)] = self.getControl(33101 + i).getPosition()[1] self.TimeXYW['Time%dW'%(i + 1)] = int(round(self.getControl(33101 + i).getWidth()//2)) self.TimeRange = {} for i in range(self.timeCount): self.TimeRange['Time%dRange'%(i + 1)] = range(self.TimeXYW['Time%dX'%(i + 1)] - self.TimeXYW['Time%dW'%(i + 1)],self.TimeXYW['Time%dX'%(i + 1)] + self.TimeXYW['Time%dW'%(i + 1)]) if self.setChannelButtons(curtime, self.fixChannel(self.currentChannel)) == False: utils.log('Unable to add channel buttons') utils.notificationDialog("%s Error, Contact %s for support"%(self.channelLST.pluginName, self.channelLST.pluginAuthor)) self.closeUEPG() self.setChannelButtons(curtime, self.fixChannel(self.currentChannel)) basex, basey = self.getControl(33611 + self.focusRow).getPosition() basew = self.getControl(33611 + self.focusRow).getWidth() for i in range(len(self.channelButtons[self.focusRow])): left, top = self.channelButtons[self.focusRow][i].getPosition() width = self.channelButtons[self.focusRow][i].getWidth() left = left - basex starttime = self.shownTime + (left / (basew / self.epgButtonwidth)) endtime = starttime + (width / (basew / self.epgButtonwidth)) if curtime >= starttime and curtime <= endtime: utils.log('curtime focusIndex = %s'%i) self.focusIndex = i self.setFocus(self.channelButtons[self.focusRow][i]) self.focusTime = int(curtime) self.focusEndTime = endtime break if self.focusIndex == -1: self.focusIndex = 0 self.setFocus(self.channelButtons[self.focusRow][self.focusIndex]) left, top = self.channelButtons[self.focusRow][self.focusIndex].getPosition() width = self.channelButtons[self.focusRow][self.focusIndex].getWidth() left = left - basex starttime = self.shownTime + (left / (basew / self.epgButtonwidth)) endtime = starttime + (width / (basew / self.epgButtonwidth)) self.focusTime = int(starttime + 30) self.focusEndTime = endtime self.setProperButton(0) self.setShowInfo() self.onInitReturn = True utils.log('onInit return')
def refresh(self): utils.log('refresh, triggering refreshTimer') utils.notificationDialog(utils.LANGUAGE(30003), icon=self.pluginIame) xbmc.executebuiltin("RunPlugin(%s)" % self.refreshPath)
channelLST.skinPath, 'default') channelLST.myEPG.channelLST = channelLST channelLST.myEPG.doModal() del channelLST.myEPG xbmc.sleep(100) else: utils.log("invalid uEPG information", xbmc.LOGERROR) # utils.notificationDialog(utils.LANGUAGE(30002)%(channelLST.pluginName,channelLST.pluginAuthor),icon=channelLST.pluginIcon) # utils.REAL_SETTINGS.openSettings() del utils.KODI_MONITOR if __name__ == '__main__': with busy_dialog(): try: params = dict(arg.split('=') for arg in sys.argv[1].split('&')) except: params = {} data = dataType = None for type in ['json', 'property', 'listitem']: try: data = params[type] dataType = type break except: utils.notificationDialog( utils.LANGUAGE(30002) % (utils.ADDON_NAME, utils.ADDON_AUTHOR), icon=utils.ICON) utils.log('__main__, params = ' + str(params)) if data is not None: initChannels(params, data, dataType)
if utils.REAL_SETTINGS.getSetting('FirstTime_Run') == "true": utils.REAL_SETTINGS.setSetting('FirstTime_Run', 'false') utils.textViewer( utils.LANGUAGE(30008), '%s / %s' % (utils.ADDON_NAME, channelLST.pluginName)) if utils.getProperty('uEPGSplash') == 'True': mySplash.close() del mySplash xbmc.sleep(100) if hasChannels == True: if channelLST.refreshIntvl > 0 and channelLST.refreshPath is not None: channelLST.startRefreshTimer() if channelLST.uEPGRunning == False and utils.getProperty( 'uEPGGuide') != 'True': channelLST.myEPG = epg.uEPG('%s.guide.xml' % utils.ADDON_ID, channelLST.skinPath, 'default') channelLST.myEPG.channelLST = channelLST channelLST.myEPG.doModal() del channelLST.myEPG xbmc.sleep(100) else: utils.log("invalid uEPG information", xbmc.LOGERROR) utils.notificationDialog( utils.LANGUAGE(30002) % (channelLST.pluginName, channelLST.pluginAuthor), icon=channelLST.pluginIcon) del utils.KODI_MONITOR