def showRootMenu(self): # Movies url = self._build_url({'mode': 'folder', 'foldername': MenuNavigator.MOVIES}) li = xbmcgui.ListItem(__addon__.getLocalizedString(32201), iconImage=__icon__) li.setProperty("Fanart_Image", __fanart__) li.addContextMenuItems([], replaceItems=True) xbmcplugin.addDirectoryItem(handle=self.addon_handle, url=url, listitem=li, isFolder=True) # TV Shows url = self._build_url({'mode': 'folder', 'foldername': MenuNavigator.TVSHOWS}) li = xbmcgui.ListItem(__addon__.getLocalizedString(32202), iconImage=__icon__) li.setProperty("Fanart_Image", __fanart__) li.addContextMenuItems([], replaceItems=True) xbmcplugin.addDirectoryItem(handle=self.addon_handle, url=url, listitem=li, isFolder=True) # Movie Sets url = self._build_url({'mode': 'folder', 'foldername': MenuNavigator.MOVIESETS}) li = xbmcgui.ListItem(__addon__.getLocalizedString(32203), iconImage=__icon__) li.setProperty("Fanart_Image", __fanart__) li.addContextMenuItems([], replaceItems=True) xbmcplugin.addDirectoryItem(handle=self.addon_handle, url=url, listitem=li, isFolder=True) # Plugins if Settings.isActivePlugins(): url = self._build_url({'mode': 'folder', 'foldername': MenuNavigator.PLUGINS}) li = xbmcgui.ListItem(__addon__.getLocalizedString(32204), iconImage=__icon__) li.setProperty("Fanart_Image", __fanart__) li.addContextMenuItems([], replaceItems=True) xbmcplugin.addDirectoryItem(handle=self.addon_handle, url=url, listitem=li, isFolder=True) xbmcplugin.endOfDirectory(self.addon_handle)
def checkPlugins(self): navPath = xbmc.getInfoLabel("Container.FolderPath") if 'plugin://' not in navPath: # No Plugin currently set self.lastPluginChecked = "" return # Check if we are in a plugin location pluginName = xbmc.getInfoLabel("Container.FolderName") if pluginName in [None, "", self.lastPluginChecked]: # No Plugin currently set or this is a Plugin that has already been checked return # If we reach here we have aPlugin that we need to check log("NavigationRestrictions: Checking access to view Plugin: %s" % pluginName) self.lastPluginChecked = pluginName # Check for the case where the user does not want to check plugins # but the Pin Sentry plugin is selected, we always need to check this # as it is how permissions are set if (not Settings.isActivePlugins()) and ('PinSentry' not in pluginName): return securityLevel = 0 # Check to see if the user should have access to this plugin pinDB = PinSentryDB() securityLevel = pinDB.getPluginSecurityLevel(pluginName) if securityLevel < 1: # Check for the special case that we are accessing ourself # in which case we have a minimum security level if 'PinSentry' in pluginName: securityLevel = Settings.getSettingsSecurityLevel() else: log("NavigationRestrictions: No security enabled for plugin %s" % pluginName) return del pinDB # Check if we have already cached the pin number and at which level if PinSentry.getCachedPinLevel() >= securityLevel: log("NavigationRestrictions: Already cached pin at level %d, allowing access" % PinSentry.getCachedPinLevel()) return # Prompt the user for the pin, returns True if they knew it if PinSentry.promptUserForPin(securityLevel): log("NavigationRestrictions: Allowed access to plugin %s" % pluginName) else: log("NavigationRestrictions: Not allowed access to plugin %s which has security level %d" % (pluginName, securityLevel)) # Move back to the Video plugin Screen as they are not allowed where they are at the moment xbmc.executebuiltin("ActivateWindow(Video,addons://sources/video/)", True) # Clear the previous plugin as we will want to prompt for the pin again if the # user navigates there again self.lastPluginChecked = "" PinSentry.displayInvalidPinMessage(securityLevel)
def showRootMenu(self): # Movies url = self._build_url({'mode': 'folder', 'foldername': MenuNavigator.MOVIES}) li = xbmcgui.ListItem(__addon__.getLocalizedString(32201), iconImage=__icon__) li.setProperty("Fanart_Image", __fanart__) li.addContextMenuItems(self._getContextMenu(MenuNavigator.MOVIES), replaceItems=True) xbmcplugin.addDirectoryItem(handle=self.addon_handle, url=url, listitem=li, isFolder=True) # TV Shows url = self._build_url({'mode': 'folder', 'foldername': MenuNavigator.TVSHOWS}) li = xbmcgui.ListItem(__addon__.getLocalizedString(32202), iconImage=__icon__) li.setProperty("Fanart_Image", __fanart__) li.addContextMenuItems(self._getContextMenu(MenuNavigator.TVSHOWS), replaceItems=True) xbmcplugin.addDirectoryItem(handle=self.addon_handle, url=url, listitem=li, isFolder=True) # Movie Sets url = self._build_url({'mode': 'folder', 'foldername': MenuNavigator.MOVIESETS}) li = xbmcgui.ListItem(__addon__.getLocalizedString(32203), iconImage=__icon__) li.setProperty("Fanart_Image", __fanart__) li.addContextMenuItems(self._getContextMenu(MenuNavigator.MOVIESETS), replaceItems=True) xbmcplugin.addDirectoryItem(handle=self.addon_handle, url=url, listitem=li, isFolder=True) # Music Videos url = self._build_url({'mode': 'folder', 'foldername': MenuNavigator.MUSICVIDEOS}) li = xbmcgui.ListItem(__addon__.getLocalizedString(32205), iconImage=__icon__) li.setProperty("Fanart_Image", __fanart__) li.addContextMenuItems(self._getContextMenu(MenuNavigator.MUSICVIDEOS), replaceItems=True) xbmcplugin.addDirectoryItem(handle=self.addon_handle, url=url, listitem=li, isFolder=True) # Plugins if Settings.isActivePlugins(): url = self._build_url({'mode': 'folder', 'foldername': MenuNavigator.PLUGINS}) li = xbmcgui.ListItem(__addon__.getLocalizedString(32128), iconImage=__icon__) li.setProperty("Fanart_Image", __fanart__) li.addContextMenuItems([], replaceItems=True) xbmcplugin.addDirectoryItem(handle=self.addon_handle, url=url, listitem=li, isFolder=True) # Files if Settings.isActiveFileSource(): url = self._build_url({'mode': 'folder', 'foldername': MenuNavigator.FILESOURCE}) li = xbmcgui.ListItem(__addon__.getLocalizedString(32204), iconImage=__icon__) li.setProperty("Fanart_Image", __fanart__) li.addContextMenuItems([], replaceItems=True) xbmcplugin.addDirectoryItem(handle=self.addon_handle, url=url, listitem=li, isFolder=True) # Classifications url = self._build_url({'mode': 'folder', 'foldername': MenuNavigator.CLASSIFICATIONS}) li = xbmcgui.ListItem(__addon__.getLocalizedString(32206), iconImage=__icon__) li.setProperty("Fanart_Image", __fanart__) li.addContextMenuItems([], replaceItems=True) xbmcplugin.addDirectoryItem(handle=self.addon_handle, url=url, listitem=li, isFolder=True) xbmcplugin.endOfDirectory(self.addon_handle)