当前位置: 首页>>代码示例>>Python>>正文


Python ChannelList.setupChannel方法代码示例

本文整理汇总了Python中ChannelList.ChannelList.setupChannel方法的典型用法代码示例。如果您正苦于以下问题:Python ChannelList.setupChannel方法的具体用法?Python ChannelList.setupChannel怎么用?Python ChannelList.setupChannel使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ChannelList.ChannelList的用法示例。


在下文中一共展示了ChannelList.setupChannel方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: ChannelListThread

# 需要导入模块: from ChannelList import ChannelList [as 别名]
# 或者: from ChannelList.ChannelList import setupChannel [as 别名]
class ChannelListThread(threading.Thread):
    def __init__(self):
        threading.Thread.__init__(self)
        self.myOverlay = None
        sys.setcheckinterval(25)
        self.chanlist = ChannelList()
        self.paused = False
        self.fullUpdating = True

        
    def log(self, msg, level = xbmc.LOGDEBUG):
        log('ChannelListThread: ' + msg, level)


    def run(self):
        self.log("Starting")
        self.chanlist.exitThread = False
        self.chanlist.readConfig()
        self.chanlist.sleepTime = 1

        if self.myOverlay == None:
            self.log("Overlay not defined. Exiting.")
            return
            
        self.chanlist.myOverlay = self.myOverlay
        self.fullUpdating = (self.myOverlay.backgroundUpdating == 0)
        validchannels = 0

        for i in range(self.myOverlay.maxChannels):
            self.chanlist.channels.append(Channel())

            if self.myOverlay.channels[i].isValid:
                validchannels += 1
                
        # Don't load invalid channels if minimum threading mode is on
        if self.fullUpdating and self.myOverlay.isMaster:
            if validchannels < self.chanlist.enteredChannelCount:
                title = 'PseudoTV Live, Background Loading...'
                xbmc.executebuiltin('XBMC.Notification(%s, %s, %s)' % (title, 4000 , THUMB))

            for i in range(self.myOverlay.maxChannels):
                if self.myOverlay.channels[i].isValid == False:
                    while True:
                        if self.myOverlay.isExiting:
                            self.log("Closing thread")
                            return

                        time.sleep(1)

                        if self.paused == False:
                            break

                    self.chanlist.channels[i].setAccessTime(self.myOverlay.channels[i].lastAccessTime)

                    try:
                        if self.chanlist.setupChannel(i + 1, True, True, False) == True:
                            while self.paused:
                                if self.myOverlay.isExiting:
                                    self.log("IsExiting")
                                    return

                                time.sleep(1)

                            self.myOverlay.channels[i] = self.chanlist.channels[i]

                            if self.myOverlay.channels[i].isValid == True:
                                title = "PseudoTV Live, Channel " + str(i + 1) + " Added"
                                xbmc.executebuiltin('XBMC.Notification(%s, %s, %s)' % (title, 4000, THUMB))
                                
                    except Exception,e:
                        self.log("Unknown Channel Creation Exception", xbmc.LOGERROR)
                        self.log(traceback.format_exc(), xbmc.LOGERROR)
                        return

        REAL_SETTINGS.setSetting('ForceChannelReset', 'false')
        self.chanlist.sleepTime = 3
        InfoTimer = INFOBAR_TIMER[int(REAL_SETTINGS.getSetting('InfoTimer'))]
        self.myOverlay.ArtServiceThread = threading.Timer(float(InfoTimer), self.myOverlay.ArtService)
        self.myOverlay.ArtServiceThread.name = "ArtServiceThread"
        self.myOverlay.ArtServiceThread.start()

        if REAL_SETTINGS.getSetting("EnableSettop") == "true":
            self.log('onInit, Settop Enabled')
            self.myOverlay.channelThread_Timer = threading.Timer(float(SETTOP_REFRESH), self.myOverlay.Settop)
            self.myOverlay.channelThread_Timer.name = "channelThread_Timer"
            self.myOverlay.channelThread_Timer.start() 
            
        while True:
            for i in range(self.myOverlay.maxChannels):
                modified = True

                while modified == True and self.myOverlay.channels[i].getTotalDuration() < PREP_CHANNEL_TIME and self.myOverlay.channels[i].Playlist.size() < 16288:
                    # If minimum updating is on, don't attempt to load invalid channels
                    if self.fullUpdating == False and self.myOverlay.channels[i].isValid == False and self.myOverlay.isMaster:
                        break

                    modified = False

                    if self.myOverlay.isExiting:
                        self.log("Closing thread")
