本文整理汇总了Python中ChannelList.ChannelList类的典型用法代码示例。如果您正苦于以下问题:Python ChannelList类的具体用法?Python ChannelList怎么用?Python ChannelList使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ChannelList类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: readConfig
def readConfig(self):
self.log('readConfig')
# Sleep setting is in 30 minute incriments...so multiply by 30, and then 60 (min to sec)
self.sleepTimeValue = int(REAL_SETTINGS.getSetting('AutoOff')) * 1800
self.log('Auto off is ' + str(self.sleepTimeValue))
self.infoOnChange = REAL_SETTINGS.getSetting("InfoOnChange") == "true"
self.log('Show info label on channel change is ' + str(self.infoOnChange))
self.showChannelBug = REAL_SETTINGS.getSetting("ShowChannelBug") == "true"
self.log('Show channel bug - ' + str(self.showChannelBug))
self.forceReset = REAL_SETTINGS.getSetting('ForceChannelReset') == "true"
self.channelResetSetting = REAL_SETTINGS.getSetting('ChannelResetSetting')
self.log("Channel reset setting - " + str(self.channelResetSetting))
self.channelLogos = xbmc.translatePath(REAL_SETTINGS.getSetting('ChannelLogoFolder'))
if os.path.exists(self.channelLogos) == False:
self.channelLogos = IMAGES_LOC
self.log('Channel logo folder - ' + self.channelLogos)
self.startupTime = time.time()
chn = ChannelList()
self.background.setVisible(True)
self.channels = chn.setupList()
if self.channels is None:
self.log('readConfig No channel list returned')
self.end()
return False
self.Player.stop()
self.log('readConfig return')
return True
示例2: __init__
def __init__(self):
threading.Thread.__init__(self)
self.myOverlay = None
self.shouldExit = False
sys.setcheckinterval(25)
self.chanlist = ChannelList()
self.chanlist.sleepTime = 0.1
示例3: __init__
def __init__(self):
threading.Thread.__init__(self)
self.myOverlay = None
sys.setcheckinterval(25)
self.chanlist = ChannelList()
self.paused = False
self.fullUpdating = True
示例4: prepareConfig
def prepareConfig(self):
self.log("prepareConfig")
self.showList = []
self.getControl(105).setVisible(False)
self.getControl(106).setVisible(False)
BUSY.create()
chnlst = ChannelList()
chnlst.fillTVInfo()
chnlst.fillMovieInfo()
self.mixedGenreList = chnlst.makeMixedList(chnlst.showGenreList, chnlst.movieGenreList)
self.networkList = chnlst.networkList
self.studioList = chnlst.studioList
self.showGenreList = chnlst.showGenreList
self.movieGenreList = chnlst.movieGenreList
for i in range(len(chnlst.showList)):
self.showList.append(chnlst.showList[i][0])
self.mixedGenreList.sort(key=lambda x: x.lower())
self.listcontrol = self.getControl(102)
for i in range(999):
theitem = xbmcgui.ListItem()
theitem.setLabel(str(i + 1))
self.listcontrol.addItem(theitem)
self.updateListing()
BUSY.close()
self.getControl(105).setVisible(True)
self.getControl(106).setVisible(False)
self.setFocusId(102)
self.log("prepareConfig return")
示例5: readConfig
def readConfig(self):
self.log('readConfig')
# Sleep setting is in 30 minute incriments...so multiply by 30, and then 60 (min to sec)
self.sleepTimeValue = int(REAL_SETTINGS.getSetting('AutoOff')) * 1800
self.log('Auto off is ' + str(self.sleepTimeValue))
self.infoOnChange = REAL_SETTINGS.getSetting("InfoOnChange") == "true"
self.log('Show info label on channel change is ' + str(self.infoOnChange))
self.showChannelBug = REAL_SETTINGS.getSetting("ShowChannelBug") == "true"
self.log('Show channel bug - ' + str(self.showChannelBug))
self.forceReset = REAL_SETTINGS.getSetting('ForceChannelReset') == "true"
self.channelResetSetting = REAL_SETTINGS.getSetting('ChannelResetSetting')
self.log("Channel reset setting - " + str(self.channelResetSetting))
self.channelLogos = xbmc.translatePath(REAL_SETTINGS.getSetting('ChannelLogoFolder'))
self.backgroundUpdating = int(REAL_SETTINGS.getSetting("ThreadMode"))
self.log("Background updating - " + str(self.backgroundUpdating))
self.showNextItem = REAL_SETTINGS.getSetting("EnableComingUp") == "true"
self.log("Show Next Item - " + str(self.showNextItem))
self.hideShortItems = REAL_SETTINGS.getSetting("HideClips") == "true"
self.log("Hide Short Items - " + str(self.hideShortItems))
self.shortItemLength = SHORT_CLIP_ENUM[int(REAL_SETTINGS.getSetting("ClipLength"))]
self.log("Short item length - " + str(self.shortItemLength))
self.channelDelay = int(REAL_SETTINGS.getSetting("ChannelDelay")) * 250
if FileAccess.exists(self.channelLogos) == False:
self.channelLogos = IMAGES_LOC
self.log('Channel logo folder - ' + self.channelLogos)
chn = ChannelList()
chn.myOverlay = self
self.channels = chn.setupList()
if self.channels is None:
self.log('readConfig No channel list returned')
self.end()
return False
self.Player.stop()
self.log('readConfig return')
return True
示例6: ChannelListThread
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")
#.........这里部分代码省略.........
示例7: ChannelListThread
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
#.........这里部分代码省略.........
示例8: ChannelListThread
class ChannelListThread(threading.Thread):
def __init__(self):
threading.Thread.__init__(self)
self.myOverlay = None
self.shouldExit = False
sys.setcheckinterval(25)
self.chanlist = ChannelList()
self.chanlist.sleepTime = 0.1
self.paused = False
def log(self, msg, level = xbmc.LOGDEBUG):
log('ChannelListThread: ' + msg, level)
def run(self):
self.log("Starting")
self.shouldExit = False
self.chanlist.exitThread = False
if self.myOverlay == None:
self.log("Overlay not defined. Exiting.")
return
for i in range(self.myOverlay.maxChannels):
modified = True
while modified == True and self.myOverlay.channels[i].isValid and self.myOverlay.channels[i].getTotalDuration() < PREP_CHANNEL_TIME:
modified = False
if self.shouldExit == True:
self.log("Closing thread")
return
time.sleep(2)
curtotal = self.myOverlay.channels[i].getTotalDuration()
self.chanlist.appendChannel(i + 1)
# A do-while loop for the paused state
while True:
if self.shouldExit == True:
self.log("Closing thread")
return
time.sleep(2)
if self.paused == False:
break
self.myOverlay.channels[i].setPlaylist(CHANNELS_LOC + "channel_" + str(i + 1) + ".m3u")
if self.myOverlay.channels[i].getTotalDuration() > curtotal:
modified = True
self.log("All channels up to date. Exiting thread.")
def pause(self):
self.paused = True
def unpause(self):
self.paused = False
示例9: __init__
def __init__(self, *args, **kwargs):
self.log('__init__')
self.chanlist = ChannelList()
示例10: APP
class APP(xbmcgui.WindowXMLDialog):
def __init__(self, *args, **kwargs):
self.log('__init__')
self.chanlist = ChannelList()
def log(self, msg, level = xbmc.LOGDEBUG):
log('APPS: ' + msg, level)
def onFocus(self, controlid):
self.log('onFocus')
def onInit(self):
self.log('onInit')
self.PanelPlugins = self.getControl(500)
self.PanelItems = self.getControl(501)
self.fillPlugins()
self.setFocus(self.PanelPlugins)
def onClick(self, controlid):
self.log('onClick ' + str(controlid))
if controlid == 500:
playitem = self.PanelPlugins.getListItem(self.PanelPlugins.getSelectedPosition())
self.chanlist.fillListItems('plugin://'+ playitem.getProperty('mediapath'))
self.setFocus(self.PanelItems)
# xbmc.executebuiltin('Container.Refresh')
elif controlid in [6001,6002,6003,6004]:
if controlid == 6001:
self.log('ACTION_TELETEXT_RED')
self.MyOverlayWindow.windowSwap('EPG')
elif controlid == 6002:
self.log('ACTION_TELETEXT_GREEN')
self.MyOverlayWindow.windowSwap('DVR')
elif controlid == 6003:
self.log('ACTION_TELETEXT_YELLOW')
self.MyOverlayWindow.windowSwap('ONDEMAND')
elif controlid == 6004:
self.log('ACTION_TELETEXT_BLUE')
self.MyOverlayWindow.windowSwap('APPS')
def onAction(self, act):
self.log('onAction ' + str(act.getId()))
action = act.getId()
if action in ACTION_PREVIOUS_MENU:
self.closeAPPS()
elif action == ACTION_TELETEXT_RED:
self.log('ACTION_TELETEXT_RED')
self.MyOverlayWindow.windowSwap('EPG')
elif action == ACTION_TELETEXT_GREEN:
self.log('ACTION_TELETEXT_GREEN')
self.MyOverlayWindow.windowSwap('DVR')
elif action == ACTION_TELETEXT_YELLOW:
self.log('ACTION_TELETEXT_YELLOW')
self.MyOverlayWindow.windowSwap('ONDEMAND')
elif action == ACTION_TELETEXT_BLUE:
self.log('ACTION_TELETEXT_BLUE')
self.MyOverlayWindow.windowSwap('APPS')
if action in ACTION_PREVIOUS_MENU:
print 'ACTION_PREVIOUS_MENU'
elif action in ACTION_MOVE_DOWN:
print 'ACTION_MOVE_DOWN'
elif action in ACTION_MOVE_UP:
print 'ACTION_MOVE_UP'
elif action in ACTION_MOVE_LEFT:
print 'ACTION_MOVE_LEFT'
elif action in ACTION_MOVE_RIGHT:
print 'ACTION_MOVE_RIGHT'
elif action in ACTION_PAGEDOWN:
print 'ACTION_PAGEDOWN'
elif action in ACTION_PAGEUP:
print 'ACTION_PAGEUP'
elif action in ACTION_SELECT_ITEM:
print 'ACTION_SELECT_ITEM'
def closeAPPS(self):
self.log('closeAPPS')
self.close()
def fillPlugins(self, type='video'):
self.log('fillPlugins, type = ' + type)
json_query = ('{"jsonrpc":"2.0","method":"Addons.GetAddons","params":{"type":"xbmc.addon.%s","properties":["name","path","thumbnail","description","fanart","summary"]}, "id": 1 }'%type)
json_detail = self.chanlist.sendJSON(json_query)
#.........这里部分代码省略.........
示例11: APPS
class APPS(xbmcgui.WindowXMLDialog):
def __init__(self, *args, **kwargs):
self.log('__init__')
self.chanlist = ChannelList()
def log(self, msg, level = xbmc.LOGDEBUG):
log('APPS: ' + msg, level)
def onFocus(self, controlid):
self.log('onFocus')
def onInit(self):
self.log('onInit')
self.chanlist.PanelItems = self.getControl(500)
self.chanlist.fillPlugins()
self.setFocus(self.chanlist.PanelItems)
def onClick(self, controlId):
self.log('onClick ' + str(controlId))
if controlId == 500:
pos = self.chanlist.PanelItems.getSelectedPosition()
playitem = self.chanlist.PanelItems.getListItem(pos)
url = 'plugin://'+ playitem.getProperty('mediapath')
self.chanlist.fillListItems(url)
self.setFocus(self.chanlist.PanelItems)
# xbmc.executebuiltin('Container.Refresh')
def onAction(self, act):
self.log('onAction ' + str(act.getId()))
action = act.getId()
if action in ACTION_PREVIOUS_MENU:
self.closeAPPS()
elif action == ACTION_TELETEXT_RED:
self.log('ACTION_TELETEXT_RED')
self.MyOverlayWindow.windowSwap('EPG')
elif action == ACTION_TELETEXT_GREEN:
self.log('ACTION_TELETEXT_GREEN')
self.MyOverlayWindow.windowSwap('DVR')
elif action == ACTION_TELETEXT_YELLOW:
self.log('ACTION_TELETEXT_YELLOW')
self.MyOverlayWindow.windowSwap('ONDEMAND')
elif action == ACTION_TELETEXT_BLUE:
self.log('ACTION_TELETEXT_BLUE')
self.MyOverlayWindow.windowSwap('APPS')
if action in ACTION_PREVIOUS_MENU:
print 'ACTION_PREVIOUS_MENU'
elif action in ACTION_MOVE_DOWN:
print 'ACTION_MOVE_DOWN'
elif action in ACTION_MOVE_UP:
print 'ACTION_MOVE_UP'
elif action in ACTION_MOVE_LEFT:
print 'ACTION_MOVE_LEFT'
elif action in ACTION_MOVE_RIGHT:
print 'ACTION_MOVE_RIGHT'
elif action in ACTION_PAGEDOWN:
print 'ACTION_PAGEDOWN'
elif action in ACTION_PAGEUP:
print 'ACTION_PAGEUP'
elif action in ACTION_SELECT_ITEM:
print 'ACTION_SELECT_ITEM'
def closeAPPS(self):
self.log('closeAPPS')
self.close()
示例12: onInit
def onInit(self):
self.log('onInit')
migrate()
self.channelLabelTimer = threading.Timer(5.0, self.hideChannelLabel)
self.infoTimer = threading.Timer(5.0, self.hideInfo)
self.background = self.getControl(101)
self.getControl(102).setVisible(False)
if not os.path.exists(GEN_CHAN_LOC):
try:
os.makedirs(GEN_CHAN_LOC)
except:
self.Error('Unable to create the cache directory')
return
self.myEPG = EPGWindow("script.pseudotv.EPG.xml", ADDON_INFO, "default")
self.myEPG.MyOverlayWindow = self
# Don't allow any actions during initialization
self.actionSemaphore.acquire()
### TV TIME ###
chn = ChannelList()
# build meta files if first time loading
if (
REAL_SETTINGS.getSetting("bumpers") == "true" or
REAL_SETTINGS.getSetting("commercials") == "true" or
REAL_SETTINGS.getSetting("trailers") == "true"
):
chn.buildMetaFiles()
chn.loadCustomPlaylists()
if (REAL_SETTINGS.getSetting("autoFindMixGenres") == "true" or
REAL_SETTINGS.getSetting("autoFindMovieGenres") == "true" or
REAL_SETTINGS.getSetting("autoFindNetworks") == "true" or
REAL_SETTINGS.getSetting("autoFindStudios") == "true" or
REAL_SETTINGS.getSetting("autoFindTVGenres") == "true" or
REAL_SETTINGS.getSetting("autoFindTVShows") == "true" or
REAL_SETTINGS.getSetting("autoFindMusicGenres") == "true" or
REAL_SETTINGS.getSetting("autoFindLive") == "true"):
chn.autoTune()
###############
if self.readConfig() == False:
return
self.myEPG.channelLogos = self.channelLogos
self.maxChannels = len(self.channels)
### TV TIME ###
#if self.maxChannels == 0:
# self.Error('Unable to find any channels. Please configure the addon.')
# return
if self.maxChannels == 0:
dlg = xbmcgui.Dialog()
autoTune = False
if dlg.yesno("No Channels Configured", "Would you like TV Time to Auto Tune TV Network\nchannels the next time it loads?"):
REAL_SETTINGS.setSetting("autoFindNetworks","true")
autoTune = True
if dlg.yesno("No Channels Configured", "Would you like TV Time to Auto Tune TV Genre\nchannels the next time it loads?"):
REAL_SETTINGS.setSetting("autoFindTVGenres","true")
autoTune = True
if dlg.yesno("No Channels Configured", "Would you like TV Time to Auto Tune Movie Studio\nchannels the next time it loads?"):
REAL_SETTINGS.setSetting("autoFindStudios","true")
autoTune = True
if dlg.yesno("No Channels Configured", "Would you like TV Time to Auto Tune Movie Genre\nchannels the next time it loads?"):
REAL_SETTINGS.setSetting("autoFindMovieGenres","true")
autoTune = True
if dlg.yesno("No Channels Configured", "Would you like TV Time to Auto Tune Mix Genre\nchannels the next time it loads?"):
REAL_SETTINGS.setSetting("autoFindMixGenres","true")
autoTune = True
if dlg.yesno("No Channels Configured", "Would you like TV Time to Auto Tune Music Genre\nchannels the next time it loads?"):
REAL_SETTINGS.setSetting("autoFindMusicGenres","true")
autoTune = True
if dlg.yesno("No Channels Configured", "Would you like TV Time to Auto Tune Live\nchannels the next time it loads?"):
REAL_SETTINGS.setSetting("autoFindLive","true")
autoTune = True
if autoTune:
self.background.setVisible(True)
self.end()
return
del dlg
###############
found = False
for i in range(self.maxChannels):
if self.channels[i].isValid:
found = True
break
#.........这里部分代码省略.........
示例13: ChannelListThread
class ChannelListThread(threading.Thread):
def __init__(self):
threading.Thread.__init__(self)
self.myOverlay = None
self.shouldExit = False
sys.setcheckinterval(25)
self.chanlist = ChannelList()
self.chanlist.sleepTime = 0.1
def log(self, msg, level = xbmc.LOGDEBUG):
log('ChannelListThread: ' + msg, level)
def run(self):
self.log("Starting")
self.shouldExit = False
self.chanlist.exitThread = False
if self.myOverlay == None:
self.log("Overlay not defined. Exiting.")
return
### TV TIME ###
prestageChannels = REAL_SETTINGS.getSetting('PrestageChannels') == "true"
if prestageChannels:
for i in range(self.myOverlay.maxChannels):
if self.shouldExit == True:
self.log("Closing thread")
return
self.log("Prestage Channel " + str(i + 1))
self.chanlist.prestageChannel(i + 1)
self.channelResetSetting = REAL_SETTINGS.getSetting('ChannelResetSetting')
if self.channelResetSetting == "0":
###############
for i in range(self.myOverlay.maxChannels):
modified = True
while modified == True and self.myOverlay.channels[i].isValid and self.myOverlay.channels[i].getTotalDuration() < PREP_CHANNEL_TIME:
modified = False
if self.shouldExit == True:
self.log("Closing thread")
return
time.sleep(2)
curtotal = self.myOverlay.channels[i].getTotalDuration()
self.chanlist.appendChannel(i + 1)
if self.shouldExit == True:
self.log("Closing thread")
return
time.sleep(2)
self.myOverlay.channels[i].setPlaylist(CHANNELS_LOC + "channel_" + str(i + 1) + ".m3u")
if self.myOverlay.channels[i].getTotalDuration() > curtotal:
modified = True
self.log("All channels up to date. Exiting thread.")
示例14: prepareConfig
def prepareConfig(self):
self.log("prepareConfig")
self.showList = []
self.getControl(105).setVisible(False)
self.getControl(106).setVisible(False)
self.dlg = xbmcgui.DialogProgress()
self.dlg.create("TV Time", "Preparing Channel Wizard")
self.dlg.update(0, "Preparing Channel Wizard")
self.chnlst = ChannelList()
self.dlg.update(10, "Preparing Channel Wizard", "Loading TV Settings")
self.chnlst.fillTVInfo()
self.networkList = self.chnlst.networkList
self.studioList = self.chnlst.studioList
self.showGenreList = self.chnlst.showGenreList
self.dlg.update(20, "Preparing Channel Wizard", "Loading Movie Settings")
self.chnlst.fillMovieInfo()
self.movieGenreList = self.chnlst.movieGenreList
self.dlg.update(40, "Preparing Channel Wizard", "Loading Music Settings")
self.chnlst.fillMusicInfo()
self.musicGenreList = self.chnlst.musicGenreList
self.dlg.update(60, "Preparing Channel Wizard", "Loading Live Feed Settings")
self.chnlst.fillFeedInfo()
self.feedList = self.chnlst.feedList
self.dlg.update(80, "Preparing Channel Wizard", "Loading Mixed Genre Settings")
self.mixedGenreList = self.chnlst.makeMixedList(self.showGenreList, self.movieGenreList)
for i in range(len(self.chnlst.showList)):
self.showList.append(self.chnlst.showList[i][0])
self.mixedGenreList.sort(key=lambda x: x.lower())
self.log("self.networkList " + str(self.networkList))
self.log("self.studioList " + str(self.studioList))
self.log("self.showGenreList " + str(self.showGenreList))
self.log("self.movieGenreList " + str(self.movieGenreList))
self.log("self.musicGenreList " + str(self.musicGenreList))
self.log("self.mixedGenreList " + str(self.mixedGenreList))
self.resolutionList = []
self.resolutionList.append("All")
self.resolutionList.append("SD Only")
self.resolutionList.append("720p or Higher")
self.resolutionList.append("1080p Only")
self.showseqList = []
self.showseqList.append("1 Show")
self.showseqList.append("2 Shows")
self.showseqList.append("3 Shows")
self.showseqList.append("4 Shows")
self.showseqList.append("5 Shows")
self.showseqList.append("6 Shows")
self.showseqList.append("7 Shows")
self.showseqList.append("8 Shows")
self.showseqList.append("9 Shows")
self.showseqList.append("10 Shows")
self.movieseqList = []
self.movieseqList.append("1 Movie")
self.movieseqList.append("2 Movies")
self.movieseqList.append("3 Movies")
self.movieseqList.append("4 Movies")
self.movieseqList.append("5 Movies")
self.movieseqList.append("6 Movies")
self.movieseqList.append("7 Movies")
self.movieseqList.append("8 Movies")
self.movieseqList.append("9 Movies")
self.movieseqList.append("10 Movies")
# check if settings2.xml file exists
# read in channel playlists in video, music and mixed folders
channelNum = 0
for i in range(500):
if os.path.exists(
xbmc.translatePath("special://profile/playlists/video") + "/Channel_" + str(i + 1) + ".xsp"
):
channelNum = channelNum + 1
ADDON_SETTINGS.setSetting("Channel_" + str(channelNum) + "_type", "0")
ADDON_SETTINGS.setSetting("Channel_" + str(channelNum) + "_time", "0")
ADDON_SETTINGS.setSetting(
"Channel_" + str(channelNum) + "_1",
xbmc.translatePath("special://profile/playlists/video/") + "Channel_" + str(i + 1) + ".xsp",
)
ADDON_SETTINGS.setSetting("Channel_" + str(channelNum) + "_2", str(""))
ADDON_SETTINGS.setSetting(
"Channel_" + str(channelNum) + "_3",
ChannelList().cleanString(
ChannelList().getSmartPlaylistName(
xbmc.translatePath("special://profile/playlists/video") + "/Channel_" + str(i + 1) + ".xsp"
)
),
)
ADDON_SETTINGS.setSetting("Channel_" + str(channelNum) + "_4", str(""))
ADDON_SETTINGS.setSetting("Channel_" + str(channelNum) + "_5", str(""))
ADDON_SETTINGS.setSetting("Channel_" + str(channelNum) + "_6", str(""))
ADDON_SETTINGS.setSetting("Channel_" + str(channelNum) + "_7", str(""))
ADDON_SETTINGS.setSetting("Channel_" + str(channelNum) + "_8", str(""))
ADDON_SETTINGS.setSetting("Channel_" + str(channelNum) + "_9", str(""))
ADDON_SETTINGS.setSetting(
"Channel_" + str(channelNum) + "_playlist",
xbmc.translatePath("special://profile/playlists/video/") + "Channel_" + str(i + 1) + ".xsp",
#.........这里部分代码省略.........
示例15: TVOverlay
class TVOverlay(xbmcgui.WindowXMLDialog):
def __init__(self, *args, **kwargs):
xbmcgui.WindowXMLDialog.__init__(self, *args, **kwargs)
self.log('__init__')
# initialize all variables
self.channels = []
self.Player = MyPlayer()
self.Player.overlay = self
self.inputChannel = -1
self.channelLabel = []
self.lastActionTime = 0
self.actionSemaphore = threading.BoundedSemaphore()
self.channelThread = ChannelListThread()
self.channelThread.myOverlay = self
if not USING_FRODO:
self.setCoordinateResolution(1)
self.timeStarted = 0
self.infoOnChange = True
self.infoOffset = 0
self.invalidatedChannelCount = 0
self.showingInfo = False
self.showChannelBug = False
self.notificationLastChannel = 0
self.notificationLastShow = 0
self.notificationShowedNotif = False
self.isExiting = False
self.maxChannels = 0
self.notPlayingCount = 0
self.ignoreInfoAction = False
self.shortItemLength = 60
self.runningActionChannel = 0
self.channelDelay = 0
for i in range(3):
self.channelLabel.append(xbmcgui.ControlImage(50 + (50 * i), 50, 50, 50, IMAGES_LOC + 'solid.png', colorDiffuse='0xAA00ff00'))
self.addControl(self.channelLabel[i])
self.channelLabel[i].setVisible(False)
self.doModal()
self.log('__init__ return')
def resetChannelTimes(self):
for i in range(self.maxChannels):
self.channels[i].setAccessTime(self.timeStarted - self.channels[i].totalTimePlayed)
def onFocus(self, controlId):
pass
# override the doModal function so we can setup everything first
def onInit(self):
self.log('onInit')
if FileAccess.exists(GEN_CHAN_LOC) == False:
try:
FileAccess.makedirs(GEN_CHAN_LOC)
except:
self.Error('Unable to create the cache directory')
return
if FileAccess.exists(MADE_CHAN_LOC) == False:
try:
FileAccess.makedirs(MADE_CHAN_LOC)
except:
self.Error('Unable to create the storage directory')
return
self.background = self.getControl(101)
self.getControl(102).setVisible(False)
self.background.setVisible(True)
updateDialog = xbmcgui.DialogProgress()
updateDialog.create("PseudoTV", "Initializing")
self.backupFiles(updateDialog)
ADDON_SETTINGS.loadSettings()
if CHANNEL_SHARING:
updateDialog.update(70, "Initializing", "Checking Other Instances")
self.isMaster = GlobalFileLock.lockFile("MasterLock", False)
else:
self.isMaster = True
updateDialog.update(95, "Initializing", "Migrating")
if self.isMaster:
migratemaster = Migrate()
migratemaster.migrate()
self.channelLabelTimer = threading.Timer(5.0, self.hideChannelLabel)
self.playerTimer = threading.Timer(2.0, self.playerTimerAction)
self.playerTimer.name = "PlayerTimer"
self.infoTimer = threading.Timer(5.0, self.hideInfo)
self.myEPG = EPGWindow("script.pseudotv.EPG.xml", ADDON_INFO, "default")
self.myEPG.MyOverlayWindow = self
# Don't allow any actions during initialization
self.actionSemaphore.acquire()
updateDialog.close()
#.........这里部分代码省略.........