def onInit(self): try: self.favList = self.getControl(6) self.getControl(3).setVisible(False) except: self.favList = self.getControl(3) self.getControl(5).setVisible(False) self.getControl(1).setLabel(GETTEXT(30000)) try: self.getControl(7).setLabel(xbmc.getLocalizedString(222)) except: pass self.getControl(5).setVisible(False) #the remove item #self.favList.addItem(xbmcgui.ListItem(GETTEXT(30100), iconImage='DefaultAddonNone.png')) if self.mode != 'xbmc': self.addFolderItem() if self.mode == 'root': self.addXBMCFavouritesItem() for fave in self.faves: listitem = xbmcgui.ListItem(fave[0]) icon = fave[1] if not icon: icon = ICON listitem.setIconImage(icon) listitem.setProperty('Icon', fave[1]) cmd = fave[2] if cmd.lower().startswith('activatewindow'): cmd = cmd.replace('")', '",return)') fanart = favourite.getFanart(cmd) desc = favourite.getOption(cmd, 'desc') mode = favourite.getOption(cmd, 'mode') cmd = favourite.removeSFOptions(cmd) listitem.setProperty('Path', cmd) listitem.setProperty('Fanart', fanart) listitem.setProperty('Desc', desc) listitem.setProperty('Mode', mode) if len(fave) > 3 and fave[3]: listitem.setProperty('IsFolder', 'true') self.favList.addItem(listitem) # add a dummy item with no action assigned #listitem = xbmcgui.ListItem(GETTEXT(30101)) #listitem.setProperty('Path', 'noop') #self.favList.addItem(listitem) self.setFocus(self.favList)
def onInit(self): try: self.favList = self.getControl(6) self.getControl(3).setVisible(False) except: self.favList = self.getControl(3) self.getControl(5).setVisible(False) self.getControl(1).setLabel(GETTEXT(30000)) self.getControl(1).setVisible(False) #the remove item #self.favList.addItem(xbmcgui.ListItem(GETTEXT(30100), iconImage='DefaultAddonNone.png')) if self.mode != 'xbmc': self.addFolderItem() if self.mode == 'root': self.addXBMCFavouritesItem() for fave in self.faves: listitem = xbmcgui.ListItem(fave[0]) icon = fave[1] if not icon: icon = ICON listitem.setIconImage(icon) listitem.setProperty('Icon', fave[1]) cmd = fave[2] if cmd.lower().startswith('activatewindow'): cmd = cmd.replace('")', '",return)') fanart = favourite.getFanart(cmd) desc = favourite.getOption(cmd, 'desc') mode = favourite.getOption(cmd, 'mode') cmd = favourite.removeSFOptions(cmd) listitem.setProperty('Path', cmd) listitem.setProperty('Fanart', fanart) listitem.setProperty('Desc', desc) listitem.setProperty('Mode', mode) if len(fave) > 3 and fave[3]: listitem.setProperty('IsFolder', 'true') self.favList.addItem(listitem) # add a dummy item with no action assigned #listitem = xbmcgui.ListItem(GETTEXT(30101)) #listitem.setProperty('Path', 'noop') #self.favList.addItem(listitem) self.setFocus(self.favList)
def onInit(self): try: self.favList = self.getControl(6) self.getControl(3).setVisible(False) except: self.favList = self.getControl(3) self.getControl(5).setVisible(False) self.getControl(1).setLabel(GETTEXT(30000)) #the remove item self.favList.addItem(xbmcgui.ListItem(GETTEXT(30100), iconImage='DefaultAddonNone.png')) if self.mode != 'xbmc': self.addFolderItem() if self.mode == 'root': self.addXBMCFavouritesItem() for fave in self.faves: listitem = xbmcgui.ListItem(fave[0]) listitem.setIconImage(fave[1]) listitem.setProperty('Icon', fave[1]) cmd = fave[2] if cmd.lower().startswith('activatewindow'): cmd = cmd.replace('")', '",return)') cmd = favourite.removeSFOptions(cmd) listitem.setProperty('Path', cmd) if len(fave) > 3 and fave[3]: listitem.setProperty('IsFolder', 'true') self.favList.addItem(listitem) # add a dummy item with no action assigned listitem = xbmcgui.ListItem(GETTEXT(30101)) listitem.setProperty('Path', 'noop') self.favList.addItem(listitem) self.setFocus(self.favList)
def playSF(url): launchID = '10025' if xbmcgui.Window(10000).getProperty('OTT_LAUNCH_ID') == launchID: url = url.replace('ActivateWindow(%s' % launchID, 'ActivateWindow(10501') launchID = '10501' try: if url.startswith('__SF__'): url = url.replace('__SF__', '') if url.lower().startswith('playmedia'): xbmc.executebuiltin(url) return True, '' if url.lower().startswith('runscript'): xbmc.executebuiltin(url) return True, '' if url.lower().startswith('activatewindow'): import sys sfAddon = xbmcaddon.Addon(id='plugin.program.super.favourites') sfPath = sfAddon.getAddonInfo('path') sys.path.insert(0, sfPath) import favourite import re import urllib original = re.compile('"(.+?)"').search(url).group(1) original = original.replace( '%26', 'SF_AMP_SF') #protect '&' within parameters cmd = urllib.unquote_plus(original) try: noFanart = favourite.removeFanart(cmd) except: pass try: noFanart = favourite.removeSFOptions(cmd) except: pass if noFanart.endswith(os.path.sep): noFanart = noFanart[:-1] noFanart = noFanart.replace('+', '%2B') noFanart = noFanart.replace(' ', '+') url = url.replace(original, noFanart) url = url.replace('SF_AMP_SF', '%26') #put '&' back xbmc.executebuiltin(url) return True, '' import urllib params = url.split('?', 1)[-1] params = get_params(params) try: mode = int(urllib.unquote_plus(params['mode'])) except: return False, url if mode != 400: return False, url try: path = urllib.unquote_plus(params['path']) except: path = None dirs = [] if path: try: current, dirs, files = os.walk(path).next() except: pass if len(dirs) == 0: import sys path = os.path.join(path, 'favourites.xml') sfAddon = xbmcaddon.Addon(id='plugin.program.super.favourites') sfPath = sfAddon.getAddonInfo('path') sys.path.insert(0, sfPath) import favourite faves = favourite.getFavourites(path) if len(faves) == 1: fave = faves[0][2] if fave.lower().startswith('playmedia'): import re cmd = re.compile('"(.+?)"').search(fave).group(1) return False, cmd except Exception, e: print str(e) pass
def playSF(url): launchID = '10025' if xbmcgui.Window(10000).getProperty('OTT_LAUNCH_ID') == launchID: url = url.replace('ActivateWindow(%s' % launchID, 'ActivateWindow(10501') launchID = '10501' try: if url.startswith('__SF__'): url = url.replace('__SF__', '') if url.lower().startswith('playmedia'): xbmc.executebuiltin(url) return True, '' if url.lower().startswith('runscript'): xbmc.executebuiltin(url) return True, '' if url.lower().startswith('activatewindow'): import sys sfAddon = xbmcaddon.Addon(id = 'plugin.program.super.favourites') sfPath = sfAddon.getAddonInfo('path') sys.path.insert(0, sfPath) import favourite import re import urllib original = re.compile('"(.+?)"').search(url).group(1) original = original.replace('%26', 'SF_AMP_SF') #protect '&' within parameters cmd = urllib.unquote_plus(original) try: noFanart = favourite.removeFanart(cmd) except: pass try: noFanart = favourite.removeSFOptions(cmd) except: pass if noFanart.endswith(os.path.sep): noFanart = noFanart[:-1] noFanart = noFanart.replace('+', '%2B') noFanart = noFanart.replace(' ', '+') url = url.replace(original, noFanart) url = url.replace('SF_AMP_SF', '%26') #put '&' back xbmc.executebuiltin(url) return True, '' import urllib params = url.split('?', 1)[-1] params = get_params(params) try: mode = int(urllib.unquote_plus(params['mode'])) except: return False, url if mode != 400: return False, url try: path = urllib.unquote_plus(params['path']) except: path = None dirs = [] if path: try: current, dirs, files = os.walk(path).next() except: pass if len(dirs) == 0: import sys path = os.path.join(path, 'favourites.xml') sfAddon = xbmcaddon.Addon(id = 'plugin.program.super.favourites') sfPath = sfAddon.getAddonInfo('path') sys.path.insert(0, sfPath) import favourite faves = favourite.getFavourites(path) if len(faves) == 1: fave = faves[0][2] if fave.lower().startswith('playmedia'): import re cmd = re.compile('"(.+?)"').search(fave).group(1) return False, cmd except Exception, e: print str(e) pass
def playSF(url): try: if url.startswith("__SF__"): url = url.replace("__SF__", "") if url.lower().startswith("playmedia"): xbmc.executebuiltin(url) return True, "" if url.lower().startswith("runscript"): xbmc.executebuiltin(url) return True, "" if url.lower().startswith("activatewindow"): import sys sfAddon = xbmcaddon.Addon(id="plugin.program.super.favourites") sfPath = sfAddon.getAddonInfo("path") sys.path.insert(0, sfPath) import favourite import re import urllib original = re.compile('"(.+?)"').search(url).group(1) original = original.replace("%26", "SF_AMP_SF") # protect '&' within parameters cmd = urllib.unquote_plus(original) try: noFanart = favourite.removeFanart(cmd) except: pass try: noFanart = favourite.removeSFOptions(cmd) except: pass if noFanart.endswith(os.path.sep): noFanart = noFanart[:-1] noFanart = noFanart.replace("+", "%2B") noFanart = noFanart.replace(" ", "+") url = url.replace(original, noFanart) url = url.replace("SF_AMP_SF", "%26") # put '&' back xbmc.executebuiltin(url) return True, "" import urllib params = url.split("?", 1)[-1] params = get_params(params) try: mode = int(urllib.unquote_plus(params["mode"])) except: return False, url if mode != 400: return False, url try: path = urllib.unquote_plus(params["path"]) except: path = None dirs = [] if path: try: current, dirs, files = os.walk(path).next() except: pass if len(dirs) == 0: import sys path = os.path.join(path, "favourites.xml") sfAddon = xbmcaddon.Addon(id="plugin.program.super.favourites") sfPath = sfAddon.getAddonInfo("path") sys.path.insert(0, sfPath) import favourite faves = favourite.getFavourites(path) if len(faves) == 1: fave = faves[0][2] if fave.lower().startswith("playmedia"): import re cmd = re.compile('"(.+?)"').search(fave).group(1) return False, cmd except Exception, e: print str(e) pass