#.........这里部分代码省略.........
开发者ID:jonubuu,项目名称:script.pseudotv.live,代码行数:103,代码来源:ChannelListThread.py

示例2: ChannelListThread

# 需要导入模块: from ChannelList import ChannelList [as 别名]
# 或者: from ChannelList.ChannelList import setupChannel [as 别名]
class ChannelListThread(threading.Thread):
    def __init__(self):
        threading.Thread.__init__(self)
        self.myOverlay = None
        sys.setcheckinterval(25)
        self.chanlist = ChannelList()
        self.paused = False
        self.fullUpdating = True
        
        
    def log(self, msg, level = xbmc.LOGDEBUG):
        log('ChannelListThread: ' + msg, level)


    def run(self):
        self.log("Starting")
        self.chanlist.exitThread = False
        self.chanlist.readConfig()
        self.chanlist.sleepTime = 0.1
        
        if self.myOverlay == None:
            self.log("Overlay not defined. Exiting.")
            return
            
        self.chanlist.myOverlay = self.myOverlay
        self.fullUpdating = (self.myOverlay.backgroundUpdating == 0)
        validchannels = 0

        for i in range(self.myOverlay.maxChannels):
            self.chanlist.channels.append(Channel())

            if self.myOverlay.channels[i].isValid:
                validchannels += 1
                
        # Don't load invalid channels if minimum threading mode is on
        if self.fullUpdating and self.myOverlay.isMaster:
            if validchannels < self.chanlist.enteredChannelCount:
                OptNotify("Background Loading...")
                setProperty("PTVL.BackgroundLoading","true")  

            for i in range(self.myOverlay.maxChannels):
                if self.myOverlay.channels[i].isValid == False:
                    while not KODI_MONITOR.abortRequested():
                        if self.myOverlay.isExiting:
                            self.log("Closing thread")
                            return
                        time.sleep(1)
                        
                        if self.paused == False:
                            break

                    self.chanlist.channels[i].setAccessTime(self.myOverlay.channels[i].lastAccessTime)

                    try:
                        if self.chanlist.setupChannel(i + 1, True, True, False) == True:
                            while self.paused:
                                if self.myOverlay.isExiting:
                                    self.log("IsExiting")
                                    return
                                time.sleep(1)
                                
                            self.myOverlay.channels[i] = self.chanlist.channels[i]
                            if self.myOverlay.channels[i].isValid == True:
                                OptNotify("Channel " + str(i + 1) + " Added", icon=self.myOverlay.getChlogo(i + 1))  
                    except Exception,e:
                        self.log("Unknown Channel Creation Exception", xbmc.LOGERROR)
                        self.log(traceback.format_exc(), xbmc.LOGERROR)
                        return
                    time.sleep(2)
                
        self.chanlist.sleepTime = 0.3
        REAL_SETTINGS.setSetting('ForceChannelReset', 'false')
        self.myOverlay.postBackgroundLoading()
                 
        while not KODI_MONITOR.abortRequested():      
            OptNotify("Background Updating...")   
            setProperty("PTVL.BackgroundLoading","true")                   
            self.myOverlay.setCurrentChannel()
            for i in range(self.myOverlay.maxChannels):
                modified = True
                while modified == True and self.myOverlay.channels[i].getTotalDuration() < PREP_CHANNEL_TIME and self.myOverlay.channels[i].Playlist.size() < self.chanlist.Playlist_Limit:
                    # If minimum updating is on, don't attempt to load invalid channels
                    if self.fullUpdating == False and self.myOverlay.channels[i].isValid == False and self.myOverlay.isMaster:
                        break        
                    modified = False
                    
                    if self.myOverlay.isExiting:
                        self.log("Closing thread")
                        return 
                    time.sleep(2)

                    curtotal = self.myOverlay.channels[i].getTotalDuration()
                    chtype = self.myOverlay.getChtype(i + 1)
                    if self.myOverlay.isMaster:
                        if chtype != 9999:
                            if curtotal > 0 and chtype not in FORCE_MAKENEW:
                                # if curtotal > 0 and chtype not in FORCE_MAKENEW:
                                # When appending, many of the channel variables aren't set, so copy them over.
                                # This needs to be done before setup since a rule may use one of the values.
                                # It also needs to be done after since one of them may have changed while being setup.
