本文整理汇总了Python中xbmcplugin.setSetting函数的典型用法代码示例。如果您正苦于以下问题:Python setSetting函数的具体用法?Python setSetting怎么用?Python setSetting使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了setSetting函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: set_setting
def set_setting(name, value, channel=""):
"""
Fija el valor de configuracion del parametro indicado.
Establece 'value' como el valor del parametro 'name' en la configuracion global o en la configuracion propia del
canal 'channel'.
Devuelve el valor cambiado o None si la asignacion no se ha podido completar.
Si se especifica el nombre del canal busca en la ruta \addon_data\plugin.video.pelisalacarta\settings_channels el
archivo channel_data.json y establece el parametro 'name' al valor indicado por 'value'. Si el archivo
channel_data.json no existe busca en la carpeta channels el archivo channel.xml y crea un archivo channel_data.json
antes de modificar el parametro 'name'.
Si el parametro 'name' no existe lo añade, con su valor, al archivo correspondiente.
Parametros:
name -- nombre del parametro
value -- valor del parametro
channel [opcional] -- nombre del canal
Retorna:
'value' en caso de que se haya podido fijar el valor y None en caso contrario
"""
if channel:
from core import channeltools
return channeltools.set_channel_setting(name, value, channel)
else:
try:
xbmcplugin.setSetting(name, value)
except:
return None
return value
示例2: onClick
def onClick(self, controlID):
"""
Notice: onClick not onControl
Notice: it gives the ID of the control not the control object
"""
#action sur la liste
print "Control %d clicked" % controlID
if controlID == 200 :
print "Processing control 200"
#Renvoie le numéro de l'item sélectionné
num = self.xml_list.getSelectedPosition()
print "got xml list"
#Traitement de l'information
if self.list_items[num]['selection'] == "false" :
self.list_items[num]['selection'] = "true"
else :
self.list_items[num]['selection'] = "false"
print "updating list"
self.listItems(self.list_items)
print "list updated"
self.xml_list.selectItem(num)
print "done processing 200"
if controlID == 9001 :
print "processing 9001"
matchfilter=[]
for item in self.list_items:
if item['selection'] == "true" :
matchfilter.append(str(item['genreid']))
xbmcplugin.setSetting('genreignore', ",".join(matchfilter))
self.close()
print "done with 9001"
print "done with control"
示例3: __init__
def __init__( self, *args, **kwargs ):
if True: #self._check_compatible():
self.pluginMgr = PluginMgr()
self.parameters = self.pluginMgr.parse_params()
# if 1st start create missing directories
self.fileMgr = fileMgr()
self.fileMgr.verifrep( DIR_ADDON_MODULE )
self.fileMgr.verifrep( DIR_ADDON_REPO )
self.fileMgr.verifrep( DIR_CACHE )
self.fileMgr.verifrep( DIR_CACHE_ADDONS )
# Check settings
if xbmcplugin.getSetting('first_run') == 'true':
# Check (only the 1st time) is xbmcaddon module is available
print( " **First run")
if self._check_addon_lib():
print( " XBMC Addon 4 XBOX Addon Library already installed")
print( " Installing default repositories")
if ( self._installRepos() ):
xbmcplugin.setSetting('first_run','false')
self._createRootDir()
else:
print( " ERROR - XBMC Addon 4 XBOX Addon Library MISSING")
dialog = xbmcgui.Dialog()
dialog.ok( __language__(30000), __language__(30091) ,__language__(30092))
else:
self._createRootDir()
self.pluginMgr.add_sort_methods( False )
self.pluginMgr.end_of_directory( True, update=False )
示例4: editB
def editB(name,url):
type = 'presets_' + url
presets = xbmcplugin.getSetting( type )
save = presets.split( " | " )
del save[save.index(name)]
x=0
for item in save:
if x == 0:
sets = item
else:
sets = sets + ' | ' + item
x=x+1
searchStr = name
keyboard = xbmc.Keyboard(searchStr, "Edit user name")
keyboard.doModal()
if (keyboard.isConfirmed() == False):
return
searchstring = keyboard.getText()
newStr = searchstring
if len(newStr) == 0:
return
if len(save) == 0:
sets = newStr
else:
sets = sets + ' | ' + newStr
xbmcplugin.setSetting(type, sets)
xbmc.executebuiltin( "Container.Refresh" )
示例5: setSetting
def setSetting(name,value):
# Nuevo XBMC
if DHARMA:
__settings__.setSetting( name,value ) # this will return "foo" setting value
# Antiguo XBMC
else:
xbmcplugin.setSetting(name,value)
示例6: _authorize
def _authorize( self ):
# flickr client
client = FlickrClient( api_key=True, secret=True )
# authenticate
authtoken = client.authenticate()
# write it to the settings file
if ( authtoken ):
xbmcplugin.setSetting( "authtoken", authtoken )
示例7: setSetting
def setSetting(name,value):
# Nuevo XBMC
if DHARMA:
__settings__.setSetting( name,value ) # this will return "foo" setting value
# Antiguo XBMC
else:
try:
import xbmcplugin
xbmcplugin.setSetting(name,value)
except:
pass
示例8: openSettings
def openSettings( self ):
# is this the first time plugin was run and user has not set email
if ( not sys.argv[ 2 ] and xbmcplugin.getSetting( "username" ) == "" and xbmcplugin.getSetting( "runonce" ) == "" ):
# set runonce
xbmcplugin.setSetting( "runonce", "1" )
# sleep for xbox so dialogs don't clash. (TODO: report this as a bug?)
if ( os.environ.get( "OS", "n/a" ) == "xbox" ):
xbmc.sleep( 2000 )
# open settings
xbmcplugin.openSettings( sys.argv[ 0 ] )
# we need to get the users email
self.username = xbmcplugin.getSetting( "username" )
示例9: openSettings
def openSettings(self):
try:
# is this the first time plugin was run and user has not set email
if not sys.argv[2] and xbmcplugin.getSetting("username") == "" and xbmcplugin.getSetting("runonce") == "":
# set runonce
xbmcplugin.setSetting("runonce", "1")
# sleep for xbox so dialogs don't clash. (TODO: report this as a bug?)
if os.environ.get("OS", "n/a") == "xbox":
xbmc.sleep(2000)
# open settings
xbmcplugin.openSettings(sys.argv[0])
except:
# new methods not in build
pass
示例10: __init__
def __init__( self, *args, **kwargs ):
#
# User to choose an address...
#
# Previously pinged addresses...
try :
ping_addrs = eval( xbmcplugin.getSetting( "ping_addrs" ) )
except :
ping_addrs = []
# Insert entry for "New address"...
ping_addrs.insert(0, xbmc.getLocalizedString(30302))
# User choice...
dialogAddrs = xbmcgui.Dialog()
index = dialogAddrs.select( xbmc.getLocalizedString(30201), ping_addrs )
self.ping_addr = ""
# New address...
if index == 0 :
keyboard = xbmc.Keyboard( "", xbmc.getLocalizedString( 30301 ) )
keyboard.doModal()
if keyboard.isConfirmed() :
self.ping_addr = keyboard.getText()
# Previous address..
if index > 0 :
self.ping_addr = ping_addrs[ index ]
#
# User made a choice...
#
if self.ping_addr > "" :
#
# Save address for future use...
#
ping_addrs.pop( 0 )
try :
ping_addrs.index ( self.ping_addr )
except :
ping_addrs.append( self.ping_addr )
ping_addrs.sort()
xbmcplugin.setSetting( "ping_addrs", repr( ping_addrs ))
#
# Show text window (+ pinging, see onInit)...
#
self.doModal()
示例11: removeB
def removeB(name,url):
type = 'presets_' + url
presets = xbmcplugin.getSetting( type )
save = presets.split( " | " )
del save[save.index(name)]
sets = ''
x=0
for item in save:
if x == 0:
sets = sets + item
else:
sets = sets + ' | ' + item
x=x+1
xbmcplugin.setSetting(type, sets)
xbmc.executebuiltin( "Container.Refresh" )
示例12: authenticate
def authenticate( self ):
log( " > authenticate()")
ok = False
# make the authentication call
try:
authkey = self.client.authenticate( self.email, self.password )
if authkey and authkey.startswith("ERROR"): raise "neterror", authkey
if not authkey:
messageOK(__plugin__, __lang__(30904))
else:
try:
xbmcplugin.setSetting( "authkey", authkey )
ok = True
except: pass
except "neterror", e:
messageOK(__plugin__, e)
示例13: delete_preset
def delete_preset( self ):
try:
# read the queries
presets = eval( xbmcplugin.getSetting( "presets_%s" % ( "videos", "users", "categories", )[ self.args.issearch - 1 ], ) )
# if this is an existing search, move it up
for count, preset in enumerate( presets ):
if ( self.args.query in repr( preset ) ):
del presets[ count ]
break
except:
# no presets found
presets = []
# save presets
xbmcplugin.setSetting( "presets_%s" % ( "videos", "users", "categories", )[ self.args.issearch - 1 ], repr( presets ) )
# refresh container so item is removed
xbmc.executebuiltin( "Container.Refresh" )
示例14: authenticate
def authenticate( self ):
# if this is first run open settings
self.openSettings()
# authentication is not permanent, so do this only when first launching plugin
if ( not sys.argv[ 2 ] ):
# get the users settings
password = xbmcplugin.getSetting( "user_password" )
# we can only authenticate if both email and password are entered
self.authkey = ""
if ( self.username and password ):
# our client api
from YoutubeAPI.YoutubeClient import YoutubeClient
client = YoutubeClient()
# make the authentication call
self.authkey, userid = client.authenticate( self.username, password )
# save authkey even if failed, so no token expired error
xbmcplugin.setSetting( "authkey", self.authkey )
示例15: authenticate
def authenticate( self ):
# if this is first run open settings
self.openSettings()
# authentication is not permanent, so do this only when first launching plugin
if ( not sys.argv[ 2 ] ):
# get the users settings
password = xbmcplugin.getSetting( "user_password" )
# we can only authenticate if both email and password are entered
if ( self.email and password ):
# our client api
from PicasaAPI.PicasaClient import PicasaClient
client = PicasaClient()
# make the authentication call
authkey = client.authenticate( self.email, password )
# if authentication succeeded, save it for later
if ( authkey ):
xbmcplugin.setSetting( "authkey", authkey )