Beispiel #1
0
 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
Beispiel #2
0
def initChannels(params, data, dataType):
    utils.log('initChannels, params = ' + str(params))
    with busy_dialog():
        hasChannels = False
        channelLST = ChannelList()
        channelLST.incHDHR = (
            params.get('include_hdhr', '')
            or utils.REAL_SETTINGS.getSetting('Enable_HDHR')) == 'true'
        channelLST.skinPath = (utils.unquote(params.get('skin_path', ''))
                               or channelLST.chkSkinPath())
        channelLST.mediaFolder = os.path.join(channelLST.skinPath, 'resources',
                                              'skins', 'default', 'media')
        channelLST.refreshPath = (utils.unquote(params.get('refresh_path', ''))
                                  or utils.ADDON_ID)
        channelLST.refreshIntvl = int(
            params.get('refresh_interval', '') or '0')
        channelLST.skinFolder = os.path.join(
            channelLST.skinPath,
            'resources',
            'skins',
            'default',
            '1080i',
        ) if xbmcvfs.exists(
            os.path.join(channelLST.skinPath, 'resources', 'skins', 'default',
                         '1080i', '%s.guide.xml' %
                         utils.ADDON_ID)) else os.path.join(
                             channelLST.skinPath, 'resources', 'skins',
                             'default', '720p')
        utils.setProperty('uEPG.rowCount',
                          (params.get('row_count', '') or '9'))
        channelLST.pluginName, channelLST.pluginAuthor, channelLST.pluginIcon, channelLST.pluginFanart, channelLST.pluginPath = utils.getPluginMeta(
            channelLST.refreshPath)

        utils.log('dataType = ' + str(dataType))
        utils.log('skinPath = ' + str(channelLST.skinPath))
        utils.log('skinFolder = ' + str(channelLST.skinFolder))
        utils.log('rowCount = ' + utils.getProperty('uEPG.rowCount'))
        utils.log('refreshPath = ' + str(channelLST.refreshPath))
        utils.log('refreshIntvl = ' + str(channelLST.refreshIntvl))
        utils.setProperty('PluginName', channelLST.pluginName)
        utils.setProperty('PluginIcon', channelLST.pluginIcon)
        utils.setProperty('PluginFanart', channelLST.pluginFanart)
        utils.setProperty('PluginAuthor', channelLST.pluginAuthor)
        utils.setProperty('pluginPath', channelLST.pluginPath)

        #show optional load screen
        # if channelLST.uEPGRunning == False and utils.getProperty('uEPGSplash') != 'True' and xbmcvfs.exists(os.path.join(channelLST.skinFolder,'%s.splash.xml'%utils.ADDON_ID)) == True:
        # mySplash   = epg.Splash('%s.splash.xml'%utils.ADDON_ID,channelLST.skinPath,'default')
        # mySplash.show()
        # xbmc.sleep(100)

        if utils.HDHR().hasHDHR():
            if utils.REAL_SETTINGS.getSetting(
                    'FirstTime_HDHR') == "true" and not channelLST.incHDHR:
                utils.REAL_SETTINGS.setSetting('FirstTime_HDHR', 'false')
                if utils.yesnoDialog(
                    (utils.LANGUAGE(30012) % (channelLST.pluginName)),
                        custom='Later'):
                    utils.REAL_SETTINGS.setSetting('Enable_HDHR', 'true')
                    channelLST.incHDHR = True
        utils.log('incHDHR = ' + str(channelLST.incHDHR))

    if dataType == 'wrap': hasChannels = channelLST.prepareJson(data)
    elif dataType == 'json':
        hasChannels = channelLST.prepareJson(
            utils.loadJson(utils.unquote(data)))
    elif dataType == 'property':
        hasChannels = channelLST.prepareJson(
            utils.loadJson(utils.unquote(utils.getProperty(data))))
    elif dataType == 'listitem':
        hasChannels = channelLST.prepareVFS(utils.unquote(data))

    if hasChannels == True:
        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 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)
        # utils.REAL_SETTINGS.openSettings()
    del utils.KODI_MONITOR
Beispiel #3
0
        utils.setProperty('PluginIcon', channelLST.pluginIcon)
        utils.setProperty('PluginFanart', channelLST.pluginFanart)
        utils.setProperty('PluginAuthor', channelLST.pluginAuthor)

        #show optional load screen
        if channelLST.uEPGRunning == False and utils.getProperty(
                'uEPGSplash') != 'True' and xbmcvfs.exists(
                    os.path.join(channelLST.skinFolder,
                                 '%s.splash.xml' % utils.ADDON_ID)) == True:
            mySplash = epg.Splash('%s.splash.xml' % utils.ADDON_ID,
                                  channelLST.skinPath, 'default')
            mySplash.show()
            xbmc.sleep(100)

        firstHDHR = utils.REAL_SETTINGS.getSetting('FirstTime_HDHR') == "true"
        if utils.HDHR().hasHDHR() and firstHDHR and not channelLST.incHDHR:
            utils.REAL_SETTINGS.setSetting('FirstTime_HDHR', 'false')
            if utils.yesnoDialog(
                (utils.LANGUAGE(30012) % (channelLST.pluginName)),
                    custom='Later'):
                utils.REAL_SETTINGS.setSetting('Enable_HDHR', 'true')
                channelLST.incHDHR = True

        if dataType == 'json':
            hasChannels = channelLST.prepareJson(
                utils.loadJson(utils.unquote(data)))
        elif dataType == 'property':
            hasChannels = channelLST.prepareJson(
                utils.loadJson(utils.unquote(utils.getProperty(data))))
        elif dataType == 'listitem':
            hasChannels = channelLST.prepareListItem(utils.unquote(data))