diff --git a/addon.xml b/addon.xml index 96bf9a7..1538f1e 100644 --- a/addon.xml +++ b/addon.xml @@ -1,5 +1,5 @@ - + @@ -36,8 +36,8 @@ all See LICENSE.txt - http://www.urepo.org/forum/viewtopic.php?t=1763 - Available from the URepo repository + currently none + currently none icon.png fanart.jpg diff --git a/plugin.py b/plugin.py index f8d49be..8aa55e6 100644 --- a/plugin.py +++ b/plugin.py @@ -204,23 +204,29 @@ def _setList(self, target): except: pass + prefix = '' # Check if the classification is restricting this item isBlockedByClassification = False if 'mpaa' in item: if item['mpaa'] not in [None, ""]: + prefix += 'bC ' isBlockedByClassification = True # Add a tick if security is set if item['securityLevel'] != 0: li.setInfo('video', {'PlayCount': 1}) + prefix += 's ' # Not the best display format - but the only way that I can get a number to display # In the list, the problem is it will display 01:00 - but at least it's something if Settings.showSecurityLevelInPlugin(): li.setInfo('video', {'Duration': item['securityLevel']}) + elif Settings.isHighlightClassificationUnprotectedVideos(): # If the user wishes to see which files are not protected by one of the rules # currently applied, we put the play signal next to them + prefix += 'u ' if not isBlockedByClassification: + prefix += 'nC ' li.setProperty("TotalTime", "") li.setProperty("ResumeTime", "1") @@ -229,10 +235,15 @@ def _setList(self, target): # This is the case where the user has forced access to be allowed, this # is useful if you have classification enabled and you want to allow a # given video for a classification to be unprotected + prefix += 'or ' li.setProperty("TotalTime", "") li.setProperty("ResumeTime", "1") li.setProperty("Fanart_Image", item['fanart']) + if prefix: + prefix = '(' + prefix.strip() + ') ' + + li.setLabel(prefix + title) url = self._build_url({'mode': 'setsecurity', 'level': item['securityLevel'], 'type': target, 'title': title, 'id': dbid, 'classificationBlocked': str(isBlockedByClassification)}) xbmcplugin.addDirectoryItem(handle=self.addon_handle, url=url, listitem=li, isFolder=False) @@ -639,6 +650,10 @@ def setSecurity(self, type, title, id, oldLevel, classBlocked=False, forceLevel= if numLevels > 1 or classBlocked: # Need to prompt the user to see which pin they are trying to set displayNameList = [] + + # Add the option to allow item always + displayNameList.append("%s %s" % (ADDON.getLocalizedString(32211), "-1")) + # Add the option to turn it off displayNameList.append("%s %s" % (ADDON.getLocalizedString(32211), ADDON.getLocalizedString(32013))) for i in range(1, numLevels + 1): @@ -656,7 +671,7 @@ def setSecurity(self, type, title, id, oldLevel, classBlocked=False, forceLevel= select = xbmcgui.Dialog().select(ADDON.getLocalizedString(32001), displayNameList) if select != -1: - level = select + level = select - 1 # because first element is now -1 (because of to allow item always) if classBlocked and (select >= (len(displayNameList) - 1)): level = -1 log("Setting security level to %d" % level) @@ -703,7 +718,8 @@ def setSecurity(self, type, title, id, oldLevel, classBlocked=False, forceLevel= self._setBulkSecurity(type, level) xbmc.executebuiltin("Dialog.Close(busydialog)") - xbmc.executebuiltin("Container.Refresh") + # longer lists always start from the beginning. crude workaround: + #xbmc.executebuiltin("Container.Refresh") # Sets the security details on all the Movies in a given Movie Set def _setSecurityOnMoviesInMovieSets(self, setid, level): diff --git a/resources/lib/background.py b/resources/lib/background.py index 231c5d4..ca487a8 100644 --- a/resources/lib/background.py +++ b/resources/lib/background.py @@ -12,7 +12,7 @@ # Class to set the background while a pin is prompted for class Background(xbmcgui.WindowXML): - BACKGOUND_IMAGE_ID = 3004 + BACKGROUND_IMAGE_ID = 3004 @staticmethod def createBackground(): @@ -29,5 +29,5 @@ def onInit(self): if bgImage is not None: log("Background: Setting background image to %s" % bgImage) - bgImageCtrl = self.getControl(Background.BACKGOUND_IMAGE_ID) + bgImageCtrl = self.getControl(Background.BACKGROUND_IMAGE_ID) bgImageCtrl.setImage(bgImage) diff --git a/resources/lib/settings.py b/resources/lib/settings.py index 89b2908..c3feda8 100644 --- a/resources/lib/settings.py +++ b/resources/lib/settings.py @@ -279,6 +279,7 @@ class Settings(): @staticmethod def reloadSettings(): + global ADDON # Before loading the new settings save off the length of the pin # this means that if the length of the pin has changed and the actual # pin value has not, we can clear the pin value @@ -286,7 +287,6 @@ def reloadSettings(): pinValue = ADDON.getSetting("pinValue") # Force the reload of the settings to pick up any new values - global ADDON ADDON = xbmcaddon.Addon(id='script.pinsentry') if Settings.isPinSet(): diff --git a/resources/skins/Default/720p/pinsentry-background.xml b/resources/skins/Default/720p/pinsentry-background.xml index 75bae4b..f947df1 100644 --- a/resources/skins/Default/720p/pinsentry-background.xml +++ b/resources/skins/Default/720p/pinsentry-background.xml @@ -7,7 +7,7 @@ 0 1280 720 - screensaver-black.png + pinsentry-black.png Background Image diff --git a/service.py b/service.py index d5a77b4..ac99652 100644 --- a/service.py +++ b/service.py @@ -33,7 +33,8 @@ class PinSentry(): @staticmethod def isPinSentryEnabled(): # Check if the Pin is set, as no point prompting if it is not - if (not Settings.isPinSet()) or (not Settings.isPinActive()): + # also check correct level + if (not Settings.isPinSet(Settings.getNumberOfLevels())) or (not Settings.isPinActive()): return False return True @@ -69,7 +70,7 @@ def getCachedPinLevel(): return PinSentry.pinLevelCached @staticmethod - def promptUserForPin(requiredLevel=1): + def promptUserForPin(requiredLevel=1, showBackgroundLonger = False): userHasAccess = True # Set the background @@ -81,15 +82,20 @@ def promptUserForPin(requiredLevel=1): numberpad = NumberPad.createNumberPad() numberpad.doModal() - # Remove the background if we had one - if background is not None: - background.close() - del background - # Get the code that the user entered enteredPin = numberpad.getPin() del numberpad + # quick workaround for not showing the pin in the time line when entering it + # TODO: make it configureable? + if showBackgroundLonger: + xbmc.sleep(3000) + + # Remove the background if we had one + if background is not None: + background.close() + del background + # Find out what level this pin gives access to # This will be the highest level pinMatchLevel = Settings.getSecurityLevelForPin(enteredPin) @@ -367,7 +373,7 @@ def onPlayBackStarted(self): log("PinSentryPlayer: Paused video to check if OK to play") # Prompt the user for the pin, returns True if they knew it - if PinSentry.promptUserForPin(securityLevel): + if PinSentry.promptUserForPin(securityLevel, True): log("PinSentryPlayer: Resuming video") # Pausing again will start the video playing again if muted: @@ -497,7 +503,7 @@ def checkMovieSets(self): return # Prompt the user for the pin, returns True if they knew it - if PinSentry.promptUserForPin(securityLevel): + if PinSentry.promptUserForPin(securityLevel, True): log("NavigationRestrictions: Allowed access to movie set %s" % moveSetName) else: log("NavigationRestrictions: Not allowed access to movie set %s which has security level %d" % (moveSetName, securityLevel)) @@ -1102,18 +1108,20 @@ def shutdown(self, reason=0): navRestrictions = NavigationRestrictions() pvrMonitor = PvrMonitor() - displayNotice = True - json_query = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "Addons.GetAddonDetails", "params": { "addonid": "repository.urepo", "properties": ["enabled", "broken", "name", "author"] }, "id": 1}') - json_response = json.loads(json_query) - - if ("result" in json_response) and ('addon' in json_response['result']): - addonItem = json_response['result']['addon'] - if (addonItem['enabled'] is True) and (addonItem['broken'] is False) and (addonItem['type'] == 'xbmc.addon.repository') and (addonItem['addonid'] == 'repository.urepo'): - displayNotice = False - - if displayNotice: - xbmc.executebuiltin('Notification("URepo Repository Required","www.urepo.org",10000,%s)' % ADDON.getAddonInfo('icon')) - else: +# displayNotice = True +# json_query = xbmc.executeJSONRPC('{"jsonrpc": "2.0", "method": "Addons.GetAddonDetails", "params": { "addonid": "repository.urepo", "properties": ["enabled", "broken", "name", "author"] }, "id": 1}') +# json_response = json.loads(json_query) + +# as long as there is no repository: +# if ("result" in json_response) and ('addon' in json_response['result']): +# addonItem = json_response['result']['addon'] +# if (addonItem['enabled'] is True) and (addonItem['broken'] is False) and (addonItem['type'] == 'xbmc.addon.repository') and (addonItem['addonid'] == 'repository.urepo'): +# displayNotice = False +# +# if displayNotice: +# xbmc.executebuiltin('Notification("URepo Repository Required","www.urepo.org",10000,%s)' % ADDON.getAddonInfo('icon')) +# else: + if True: loopsUntilUserControlCheck = 0 while (not xbmc.abortRequested): # There are two types of startup, the first is a genuine startup when diff --git a/wiki.txt b/wiki.txt index c315cfe..329a91b 100644 --- a/wiki.txt +++ b/wiki.txt @@ -11,7 +11,7 @@ After install you need to: * Enable which videos you want the pin to be displayed for (Either via Settings, Programs->PinSenty or Videos->Addons->PinSentry)

-== Pin Contol == +== Pin Control == Whenever a user selects an item that has been protected by PinSentry they will be prompted with a dialog like the following:
[[https://github.com/robwebset/repository.robwebset/raw/master/script.pinsentry/images/PinSentry-PinDialog1.JPG|200px]]