def __init__(self, *args, **kwargs): self.log("__init__") if xbmcgui.Window(10000).getProperty("PseudoTVRunning") != "True": xbmcgui.WindowXMLDialog.__init__(self, *args, **kwargs) self.madeChanges = 0 self.showingList = True self.channel = 0 self.channel_type = 9999 self.setting1 = '' self.setting2 = '' self.setting3 = '' self.setting4 = '' self.savedRules = False self.DirName = '' self.PluginSourcePathDir = '' self.LockBrowse = False self.chnlst = ChannelList() if CHANNEL_SHARING: realloc = REAL_SETTINGS.getSetting('SettingsFolder') FileAccess.copy(realloc + '/settings2.xml', SETTINGS_LOC + '/settings2.xml') ADDON_SETTINGS.loadSettings() ADDON_SETTINGS.disableWriteOnSave() self.doModal() self.log("__init__ return") else: xbmc.executebuiltin( "Notification( %s, %s, %d, %s)" % ("PseudoTV Lite", "Not available while running.", 4000, THUMB))
def _parse_argv(self): self.handle = None self.infos = [] self.params = { " Label": None, " Path": None, " FileName": None, " DBIDType": None, " AddonName": None, " AddonType": None, " Description": None, " isPlayable": None, " isFolder": None } for arg in sys.argv: if arg == 'script.pseudotv.live': continue param = (arg.replace('"', '').replace("'", " ").replace( "[ ", " ").replace(" ]", " ").replace("' ", "'").replace(" ' ", "'")) try: self.params[param.split("=")[0]] = "=".join( param.split("=")[1:]).strip() except: pass self.log("params = " + str(self.params)) self.Label = self.params[" Label"] = self.params.get(" Label", "").strip() self.Path = self.params[" Path"] = self.params.get(" Path", "").strip() self.FileName = self.params[" FileName"] = self.params.get( " FileName", "").strip() self.DBIDType = self.params[" DBIDType"] = self.params.get( " DBIDType", "").strip() self.AddonName = self.params[" AddonName"] = self.params.get( " AddonName", "").strip() self.AddonType = self.params[" AddonType"] = self.params.get( " AddonType", "").strip() try: self.Description = self.params[" Description"] = self.params.get( " Description", "").strip() except: self.Description = self.params[" Description"] = self.params.get( "Description", "").strip() self.isPlayable = self.params[" isPlayable"] = self.params.get( " isPlayable", "").strip() self.isFolder = self.params[" isFolder"] = self.params.get( " isFolder", "").strip() if self.AddonName: ADDON = xbmcaddon.Addon(id=self.AddonName) ADDON_ID = ADDON.getAddonInfo('id') self.AddonName = ADDON.getAddonInfo('name') self.chnlst = ChannelList() self.Label = self.chnlst.CleanLabels(self.Label) self.Description = self.chnlst.CleanLabels(self.Description) self.AddonName = self.chnlst.CleanLabels(self.AddonName) self.ImportChannel()
def addBypass(): chnlst = ChannelList() chnlst.fillPluginList() BYPASS_LST = matchMselect( chnlst.pluginPathList, mselectDialog(chnlst.pluginNameList, header='Enable Seeking for specified Plugins')) REAL_SETTINGS.setSetting("BYPASS_LST", str(BYPASS_LST))
def __init__(self): self.log("__init__") setProperty("PseudoTVConfigRunning", "True") while getProperty("PseudoTVService") == "True": xbmc.sleep(25) self.chnlst = ChannelList() self.chnlst.fillPVR() # InfoLabel Parameters self.Label = xbmc.getInfoLabel('ListItem.Label') self.Path = xbmc.getInfoLabel('ListItem.FolderPath') self.FileName = xbmc.getInfoLabel('ListItem.FilenameAndPath') self.DBIDType = xbmc.getInfoLabel('ListItem.DBTYPE') self.AddonName = xbmc.getInfoLabel('Container.PluginName') self.AddonType = xbmc.getInfoLabel('Container.Property(addoncategory)') self.Description = xbmc.getInfoLabel( 'ListItem.Property(Addon.Description)') self.plot = xbmc.getInfoLabel('ListItem.Plot') self.plotOutline = xbmc.getInfoLabel('ListItem.PlotOutline') self.isPlayable = xbmc.getInfoLabel( 'ListItem.Property(IsPlayable)').lower() == 'true' self.isFolder = xbmc.getCondVisibility('ListItem.IsFolder') == 1 if not self.plot: if self.plotOutline: self.Description = self.plotOutline elif not self.Description: self.Description = self.Label else: self.Description = self.plot if self.AddonName: ADDON = xbmcaddon.Addon(id=self.AddonName) ADDON_ID = ADDON.getAddonInfo('id') self.AddonName = ADDON.getAddonInfo('name') self.Label = self.chnlst.cleanLabels(self.Label) self.Description = self.chnlst.cleanLabels(self.Description) self.AddonName = self.chnlst.cleanLabels(self.AddonName) self.log("%s, %s, %s, %s, %s, %s, %s, %s, %s" % (self.Label, self.Path, self.FileName, self.DBIDType, self.AddonName, self.AddonType, self.Description, str(self.isPlayable), str(self.isFolder))) self.ImportChannel()
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("PseudoTV Live", "Preparing Configuration") self.dlg.update(1) chnlst = ChannelList() self.dlg.update(50) chnlst.fillMusicInfo() self.dlg.update(60) chnlst.fillTVInfo() self.dlg.update(70) chnlst.fillMovieInfo() self.dlg.update(80) self.mixedGenreList = chnlst.makeMixedList(chnlst.showGenreList, chnlst.movieGenreList) self.networkList = chnlst.networkList self.studioList = chnlst.studioList self.showGenreList = chnlst.showGenreList self.movieGenreList = chnlst.movieGenreList self.musicGenreList = chnlst.musicGenreList 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.dlg.update(90) self.updateListing() self.dlg.close() self.getControl(105).setVisible(True) self.getControl(106).setVisible(False) self.setFocusId(102) self.log("prepareConfig return")
def ImportChannel(self): self.log("ImportChannel") show_busy_dialog() self.chnlst = ChannelList() self.chantype = 9999 self.setting1 = '' self.setting2 = '' self.setting3 = '' self.setting4 = '' self.channame = '' self.theitem = [] self.itemlst = [] ADDON_SETTINGS.loadSettings() for i in range(999): self.theitem.append(str(i + 1)) self.updateListing() hide_busy_dialog() available = False try: Lastchan = int(getProperty("PTVL.CM.LASTCHAN")) self.log("ImportChannel, Lastchan = " + str(Lastchan)) self.nitemlst = self.itemlst self.itemlst = self.nitemlst[Lastchan:] + self.nitemlst[:Lastchan] except: pass while not available: select = selectDialog(self.itemlst, 'Select Channel Number') if select != -1: # self.channel = select + 1 self.channel = int( self.chnlst.CleanLabels( (self.itemlst[select]).split(' - ')[0])) if not (self.itemlst[select]).startswith('[COLOR=dimgrey]'): available = True if self.Path[-3:].lower() == 'xsp': self.chantype = 0 elif self.Path.lower().startswith( 'plugin://plugin.video.youtube/channel'): self.chantype = 10 self.YTtype = 1 elif self.Path.lower().startswith( 'plugin://plugin.video.spotitube/?limit&mode=listyoutubeplaylist' ): self.chantype = 10 self.YTtype = 2 elif self.Path.lower().startswith( ('plugin', 'http', 'rtmp', 'pvr')): if self.isPlayable == 'True': if dlg.yesno("PseudoTV Live", 'Add source as', yeslabel="LiveTV", nolabel="InternetTV"): self.chantype = 8 else: self.chantype = 9 else: if self.Path.lower().startswith(('pvr')): self.chantype = 8 elif self.isFolder == 'True': self.chantype = 15 elif self.isFolder == 'True': if self.DBIDType == 'tvshow': self.chantype = 6 elif self.DBIDType == '': self.chantype = 7 self.buildChannel() else: xbmc.executebuiltin( "Notification( %s, %s, %d, %s)" % ("PseudoTV Live", "Channel " + str(self.channel) + " already in use", 1000, THUMB)) else: available = True
def buildChannel(self): self.log("buildChannel, chantype = " + str(self.chantype)) self.chnlst = ChannelList() self.addonDirectoryPath = [] if self.chantype == 0: self.setting1 = xbmc.translatePath(self.Path) self.channame = self.getSmartPlaylistName(self.Path) elif self.chantype == 6: self.setting1 = self.Label self.setting2 = '4' self.channame = self.Label elif self.chantype == 7: self.setting1 = xbmc.translatePath(self.Path) self.setting3 = str(MEDIA_LIMIT) self.setting4 = '0' self.channame = self.Label elif self.chantype == 8: dname = self.Label xmltvFle = xmltvFile(listXMLTV()) # try: self.channame, self.setting1 = self.chnlst.findZap2itID( dname, xmltvFle) # except: # return self.setting2 = self.Path elif self.chantype == 9: self.setting1 = '5400' self.setting2 = self.Path self.setting3 = self.Label self.setting4 = self.Description self.channame = self.Label + ' - ' + self.AddonName elif self.chantype == 10: if self.YTtype == 1: YTstring = 'plugin://plugin.video.youtube/channel/' elif self.YTtype == 2: YTstring = 'plugin://plugin.video.spotitube/?limit&mode=listyoutubeplaylist&type=browse&url=' self.setting1 = ((self.Path.lower()).replace(YTstring, '')).replace('/', '') self.setting2 = str(self.YTtype) self.setting3 = str(MEDIA_LIMIT) self.setting4 = '0' self.channame = self.Label elif self.chantype == 15: self.setting1 = self.Path self.setting2 = '' self.setting3 = str(MEDIA_LIMIT) self.setting4 = '0' self.channame = self.Label + ' - ' + self.AddonName self.saveSettings() if dlg.yesno("PseudoTV Live", 'Channel Successfully Added', 'Open Channel Manager?'): xbmc.executebuiltin("RunScript(" + ADDON_PATH + "/config.py, %s)" % str(self.channel))