本文整理汇总了Python中resources.lib.utils.getString函数的典型用法代码示例。如果您正苦于以下问题:Python getString函数的具体用法?Python getString怎么用?Python getString使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了getString函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: hostInfo
def hostInfo(self):
#get some information about this host
selectedHost = self.host_manager.getHost(int(params['host']))
isPlaying = selectedHost.isPlaying()
if(isPlaying == -2):
item = xbmcgui.ListItem(utils.getString(30024))
ok = xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url="%s?%s" % (sys.argv[0],"mode=0"),listitem=item,isFolder=False)
elif(isPlaying == -1):
item = xbmcgui.ListItem(utils.getString(30025))
ok = xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url="%s?%s" % (sys.argv[0],"mode=0"),listitem=item,isFolder=False)
else:
#get properties on the currently playing file
fileProps = selectedHost.playingProperties()
#get the playlist of playing items
playingItems = selectedHost.getPlaylist()
index = 0
for aItem in playingItems:
itemLabel = aItem['label']
if(index == fileProps['position']):
itemLabel = "*" + utils.getString(30026) + "* " + itemLabel
item = xbmcgui.ListItem(itemLabel)
ok = xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url="%s?%s" % (sys.argv[0],"mode=1004&host=" + params['host'] + "&item=" + str(index)),listitem=item,isFolder=False)
index = index + 1
xbmcplugin.endOfDirectory(int(sys.argv[1]),cacheToDisc=False)
示例2: authorize
def authorize(self):
result = True
if(not self.setup()):
return False
if(self.isAuthorized()):
#delete the token to start over
self._deleteToken()
#copied flow from http://dropbox-sdk-python.readthedocs.io/en/latest/moduledoc.html#dropbox.oauth.DropboxOAuth2FlowNoRedirect
flow = dropbox.oauth.DropboxOAuth2FlowNoRedirect(self.APP_KEY,self.APP_SECRET)
url = flow.start()
#print url in log
utils.log("Authorize URL: " + url)
xbmcgui.Dialog().ok(utils.getString(30010),utils.getString(30056),utils.getString(30057),tinyurl.shorten(url))
#get the auth code
code = xbmcgui.Dialog().input(utils.getString(30027) + ' ' + utils.getString(30103))
#if user authorized this will work
try:
user_token = flow.finish(code)
self._setToken(user_token.access_token)
except Exception,e:
utils.log("Error: %s" % (e,))
result = False
示例3: cleanLibrary
def cleanLibrary(self,media_type):
#check if we should verify paths
if(utils.getSetting("verify_paths") == 'true'):
response = eval(xbmc.executeJSONRPC('{ "jsonrpc" : "2.0", "method" : "Files.GetSources", "params":{"media":"' + media_type + '"}, "id": 1}'))
if(response.has_key('error')):
utils.log("Error " + response['error']['data']['method'] + " - " + response['error']['message'],xbmc.LOGDEBUG)
return
for source in response['result']['sources']:
if not self._sourceExists(source['file']):
#let the user know this failed, if they subscribe to notifications
if(utils.getSetting('notify_next_run') == 'true'):
utils.showNotification(utils.getString(30050),"Source " + source['label'] + " does not exist")
utils.log("Path " + source['file'] + " does not exist")
return
#also check if we should verify with user first
if(utils.getSetting('user_confirm_clean') == 'true'):
#user can decide 'no' here and exit this
runClean = xbmcgui.Dialog().yesno(utils.getString(30000),utils.getString(30052),utils.getString(30053))
if(not runClean):
return
#run the clean operation
utils.log("Cleaning Database")
xbmc.executebuiltin("CleanLibrary(" + media_type + ")")
#write last run time, will trigger notifications
self.writeLastRun()
示例4: pullMedia
def pullMedia(self):
host = int(params['host'])
selectedItem = int(params['item'])
action = xbmcgui.Dialog().select(utils.getString(30030),(utils.getString(30031),utils.getString(30032),utils.getString(30033),utils.getString(30034)))
remote_host = self.host_manager.getHost(host)
if(action == 0):
#do a reverse SendTo
SendTo().reverse(remote_host)
xbmc.executebuiltin('Container.Refresh')
elif(action == 1):
#start playing only this file
playingFiles = remote_host.getPlaylist()
local_host = XbmcHost('Local','127.0.0.1','80')
local_host.playFile(playingFiles[selectedItem]['file'])
elif(action == 2):
#pull the whole list but start at this index
playerid = remote_host.isPlaying()
playingFiles = remote_host.getPlaylist()
local_host = XbmcHost('Local','127.0.0.1','80')
#send the playerid so we add to the right playlist
local_host.addItems(playingFiles,playerid)
local_host.playPosition(selectedItem,playerid)
elif(action == 3):
#just stop the playing media on this machine
remote_host.stop()
xbmc.executebuiltin('Container.Refresh')
示例5: setup
def setup(self):
result = True
if(self.CLIENT_ID == '' and self.CLIENT_SECRET == ''):
#we can't go any farther, need these for sure
xbmcgui.Dialog().ok(utils.getString(30010),utils.getString(30098) + ' ' + utils.getString(30058),utils.getString(30108))
result = False
return result
示例6: _resumeCheck
def _resumeCheck(self):
shouldContinue = False
if(xbmcvfs.exists(xbmc.translatePath(utils.data_dir() + "resume.txt"))):
rFile = xbmcvfs.File(xbmc.translatePath(utils.data_dir() + "resume.txt"),'r')
self.restore_point = rFile.read()
rFile.close()
xbmcvfs.delete(xbmc.translatePath(utils.data_dir() + "resume.txt"))
shouldContinue = xbmcgui.Dialog().yesno(utils.getString(30042),utils.getString(30043),utils.getString(30044))
return shouldContinue
示例7: start
def start(self):
#check if a backup should be resumed
resumeRestore = self._resumeCheck()
if(resumeRestore):
restore = XbmcBackup()
restore.selectRestore(self.restore_point)
#skip the advanced settings check
restore.skipAdvanced()
restore.run(XbmcBackup.Restore)
while(not xbmc.abortRequested):
if(self.enabled == "true"):
#scheduler is still on
now = time.time()
if(self.next_run <= now):
progress_mode = int(utils.getSetting('progress_mode'))
if(progress_mode != 2):
utils.showNotification(utils.getString(30053))
backup = XbmcBackup()
if(backup.remoteConfigured()):
if(int(utils.getSetting('progress_mode')) in [0,1]):
backup.run(XbmcBackup.Backup,True)
else:
backup.run(XbmcBackup.Backup,False)
#check if this is a "one-off"
if(int(utils.getSetting("schedule_interval")) == 0):
#disable the scheduler after this run
self.enabled = "false"
utils.setSetting('enable_scheduler','false')
else:
utils.showNotification(utils.getString(30045))
#check if we should shut the computer down
if(utils.getSetting("cron_shutdown") == 'true'):
#wait 10 seconds to make sure all backup processes and files are completed
time.sleep(10)
xbmc.executebuiltin('ShutDown()')
else:
#find the next run time like normal
self.findNextRun(now)
xbmc.sleep(500)
#delete monitor to free up memory
del self.monitor
示例8: cleanLibrary
def cleanLibrary(self,media_type):
#check if we should verify with user first
if(utils.getSetting('user_confirm_clean') == 'true'):
#user can decide 'no' here and exit this
runClean = xbmcgui.Dialog().yesno(utils.getString(30000),utils.getString(30052),line2=utils.getString(30053),autoclose=15000)
if(not runClean):
return
#run the clean operation
utils.log("Cleaning Database")
xbmc.executebuiltin("CleanLibrary(" + media_type + ")")
#write last run time, will trigger notifications
self.writeLastRun()
示例9: addHost
def addHost(self):
name = None
address = None
port = None
#get the name, address, and port
name = self._getInput(utils.getString(30027))
address = self._getInput(utils.getString(30028))
port = self._getInput(utils.getString(30029))
if(name != None and address != None and port != None):
aHost = XbmcHost(name,address,int(port))
self.host_manager.addHost(aHost)
xbmc.executebuiltin('Container.Refresh')
示例10: start
def start(self):
while(not xbmc.abortRequested):
current_enabled = utils.getSetting("enable_scheduler")
if(current_enabled == "true" and self.enabled == "false"):
#scheduler was just turned on
self.enabled = current_enabled
self.setup()
elif (current_enabled == "false" and self.enabled == "true"):
#schedule was turn off
self.enabled = current_enabled
elif(self.enabled == "true"):
#scheduler is still on
now = time.time()
if(self.next_run <= now):
if(utils.getSetting('run_silent') == 'false'):
utils.showNotification(utils.getString(30053))
#run the job in backup mode, hiding the dialog box
backup = XbmcBackup()
backup.run(XbmcBackup.Backup,True)
self.findNextRun(now)
time.sleep(10)
示例11: start
def start(self):
#check if a backup should be resumed
resumeRestore = self._resumeCheck()
if(resumeRestore):
restore = XbmcBackup()
restore.selectRestore(self.restore_point)
#skip the advanced settings check
restore.skipAdvanced()
restore.run(XbmcBackup.Restore)
while(not xbmc.abortRequested):
if(self.enabled == "true"):
#scheduler is still on
now = time.time()
if(self.next_run <= now):
if(utils.getSetting('run_silent') == 'false'):
utils.showNotification(utils.getString(30053))
#run the job in backup mode, hiding the dialog box
backup = XbmcBackup()
backup.run(XbmcBackup.Backup,True)
#check if we should shut the computer down
if(utils.getSetting("cron_shutdown") == 'true'):
#wait 10 seconds to make sure all backup processes and files are completed
time.sleep(10)
xbmc.executebuiltin('ShutDown()')
else:
#find the next run time like normal
self.findNextRun(now)
xbmc.sleep(500)
示例12: run
def run(self):
mode = xbmcgui.Dialog().select(utils.getString(30010),[utils.getString(30011),utils.getString(30012)])
copyComplete = False
if(mode == self.REMOTE_MODE):
copyComplete = self._copyFile(utils.getSetting('remote_filename'))
elif(mode == self.LOCAL_MODE):
copyComplete = self._copyFile(utils.getSetting('local_filename'))
if(copyComplete):
#prompt the user to restart xbmc
restartXbmc = xbmcgui.Dialog().yesno(utils.getString(30010),"",utils.getString(30013))
if(restartXbmc):
xbmc.restart();
示例13: listHosts
def listHosts(self):
context_url = "%s?%s"
if(len(self.host_manager.hosts) > 0):
#lists all hosts
index = 0
for aHost in self.host_manager.hosts:
item = xbmcgui.ListItem(aHost.name,aHost.address)
item.addContextMenuItems([(utils.getString(30020),"Xbmc.RunPlugin(%s?%s)" % (sys.argv[0],"mode=1005&host=" + str(index))),(utils.getString(30021), "Xbmc.RunPlugin(%s?%s)" % (sys.argv[0],"mode=1002")),(utils.getString(30022), "Xbmc.RunPlugin(%s?%s)" % (sys.argv[0],'mode=1003&host=' + str(index)))])
ok = xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url=context_url % (sys.argv[0],"mode=1001&host=" + str(index)),listitem=item,isFolder=True)
index = index + 1
else:
#just list the 'add' button
item = xbmcgui.ListItem(utils.getString(30021))
ok = xbmcplugin.addDirectoryItem(handle=int(sys.argv[1]),url="%s?%s" % (sys.argv[0],"mode=1002"),listitem=item,isFolder=False)
xbmcplugin.endOfDirectory(int(sys.argv[1]),cacheToDisc=False)
示例14: _copyFile
def _copyFile(self,filename):
utils.log("copying " + filename + " to advancedsettings.xml")
if(xbmcvfs.exists(xbmc.translatePath(filename))):
advanced_settings = xbmc.translatePath('special://profile/advancedsettings.xml')
#if advancedsettings already exists, delete it
if(xbmcvfs.exists(advanced_settings)):
xbmcvfs.delete(advanced_settings)
#copy the new file
xbmcvfs.copy(xbmc.translatePath(filename),advanced_settings)
return True
else:
xbmcgui.Dialog().ok(utils.getString(30010),utils.getString(30014))
return False
示例15: addHost
def addHost(self):
name = None
address = None
port = None
user = None
password = None
#get the name, address, and port
name = xbmcgui.Dialog().input(utils.getString(30027),'',xbmcgui.INPUT_ALPHANUM)
address = xbmcgui.Dialog().input(utils.getString(30028),'',xbmcgui.INPUT_IPADDRESS)
port = xbmcgui.Dialog().input(utils.getString(30029),'',xbmcgui.INPUT_NUMERIC)
user = xbmcgui.Dialog().input(utils.getString(30042),'',xbmcgui.INPUT_ALPHANUM)
password = xbmcgui.Dialog().input(utils.getString(30043),'',xbmcgui.INPUT_ALPHANUM)
if(name != None and address != None and port != None):
aHost = XbmcHost(name,address,int(port),user,password)
self.host_manager.addHost(aHost)
xbmc.executebuiltin('Container.Refresh')