#.........这里部分代码省略.........
开发者ID:PseudoTV,项目名称:PseudoTV_Live,代码行数:103,代码来源:ChannelListThread.py

示例3: ChannelListThread

# 需要导入模块: from ChannelList import ChannelList [as 别名]
# 或者: from ChannelList.ChannelList import setupChannel [as 别名]
class ChannelListThread(threading.Thread):
    def __init__(self):
        threading.Thread.__init__(self)
        self.myOverlay = None
        sys.setcheckinterval(25)
        self.chanlist = ChannelList()
        self.paused = False
        self.fullUpdating = True


    def log(self, msg, level = xbmc.LOGDEBUG):
        log('ChannelListThread: ' + msg, level)


    def run(self):
        self.log("Starting")
        self.chanlist.exitThread = False
        self.chanlist.readConfig()
        self.chanlist.sleepTime = 0.1

        if self.myOverlay == None:
            self.log("Overlay not defined. Exiting.")
            return
            
        self.chanlist.myOverlay = self.myOverlay
        self.fullUpdating = (self.myOverlay.backgroundUpdating == 0)
        validchannels = 0

        for i in range(self.myOverlay.maxChannels):
            self.chanlist.channels.append(Channel())

            if self.myOverlay.channels[i].isValid:
                validchannels += 1

        # Don't load invalid channels if minimum threading mode is on
        if self.fullUpdating and self.myOverlay.isMaster:
            if validchannels < self.chanlist.enteredChannelCount:
                xbmc.executebuiltin("Notification( %s, %s, %d, %s)" % ( REAL_SETTINGS.getAddonInfo('name'), REAL_SETTINGS.getLocalizedString(30024), 4000, __icon__) )

            for i in range(self.myOverlay.maxChannels):
                if self.myOverlay.channels[i].isValid == False:
                    while True:
                        if self.myOverlay.isExiting:
                            self.log("Closing thread")
                            return

                        time.sleep(1)

                        if self.paused == False:
                            break

                    self.chanlist.channels[i].setAccessTime(self.myOverlay.channels[i].lastAccessTime)

                    try:
                        if self.chanlist.setupChannel(i + 1, True, True, False) == True:
                            while self.paused:
                                if self.myOverlay.isExiting:
                                    self.log("IsExiting")
                                    return

                                time.sleep(1)

                            self.myOverlay.channels[i] = self.chanlist.channels[i]

                            if self.myOverlay.channels[i].isValid == True:
                                xbmc.executebuiltin("Notification( %s, %s, %d, %s)" % ( REAL_SETTINGS.getAddonInfo('name'), xbmc.getLocalizedString(19029) + ' ' + str(i + 1) + ' ' + REAL_SETTINGS.getLocalizedString(30025), 4000, __icon__) )
                    except:
                        self.log("Unknown Channel Creation Exception", xbmc.LOGERROR)
                        self.log(traceback.format_exc(), xbmc.LOGERROR)
                        return

        REAL_SETTINGS.setSetting('ForceChannelReset', 'false')
        self.chanlist.sleepTime = 0.3

        while True:
            for i in range(self.myOverlay.maxChannels):
                modified = True

                while modified == True and self.myOverlay.channels[i].getTotalDuration() < PREP_CHANNEL_TIME and self.myOverlay.channels[i].Playlist.size() < 16288:
                    # If minimum updating is on, don't attempt to load invalid channels
                    if self.fullUpdating == False and self.myOverlay.channels[i].isValid == False and self.myOverlay.isMaster:
                        break

                    modified = False

                    if self.myOverlay.isExiting:
                        self.log("Closing thread")
                        return

                    time.sleep(2)
                    curtotal = self.myOverlay.channels[i].getTotalDuration()

                    if self.myOverlay.isMaster:
                        if curtotal > 0:
                            # When appending, many of the channel variables aren't set, so copy them over.
                            # This needs to be done before setup since a rule may use one of the values.
                            # It also needs to be done after since one of them may have changed while being setup.
                            self.chanlist.channels[i].playlistPosition = self.myOverlay.channels[i].playlistPosition
                            self.chanlist.channels[i].showTimeOffset = self.myOverlay.channels[i].showTimeOffset
                            self.chanlist.channels[i].lastAccessTime = self.myOverlay.channels[i].lastAccessTime
#.........这里部分代码省略.........
开发者ID:wallacesilva,项目名称:script.pseudotv,代码行数:103,代码来源:ChannelListThread.py


注:本文中的ChannelList.ChannelList.setupChannel方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。