本文整理汇总了Python中resources.lib.settings.Settings类的典型用法代码示例。如果您正苦于以下问题:Python Settings类的具体用法?Python Settings怎么用?Python Settings使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Settings类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: _moveToThemeFolder
def _moveToThemeFolder(self, directory):
log("moveToThemeFolder: path = %s" % directory)
# Handle the case where we have a disk image
if (os_path_split(directory)[1] == 'VIDEO_TS') or (os_path_split(directory)[1] == 'BDMV'):
directory = os_path_split(directory)[0]
dirs, files = list_dir(directory)
for aFile in files:
m = re.search(Settings.getThemeFileRegEx(directory), aFile, re.IGNORECASE)
if m:
srcpath = os_path_join(directory, aFile)
log("fetchAllMissingThemes: Found match: %s" % srcpath)
targetpath = os_path_join(directory, Settings.getThemeDirectory())
# Make sure the theme directory exists
if not dir_exists(targetpath):
try:
xbmcvfs.mkdir(targetpath)
except:
log("fetchAllMissingThemes: Failed to create directory: %s" % targetpath, True, xbmc.LOGERROR)
break
else:
log("moveToThemeFolder: directory already exists %s" % targetpath)
# Add the filename to the path
targetpath = os_path_join(targetpath, aFile)
if not xbmcvfs.rename(srcpath, targetpath):
log("moveToThemeFolder: Failed to move file from %s to %s" % (srcpath, targetpath))
示例2: check
def check(self):
# If we have found the correct user, then we need to ensure we are
# in the valid time duration and have not exceeded the limit
if not self.isEnabled:
return True
# Check for the case where we didn't get the user ID - this means we are
# already shutting down
if self.userId in [None, ""]:
return False
log("UserPinControl: Performing check for user %s" % self.userId)
# First check that the current time is within the allowed boundaries
localTime = time.localtime()
currentTime = (localTime.tm_hour * 60) + localTime.tm_min
if self.allowedStartTime > currentTime or self.allowedEndTime < currentTime:
log("UserPinControl: User not allowed access until %d to %d currently %d" % (self.allowedStartTime, self.allowedEndTime, currentTime))
self.shutdown(32130)
return False
# Check if the screensaver is running, if so we need to make sure we do not
# class that as time used by the user
if xbmc.getCondVisibility("System.ScreenSaverActive"):
if self.screensaverStart < 1:
self.screensaverStart = currentTime
else:
# Not the screensaver, check to see if this is the first check
# after the screensaver stopped
if self.screensaverStart > 0:
screensaverDuration = currentTime - self.screensaverStart
self.screensaverStart = 0
log("UserPinControl: Updating duration for screensaver, %d minutes" % screensaverDuration)
# Now we roll the time forward that we started viewing so that
# we are not counting the screensaver
self.startedViewing = self.startedViewing + screensaverDuration
# Check to see if we need to update the record for how long the user has already been viewing
viewingLimit = Settings.getUserViewingLimit(self.userId)
self.usedViewingLimit = currentTime - self.startedViewing
log("UserPinControl: Time used by user is %d" % self.usedViewingLimit)
# Update the settings record for how much this user has viewed so far
Settings.setUserViewingUsedTime(self.userId, self.usedViewingLimit)
# Now check to see if the user has exceeded their limit
if self.usedViewingLimit >= viewingLimit:
self.shutdown(32133)
return False
# Check if we need to warn the user that the time is running out
warningTime = Settings.getWarnExpiringTime()
if (not self.warningDisplayed) and ((self.usedViewingLimit + warningTime) >= viewingLimit):
self.warningDisplayed = True
# Calculate the time left
remainingTime = viewingLimit - self.usedViewingLimit
msg = "%d %s" % (remainingTime, ADDON.getLocalizedString(32134))
xbmcgui.Dialog().notification(ADDON.getLocalizedString(32001).encode('utf-8'), msg, ICON, 3000, False)
return True
示例3: onInit
def onInit(self):
# Need to clear the list of the default items
self.clearList()
# Start by adding an option to Play All
if len(self.files) > 0:
anItem = xbmcgui.ListItem(ADDON.getLocalizedString(32101), path=SourceDetails.getFilenameAndPath())
# Get the first items fanart for the play all option
anItem.setProperty("Fanart_Image", self.files[0].getFanArt())
if SourceDetails.getTvShowTitle() != "":
anItem.setInfo('video', {'TvShowTitle': SourceDetails.getTvShowTitle()})
if SourceDetails.getTitle() != "":
anItem.setInfo('video', {'Title': SourceDetails.getTitle()})
self.addItem(anItem)
# Check if we want to have YouTube Extra Support
if Settings.isYouTubeSearchSupportEnabled():
# Create the message to the YouTube Plugin
li = xbmcgui.ListItem(ADDON.getLocalizedString(32116))
# Need to set the title to get it in the header
if SourceDetails.getTvShowTitle() != "":
li.setInfo('video', {'TvShowTitle': SourceDetails.getTvShowTitle()})
if SourceDetails.getTitle() != "":
li.setInfo('video', {'Title': SourceDetails.getTitle()})
li.setProperty("Fanart_Image", SourceDetails.getFanArt())
li.setProperty("search", "/search/?q=%s+Extras" % urllib.quote_plus(SourceDetails.getTitle().encode('utf8')))
self.addItem(li)
# Check if we want to have Vimeo Extra Support
if Settings.isVimeoSearchSupportEnabled():
# Create the message to the Vimeo Plugin
li = xbmcgui.ListItem(ADDON.getLocalizedString(32122))
# Need to set the title to get it in the header
if SourceDetails.getTvShowTitle() != "":
li.setInfo('video', {'TvShowTitle': SourceDetails.getTvShowTitle()})
if SourceDetails.getTitle() != "":
li.setInfo('video', {'Title': SourceDetails.getTitle()})
li.setProperty("Fanart_Image", SourceDetails.getFanArt())
li.setProperty("search", "/search/?q=%s+Extras" % urllib.quote_plus(SourceDetails.getTitle().encode('utf8')))
self.addItem(li)
for anExtra in self.files:
log("VideoExtrasWindow: filename: %s" % anExtra.getFilename())
# Create the list item
anItem = anExtra.createListItem(path=SourceDetails.getFilenameAndPath(), parentTitle=SourceDetails.getTitle(), tvShowTitle=SourceDetails.getTvShowTitle())
self.addItem(anItem)
# Before we return, set back the selected on screen item to the one just watched
# This is in the case of a reload
if self.lastRecordedListPosition > 0:
self.setCurrentListPosition(self.lastRecordedListPosition)
xbmcgui.WindowXML.onInit(self)
示例4: start
def start():
global log
settings = Settings()
settings.getSettings()
kl = KodiLogger()
if settings.general['elevate_loglevel'] is True:
kl.setLogLevel(xbmc.LOGNOTICE)
else:
kl.setLogLevel(xbmc.LOGDEBUG)
log = kl.log
log(msg=_('Settings read'))
Cache.dispatcher = PubSub_Threaded.Dispatcher(interval=settings.general['TaskFreq'], sleepfxn=xbmc.sleep)
log(msg=_('Dispatcher initialized'))
subscriberfactory = SubscriberFactory(settings, kl)
subscribers = subscriberfactory.createSubscribers()
for subscriber in subscribers:
Cache.dispatcher.addSubscriber(subscriber)
publisherfactory = PublisherFactory(settings, subscriberfactory.topics, Cache.dispatcher, kl, debug)
publisherfactory.createPublishers()
Cache.publishers = publisherfactory.ipublishers
Cache.dispatcher.start()
log(msg=_('Dispatcher started'))
for p in Cache.publishers:
try:
p.start()
except threading.ThreadError:
raise
log(msg=_('Publisher(s) started'))
示例5: _updatePlaylistForSettings
def _updatePlaylistForSettings(self, playlist):
if playlist.size() < 1:
return playlist
filename = playlist[0].getfilename()
duration = self._getVideoDuration(filename)
log("Duration is %d for file %s" % (duration, filename))
startTime = 0
# Check if we have a random start time
if Settings.isRandomStart():
startTime = random.randint(0, int(duration * 0.75))
clockStart = Settings.getTimeForClock(filename, duration)
if clockStart > 0:
startTime = clockStart
# Set the random start
if (startTime > 0) and (duration > 10):
listitem = xbmcgui.ListItem()
# Record if the theme should start playing part-way through
listitem.setProperty('StartOffset', str(startTime))
log("Setting start of %d for %s" % (startTime, filename))
# Remove the old item from the playlist
playlist.remove(filename)
# Add the new item at the start of the list
playlist.add(filename, listitem, 0)
return playlist
示例6: __init__
def __init__(self):
# special://skin - This path points to the currently active skin's root directory.
skinExtrasOverlayBase = xbmc.translatePath("special://skin").decode("utf-8")
skinExtrasOverlayBase = os_path_join(skinExtrasOverlayBase, "media")
# Now check to see if the user has defines a different overlay image in the
# settings, as that is the main one that will be used
self.skinExtrasOverlay = Settings.getCustomOverlayImage()
self.skinExtrasOverlayList = Settings.getCustomListImage()
# Next check the skin specific overlay
if self.skinExtrasOverlay in [None, '']:
self.skinExtrasOverlay = os_path_join(skinExtrasOverlayBase, "videoextras_overlay.png")
if self.skinExtrasOverlayList in [None, '']:
self.skinExtrasOverlayList = os_path_join(skinExtrasOverlayBase, "videoextras_overlay_list.png")
log("VideoExtrasService: Looking for image overlay file: %s" % self.skinExtrasOverlay)
if not xbmcvfs.exists(self.skinExtrasOverlay):
log("VideoExtrasService: No custom image, using default")
# Add default image setting to skinExtrasOverlay
self.skinExtrasOverlay = os_path_join(RES_DIR, "skins")
self.skinExtrasOverlay = os_path_join(self.skinExtrasOverlay, "icons")
self.skinExtrasOverlay = os_path_join(self.skinExtrasOverlay, "overlay1.png")
log("VideoExtrasService: Looking for list image overlay file: %s" % self.skinExtrasOverlayList)
if not xbmcvfs.exists(self.skinExtrasOverlayList):
log("VideoExtrasService: No custom wide image, using default")
# Add default image setting to skinExtrasOverlay
self.skinExtrasOverlayList = os_path_join(RES_DIR, "skins")
self.skinExtrasOverlayList = os_path_join(self.skinExtrasOverlayList, "icons")
self.skinExtrasOverlayList = os_path_join(self.skinExtrasOverlayList, "list1.png")
self.forceOverlayOverwrite = False
# We now know the file that we are going to use for the overlay
# Check to see if this is different from the last overlay file used
filename = os_path_join(PROFILE_DIR, "overlay_image_used.txt")
try:
previousOverlay = None
if xbmcvfs.exists(filename):
fileHandle = xbmcvfs.File(filename, 'r')
previousOverlay = fileHandle.read()
fileHandle.close()
# Check if the overlay has changed
if self.skinExtrasOverlay != previousOverlay:
self.forceOverlayOverwrite = True
# Update the record of the file we are now using
if xbmcvfs.exists(filename):
xbmcvfs.delete(filename)
fileHandle = xbmcvfs.File(filename, 'w')
fileHandle.write(self.skinExtrasOverlay.encode("UTF-8"))
fileHandle.close()
except:
log("VideoExtrasService: Failed to write: %s" % filename, xbmc.LOGERROR)
log("VideoExtrasService: %s" % traceback.format_exc(), xbmc.LOGERROR)
示例7: onClick
def onClick(self, control):
WINDOW_LIST_ID = 51
# Check to make sure that this click was for the extras list
if control != WINDOW_LIST_ID:
return
# Check the YouTube Search first, as if there are no Extras on disk
# There will not be a PlayAll button and it will just be the YouTube Link
youtubePosition = 0
vimeoPosition = 0
if len(self.files) > 0:
youtubePosition = youtubePosition + 1
vimeoPosition = vimeoPosition + 1
if Settings.isYouTubeSearchSupportEnabled():
vimeoPosition = vimeoPosition + 1
if self.getCurrentListPosition() == youtubePosition:
anItem = self.getListItem(youtubePosition)
searchDetails = anItem.getProperty("search")
log("VideoExtras: Running YouTube Addon/Plugin with search %s" % searchDetails)
xbmc.executebuiltin("RunAddon(plugin.video.youtube,%s)" % searchDetails)
return
if Settings.isVimeoSearchSupportEnabled() and self.getCurrentListPosition() == vimeoPosition:
anItem = self.getListItem(vimeoPosition)
searchDetails = anItem.getProperty("search")
log("VideoExtras: Running Vimeo Addon/Plugin with search %s" % searchDetails)
xbmc.executebuiltin("RunAddon(plugin.video.vimeo,%s)" % searchDetails)
return
# Check for the Play All case
if self.getCurrentListPosition() == 0:
ExtrasPlayer.playAll(self.files, SourceDetails.getTitle())
return
# Get the item that was clicked on
extraItem = self._getCurrentSelection()
if extraItem is None:
# Something has gone very wrong, there is no longer the item that was selected
log("VideoExtrasWindow: Unable to match item to current selection")
return
# If part way viewed prompt the user for resume or play from beginning
if extraItem.getResumePoint() > 0:
resumeWindow = VideoExtrasResumeWindow.createVideoExtrasResumeWindow(extraItem.getDisplayResumePoint())
resumeWindow.doModal()
# Check the return value, if exit, then we play nothing
if resumeWindow.isExit():
return
# If requested to restart from beginning, reset the resume point before playing
if resumeWindow.isRestart():
extraItem.setResumePoint(0)
# Default is to actually resume
del resumeWindow
ExtrasPlayer.performPlayAction(extraItem, SourceDetails.getTitle())
示例8: getScheduleEntry
def getScheduleEntry(self):
# Get the current time that we are checking the schedule for
localTime = time.localtime()
currentTime = (localTime.tm_hour * 60) + localTime.tm_min
# Get the current day of the week
# 0 = Monday 6 = Sunday
today = localTime.tm_wday
# Make sure that the day returned is within our expected list
if today not in Settings.DAY_TYPE:
log("Schedule: Unknown day today %d, setting to everyday" % today)
today = Settings.EVERY_DAY
# Check if we need to refresh the schedule details from the file
# in case they have changed
if Settings.getScheduleSetting() == Settings.SCHEDULE_FILE:
# Check if the file has changed
scheduleFileName = Settings.getScheduleFile()
if scheduleFileName not in [None, ""]:
if xbmcvfs.exists(scheduleFileName):
statFile = xbmcvfs.Stat(scheduleFileName)
modified = statFile.st_mtime()
if modified != self.lastScheduleModified:
log("Schedule: Schedule file has changed (%s)" % str(modified))
# We use the offset to work out if the data has changed
if self.idOffset > 0:
self.idOffset = 0
else:
self.idOffset = 1000
# Clear the existing schedule items
self.scheduleDetails = []
# Load the new schedule items
self._loadFromFile()
# Check the scheduled items to see if any cover the current time
for item in self.scheduleDetails:
if (item['start'] <= currentTime) and (item['end'] >= currentTime):
# Make sure this is for the current day
if (today == Settings.EVERY_DAY) or (item['day'] in [Settings.EVERY_DAY, today]):
return item['id']
# Check for the case where the time laps over midnight
if item['start'] > item['end']:
if (currentTime >= item['start']) or (currentTime <= item['end']):
# Check to see if we are restricting to day
if (today == Settings.EVERY_DAY) or (item['day'] == Settings.EVERY_DAY):
return item['id']
else:
if (currentTime >= item['start']) and (item['day'] in [Settings.EVERY_DAY, today]):
return item['id']
else:
# The day is set for the start of the time interval
# so if we go over to the next day we need to update
# what the expected day is
nextDay = Settings.getNextDay(item['day'])
if (currentTime <= item['end']) and (item['day'] in [Settings.EVERY_DAY, nextDay]):
return item['id']
return -1
示例9: __init__
def __init__(self, *args):
self.scheduleDetails = []
self.idOffset = 0
self.lastScheduleModified = 0
if Settings.getScheduleSetting() == Settings.SCHEDULE_SETTINGS:
self._loadFromSettings()
elif Settings.getScheduleSetting() == Settings.SCHEDULE_FILE:
self._loadFromFile()
示例10: checkPlugins
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)
示例11: test
def test(key):
global log
log = KodiLogger.log
import resources.lib.tests.direct_test as direct_test
from resources.lib.events import Events
import traceback
log(msg=_('Running Test for Event: %s') % key)
events = Events().AllEvents
settings = Settings()
settings.getSettings()
if settings.general['elevate_loglevel'] is True:
KodiLogger.setLogLevel(xbmc.LOGNOTICE)
else:
KodiLogger.setLogLevel(xbmc.LOGDEBUG)
log(msg=_('Settings for test read'))
evtsettings = settings.events[key]
topic = settings.topicFromSettingsEvent(key)
task_key = settings.events[key]['task']
tasksettings = settings.tasks[task_key]
testlogger = direct_test.TestLogger()
log(msg=_('Creating subscriber for test'))
subscriberfactory = SubscriberFactory(settings, testlogger)
subscriber = subscriberfactory.createSubscriber(key)
if subscriber is not None:
log(msg=_('Test subscriber created successfully'))
try:
kwargs = events[evtsettings['type']]['expArgs']
except KeyError:
kwargs = {}
testRH = direct_test.TestHandler(direct_test.testMsg(subscriber.taskmanagers[0], tasksettings, kwargs))
subscriber.taskmanagers[0].returnHandler = testRH.testReturnHandler
# Run test
log(msg=_('Running test'))
nMessage = PubSub_Threaded.Message(topic=topic, **kwargs)
try:
subscriber.notify(nMessage)
except Exception:
msg = _('Unspecified error during testing')
e = sys.exc_info()[0]
if hasattr(e, 'message'):
msg = str(e.message)
msg = msg + '\n' + traceback.format_exc()
log(msg=msg)
msgList = msg.split('\n')
import resources.lib.dialogtb as dialogtb
dialogtb.show_textbox('Error', msgList)
else:
log(msg=_('Test subscriber creation failed due to errors'))
msgList = testlogger.retrieveLogAsList()
import resources.lib.dialogtb as dialogtb
dialogtb.show_textbox('Error', msgList)
xbmc.sleep(2000)
示例12: checkSystemSettings
def checkSystemSettings(self):
# Check if the system restriction is enabled
if not Settings.isActiveSystemSettings():
return
# Check to see if the main system settings has been selected
systemSettings = xbmc.getCondVisibility("Window.IsActive(10004)")
addonBrowser = xbmc.getCondVisibility("Window.IsActive(10040)")
profiles = xbmc.getCondVisibility("Window.IsActive(10034)")
# Check if we are in any of the restricted sections
if not systemSettings and not addonBrowser and not profiles:
log("NavigationRestrictions: Not is restricted system settings")
return
# If we have already allowed the user to change settings, no need to check again
# Check if we are still in the allowed time limit to edit
if int(time.time()) < self.canChangeSettings:
return
# Need to make sure this user has access to change the settings
pinDB = PinSentryDB()
securityLevel = pinDB.getPluginSecurityLevel('PinSentry')
del pinDB
if securityLevel < 1:
# If the user hasn't reset the permissions, then set it to the highest
# security level available
securityLevel = Settings.getSettingsSecurityLevel()
log("NavigationRestrictions: Settings screen requires security level %d" % securityLevel)
# 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
# Before we prompt the user we need to close the dialog, otherwise the pin
# dialog will appear behind it
xbmc.executebuiltin("Dialog.Close(all, true)", True)
# Prompt the user for the pin, returns True if they knew it
if PinSentry.promptUserForPin(securityLevel):
log("NavigationRestrictions: Allowed access to settings")
# Allow the user 5 minutes to change the settings
self.canChangeSettings = int(time.time()) + 300
xbmcgui.Dialog().notification(ADDON.getLocalizedString(32001).encode('utf-8'), ADDON.getLocalizedString(32110).encode('utf-8'), ICON, 3000, False)
else:
log("NavigationRestrictions: Not allowed access to settings which has security level %d" % securityLevel)
self.canChangeSettings = False
PinSentry.displayInvalidPinMessage(securityLevel)
# Return the user to the home page as they should not be here
xbmc.executebuiltin("ActivateWindow(home)", True)
示例13: onInit
def onInit(self):
xbmcgui.WindowXML.onInit(self)
self.volumeCtrl = None
# Get the videos to use as a screensaver
playlist = self._getPlaylist()
# If there is nothing to play, then exit now
if playlist is None:
self.close()
return
# Update the playlist with any settings such as random start time
self._updatePlaylistForSettings(playlist)
# Update the volume if needed
self.volumeCtrl = VolumeDrop()
self.volumeCtrl.lowerVolume()
# Now play the video
self.player.play(playlist)
# Set the video to loop, as we want it running as long as the screensaver
self._setRepeat()
log("Started playing")
# Now check to see if we are overlaying the time on the screen
# Default is hidden
timeControl = self.getControl(ScreensaverWindow.TIME_CONTROL)
timeControl.setVisible(Settings.isShowTime())
# Check if we need to show the weather
weatherControl = self.getControl(ScreensaverWindow.WEATHER_CONTROL)
if Settings.getWeatherAddon() not in ["", None]:
weatherControl.setVisible(True)
else:
weatherControl.setVisible(False)
# Set the value of the dimming for the video
dimLevel = Settings.getDimValue()
if dimLevel is not None:
log("Setting Dim Level to: %s" % dimLevel)
dimControl = self.getControl(ScreensaverWindow.DIM_CONTROL)
dimControl.setColorDiffuse(dimLevel)
# Set the overlay image
self._setOverlayImage()
# Update any settings that need to be done after the video is playing
self._updatePostPlayingForSettings(playlist)
示例14: displayInvalidPinMessage
def displayInvalidPinMessage(level=1):
# Invalid Key Notification: Dialog, Popup Notification, None
notifType = Settings.getInvalidPinNotificationType()
if notifType == Settings.INVALID_PIN_NOTIFICATION_POPUP:
cmd = ""
if Settings.getNumberOfLevels() > 1:
cmd = 'Notification("{0}", "{1} {2}", 3000, "{3}")'.format(ADDON.getLocalizedString(32104).encode('utf-8'), ADDON.getLocalizedString(32211).encode('utf-8'), str(level), ICON)
else:
cmd = 'Notification("{0}", "{1}", 3000, "{2}")'.format(ADDON.getLocalizedString(32001).encode('utf-8'), ADDON.getLocalizedString(32104).encode('utf-8'), ICON)
xbmc.executebuiltin(cmd)
elif notifType == Settings.INVALID_PIN_NOTIFICATION_DIALOG:
line3 = None
if Settings.getNumberOfLevels() > 1:
line3 = "%s %d" % (ADDON.getLocalizedString(32211), level)
xbmcgui.Dialog().ok(ADDON.getLocalizedString(32001).encode('utf-8'), ADDON.getLocalizedString(32104).encode('utf-8'), line3)
示例15: _doesThemeExist
def _doesThemeExist(self, directory, checkParent=False, incAudioThemes=True, incVideoThemes=True):
log("doesThemeExist: Checking directory: %s" % directory)
# Check for custom theme directory
if Settings.isThemeDirEnabled():
themeDir = os_path_join(directory, Settings.getThemeDirectory())
# Check if this directory exists
if not dir_exists(themeDir):
workingPath = directory
# If the path currently ends in the directory separator
# then we need to clear an extra one
if (workingPath[-1] == os.sep) or (workingPath[-1] == os.altsep):
workingPath = workingPath[:-1]
# If not check to see if we have a DVD VOB
if (os_path_split(workingPath)[1] == 'VIDEO_TS') or (os_path_split(workingPath)[1] == 'BDMV'):
# Check the parent of the DVD Dir
themeDir = os_path_split(workingPath)[0]
themeDir = os_path_join(themeDir, Settings.getThemeDirectory())
directory = themeDir
# Check to see if we need to check the parent directory
if checkParent:
directory = os_path_split(directory)[0]
# check if the directory exists before searching
if dir_exists(directory):
# Generate the regex
audioOnly = False
videoOnly = False
if not incAudioThemes:
videoOnly = True
if not incVideoThemes:
audioOnly = True
themeFileRegEx = Settings.getThemeFileRegEx(audioOnly=audioOnly, videoOnly=videoOnly)
dirs, files = list_dir(directory)
for aFile in files:
m = re.search(themeFileRegEx, aFile, re.IGNORECASE)
if m:
log("doesThemeExist: Found match: " + aFile)
return True
# Check if an NFO file exists
nfoFileName = os_path_join(directory, "tvtunes.nfo")
if xbmcvfs.exists(nfoFileName):
log("doesThemeExist: Found match: " + nfoFileName)
return True
return False