def doMenu(): folder = xbmc.getInfoLabel('Container.FolderPath') if config.ADDONID in folder: xbmc.executebuiltin('XBMC.Action(ContextMenu)') return choice = 0 path = xbmc.getInfoLabel('ListItem.FolderPath') if len(path) > 0: menu = [] menu.append((__language__(30009), 1)) menu.append((__language__(30010), 2)) menu.append((__language__(30011), 0)) choice = contextmenu.showMenu(config.ADDONID, menu) if choice == None: return if choice == 0: xbmc.executebuiltin('XBMC.Action(ContextMenu)') return if choice == 2: config.ADDON.openSettings() return if choice == 1: runExternal(path)
def onContextMenu(self): if self.context: return liz = self.getSelectedItem() index = int(liz.getProperty('Index')) item = self.list[index] menu = item['ContextMenu'] replaceItems = liz.getProperty('ReplaceItems') == 'true' if not replaceItems: menu = list(menu + self.getSTDMenu(liz)) if len(menu) < 1: return import contextmenu self.context = True params = contextmenu.showMenu(self.ADDONID, menu) self.context = False if not params: return if self.trySTDMenu(params): return self.onParams(params, isFolder=False)
def doMenu(): folder = xbmc.getInfoLabel("Container.FolderPath") if config.ADDONID in folder: xbmc.executebuiltin("XBMC.Action(ContextMenu)") return choice = 0 path = xbmc.getInfoLabel("ListItem.FolderPath") if len(path) > 0: menu = [] menu.append((__language__(30009), 1)) menu.append((__language__(30010), 2)) menu.append((__language__(30011), 0)) choice = contextmenu.showMenu(config.ADDONID, menu) if choice == None: return if choice == 0: xbmc.executebuiltin("XBMC.Action(ContextMenu)") return if choice == 2: config.ADDON.openSettings() return if choice == 1: runExternal(path)
def doMenu(): folder = xbmc.getInfoLabel('Container.FolderPath') if config.ADDONID in folder: xbmc.executebuiltin('XBMC.Action(ContextMenu)') return choice = 0 path = xbmc.getInfoLabel('ListItem.FolderPath') if len(path) > 0: menu = [] menu.append(('Activate Datho-Digital VPN', 1)) menu.append(('Datho-Digital VPN Settings', 2)) menu.append(('Standard context menu', 0)) choice = contextmenu.showMenu(config.ADDONID, menu) if choice == None: return if choice == 0: xbmc.executebuiltin('XBMC.Action(ContextMenu)') return if choice == 2: config.ADDON.openSettings() return if choice == 1: runExternal(path)
def doMenu(): try: import utils except: doStandard(useScript=False) return active = [1, 2, 25, 40, 500, 501, 502] #28 is video Playlist window = xbmcgui.getCurrentWindowId() utils.log('Window : %d' % window) if window - 10000 not in active: doStandard(useScript=False) return import contextmenu # to prevent master profile setting being used in other profiles if utils.ADDON.getSetting('CONTEXT') != 'true': doStandard(useScript=False) return folder = xbmc.getInfoLabel('Container.FolderPath') #ignore if in Super Favourites if utils.ADDONID in folder: doStandard(useScript=False) return choice = 0 label = xbmc.getInfoLabel('ListItem.Label') path = xbmc.getInfoLabel('ListItem.FolderPath') filename = xbmc.getInfoLabel('ListItem.FilenameAndPath') name = xbmc.getInfoLabel('ListItem.Label') thumb = xbmc.getInfoLabel('ListItem.Thumb') playable = xbmc.getInfoLabel( 'ListItem.Property(IsPlayable)').lower() == 'true' fanart = xbmc.getInfoLabel('ListItem.Property(Fanart_Image)') isFolder = xbmc.getCondVisibility('ListItem.IsFolder') == 1 try: file = xbmc.Player().getPlayingFile() except: file = None isStream = False if file: isStream = file.startswith('http://') #GOTHAM only #if hasattr(xbmc.Player(), 'isInternetStream'): # isStream = xbmc.Player().isInternetStream() #elif file: # isStream = file.startswith('http://') utils.log('**** Context Menu Information ****') utils.log('Label : %s' % label) utils.log('Folder : %s' % folder) utils.log('Path : %s' % path) utils.log('Filename : %s' % filename) utils.log('Name : %s' % name) utils.log('Thumb : %s' % thumb) utils.log('Fanart : %s' % fanart) utils.log('Window : %d' % window) utils.log('IsPlayable : %s' % playable) utils.log('IsFolder : %s' % isFolder) utils.log('File : %s' % file) utils.log('IsStream : %s' % isStream) menu = [] #if (len(menu) == 0) and window == 12005: #video playing #if isStream: # menu.append(('Download %s' % label, _DOWNLOAD)) # menu.append(('Show Playlist', _PLAYLIST)) #else: # return doStandard() #cancel download feature for now #return doStandard() if (len(menu) == 0) and len(path) > 0: ytID = '' if path.startswith( 'plugin://plugin.video.youtube') and 'videoid=' in path: try: ytID = path.rsplit('videoid=', 1)[-1][0:11] menu.append((utils.GETTEXT(30104), _PLAYTUBE)) except: ytID = '' utils.verifySuperSearch() default = getDefaultSearch() menu.append((utils.GETTEXT(30047), _ADDTOFAVES)) menu.append((utils.GETTEXT(30049), _SF_SETTINGS)) menu.append((utils.GETTEXT(30054), _SEARCH)) if len(default) > 0: menu.append((utils.GETTEXT(30098) % default, _SEARCHDEF)) menu.append((utils.GETTEXT(30048), _STD_SETTINGS)) #elif window == 10000: #Home screen # menu.append((utils.GETTEXT(30053), _LAUNCH_SF)) # menu.append((utils.GETTEXT(30049), _SF_SETTINGS)) if len(menu) == 0: doStandard() return xbmcgui.Window(10000).setProperty('SF_MENU_VISIBLE', 'true') choice = contextmenu.showMenu(utils.ADDONID, menu) if choice == _STD_SETTINGS: doStandard() return xbmc.executebuiltin('Dialog.Close(all, true)') if choice == _PLAYLIST: xbmc.executebuiltin('ActivateWindow(videoplaylist)') #if choice == _DOWNLOAD: # import download # download.download(file, 'c:\\temp\\file.mpg', 'Super Favourites') if choice == _PLAYTUBE: if len(ytID) != 11: return import yt if not yt.PlayVideo(ytID): utils.DialogOK(utils.GETTEXT(30105)) if choice == _STD_SETTINGS: doStandard() if choice == _SF_SETTINGS: utils.ADDON.openSettings() if choice == _ADDTOFAVES: if isFolder: cmd = 'ActivateWindow(%d,"%s' % (window, path) elif path.lower().startswith('script'): if path[-1] == '/': path = path[:-1] cmd = 'RunScript("%s' % path.replace('script://', '') elif path.lower().startswith('videodb') and len(filename) > 0: cmd = 'PlayMedia("%s' % filename #elif path.lower().startswith('musicdb') and len(filename) > 0: # cmd = 'PlayMedia("%s")' % filename else: cmd = 'PlayMedia("%s&sf_win_id=%d_' % (path, window) import urllib if '?' in cmd: cmd += '&' else: cmd += '?' cmd += 'sf_fanart=%s_")' % urllib.quote_plus(fanart) copyFave(name, thumb, cmd) if choice == _LAUNCH_SF: xbmc.executebuiltin('ActivateWindow(programs,plugin://%s)' % utils.ADDONID) if choice == _SEARCH or choice == _SEARCHDEF: if utils.ADDON.getSetting('STRIPNUMBERS') == 'true': name = clean(name) thumb = thumb if len(thumb) > 0 else 'null' fanart = fanart if len(fanart) > 0 else 'null' _SUPERSEARCH = 0 #declared as 0 in default.py _SUPERSEARCHDEF = 10 #declared as 10 in default.py mode = _SUPERSEARCH if (choice == _SEARCH) else _SUPERSEARCHDEF videoID = 10025 #video if window == 10000: #don't activate on home screen, push to video window = videoID import urllib cmd = 'ActivateWindow(%d,"plugin://%s/?mode=%d&keyword=%s&image=%s&fanart=%s")' % ( window, utils.ADDONID, mode, urllib.quote_plus(name), urllib.quote_plus(thumb), urllib.quote_plus(fanart)) activateCommand(cmd)
def doMenu(): try: import utils except: doStandard() return import contextmenu # to prevent master profile setting being used in other profiles if utils.ADDON.getSetting('CONTEXT') != 'true': doStandard() return folder = xbmc.getInfoLabel('Container.FolderPath') #ignore if in Super Favourites if utils.ADDONID in folder: doStandard() return choice = 0 label = xbmc.getInfoLabel('ListItem.Label') path = xbmc.getInfoLabel('ListItem.FolderPath') filename = xbmc.getInfoLabel('ListItem.FilenameAndPath') name = xbmc.getInfoLabel('ListItem.Label') thumb = xbmc.getInfoLabel('ListItem.Thumb') window = xbmcgui.getCurrentWindowId() playable = xbmc.getInfoLabel('ListItem.Property(IsPlayable)').lower() == 'true' fanart = xbmc.getInfoLabel('ListItem.Property(Fanart_Image)') isFolder = xbmc.getCondVisibility('ListItem.IsFolder') == 1 try: file = xbmc.Player().getPlayingFile() except: file = None isStream = False if file: isStream = file.startswith('http://') #GOTHAM only #if hasattr(xbmc.Player(), 'isInternetStream'): # isStream = xbmc.Player().isInternetStream() #elif file: # isStream = file.startswith('http://') #print '**** Context Menu Information ****' #print 'Label : %s' % label #print 'Folder : %s' % folder #print 'Path : %s' % path #print 'Filename : %s' % filename #print 'Name : %s' % name #print 'Thumb : %s' % thumb #print 'Fanart : %s' % fanart #print 'Window : %d' % window #print 'IsPlayable : %s' % playable #print 'IsFolder : %s' % isFolder #print 'File : %s' % file #print 'IsStream : %s' % isStream menu = [] if (len(menu) == 0) and window == 12005: #video playing if isStream: menu.append(('Download %s' % label, _DOWNLOAD)) menu.append(('Show Playlist', _PLAYLIST)) else: return doStandard() #cancel download feature for now return doStandard() if (len(menu) == 0) and len(path) > 0: ytID = '' if path.startswith('plugin://plugin.video.youtube') and 'videoid=' in path: try: ytID = path.rsplit('videoid=', 1)[-1][0:11] menu.append((utils.GETTEXT(30104), _PLAYTUBE)) except: ytID = '' utils.verifySuperSearch() default = getDefaultSearch() menu.append((utils.GETTEXT(30047), _ADDTOFAVES)) menu.append((utils.GETTEXT(30049), _SF_SETTINGS)) menu.append((utils.GETTEXT(30054), _SEARCH)) if len(default) > 0: menu.append((utils.GETTEXT(30098) % default, _SEARCHDEF)) menu.append((utils.GETTEXT(30048), _STD_SETTINGS)) #elif window == 10000: #Home screen # menu.append((utils.GETTEXT(30053), _LAUNCH_SF)) # menu.append((utils.GETTEXT(30049), _SF_SETTINGS)) if len(menu) == 0: doStandard() return xbmcgui.Window(10000).setProperty('SF_MENU_VISIBLE', 'true') choice = contextmenu.showMenu(utils.ADDONID, menu) if choice == _PLAYLIST: xbmc.executebuiltin('ActivateWindow(videoplaylist)') #if choice == _DOWNLOAD: # import download # download.download(file, 'c:\\temp\\file.mpg', 'Super Favourites') if choice == _PLAYTUBE: if len(ytID) != 11: return import yt if not yt.PlayVideo(ytID): utils.DialogOK(utils.GETTEXT(30105)) if choice == _STD_SETTINGS: xbmc.executebuiltin('Dialog.Close(all, true)') xbmc.executebuiltin('Action(ContextMenu)') if choice == _SF_SETTINGS: utils.ADDON.openSettings() if choice == _ADDTOFAVES: if isFolder: cmd = 'ActivateWindow(%d,"%s")' % (window, path) elif path.lower().startswith('script'): if path[-1] == '/': path = path[:-1] cmd = 'RunScript("%s")' % path.replace('script://', '') elif path.lower().startswith('videodb') and len(filename) > 0: cmd = 'PlayMedia("%s")' % filename #elif path.lower().startswith('musicdb') and len(filename) > 0: # cmd = 'PlayMedia("%s")' % filename else: cmd = 'PlayMedia("%s&sf_win_id=%d_")' % (path, window) copyFave(name, thumb, cmd) if choice == _LAUNCH_SF: xbmc.executebuiltin('ActivateWindow(programs,plugin://%s)' % utils.ADDONID) if choice == _SEARCH or choice == _SEARCHDEF: if utils.ADDON.getSetting('STRIPNUMBERS') == 'true': name = clean(name) thumb = thumb if len(thumb) > 0 else 'null' fanart = fanart if len(fanart) > 0 else 'null' _SUPERSEARCH = 0 #declared as 0 in default.py _SUPERSEARCHDEF = 10 #declared as 10 in default.py mode = _SUPERSEARCH if (choice == _SEARCH) else _SUPERSEARCHDEF winID = 10025 #video import urllib cmd = 'ActivateWindow(%d,"plugin://%s/?mode=%d&keyword=%s&image=%s&fanart=%s")' % (window, utils.ADDONID, mode, urllib.quote_plus(name), urllib.quote_plus(thumb), urllib.quote_plus(fanart)) activateCommand(cmd)