Kodi Community Forum
setSetting() doesn't work [Frodo] - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=26)
+--- Thread: setSetting() doesn't work [Frodo] (/showthread.php?tid=179737)

Pages: 1 2


setSetting() doesn't work [Frodo] - realtebo - 2013-12-06

Code:
plugin_pid       = int(sys.argv[1])
language        = xbmcplugin.getSetting(plugin_pid, "language")

# AUTODETECT LANGUAGE IF MISSING
# if not set, language will be read from system, where it uses english language name
# if it's one of supported language, I got localized name to adhere to addon language setting
# availables values ( Italiano, English, Polski, ... )

if language == "":
    actual_locale = xbmc.getLanguage()
    if actual_locale in locale_2_lang :
        language = locale_2_lang[actual_locale]
    else :
        language = "English"

    print "JWORG: Auto setting locale to: " + language

    xbmcplugin.setSetting(plugin_pid, "language", language)

After a first, fresh, clean, installation, in the addon_data dir there is no folder plugin.video.jworg, because no setting saved yet.

At every run, the plugin try to detect the locale choosen by the user. If there is no locale set, than for a small set of xmbc locale names I can match the plugin "stream content locale".

For example: if no locale set, if xmbc is set to "Italian" then I execute this to set to "Italiano",

Code:
    xbmcplugin.setSetting(plugin_pid, "language", "Italiano")

This line of code is being executed, doesn't creeate any error in log file, but no addon_data .xml file is created. So when I open my addon config, I got for locale the first locale in list, and not the 'auto set' locale I've just set.

My setting.py row about locale
Code:
<setting id="language" type="labelenum" label="30002" values="Afrikaans|Deutsch|English|Español|Français|Ελληνική|Italiano|Magyar|Nederlands|Polski|Português"  />


There is something else to do after call setSetting()?


RE: setSetting() doesn't work [Frodo] - realtebo - 2013-12-06

ALSO: if You try to use setSetting for a non-existent setting id, the function itself doesn't generate any kind of info/warning/trace/debug log row.


RE: setSetting() doesn't work [Frodo] - fightnight - 2013-12-06

You set the number of value.. Italiano should be 6.. starts in 0.


RE: setSetting() doesn't work [Frodo] - Martijn - 2013-12-06

it works in my addons for sure.
for existing or non existing IDs


RE: setSetting() doesn't work [Frodo] - divingmule - 2013-12-07

Maybe use xbmcaddon instead of xbmcplugin. xbmcplugin seems redundant sense plugins rely on xbmcaddon, or am I missing something??


RE: setSetting() doesn't work [Frodo] - realtebo - 2013-12-08

What's the difference from xbmcplugin and xbcaddon class?


RE: setSetting() doesn't work [Frodo] - Martijn - 2013-12-08

not sure the xbmcplugin.setSetting even works anymore. Will ask.
xbmcaddon.setSetting works for sure


RE: setSetting() doesn't work [Frodo] - realtebo - 2013-12-08

(2013-12-06, 18:26)fightnight Wrote: You set the number of value.. Italiano should be 6.. starts in 0.

"TypeError: argument "value" for method "XBMCAddon::xbmcplugin:ConfusedetSetting" must be unicode or str"


RE: setSetting() doesn't work [Frodo] - realtebo - 2013-12-08

(2013-12-08, 15:07)Martijn Wrote: not sure the xbmcplugin.setSetting even works anymore. Will ask.
xbmcaddon.setSetting works for sure

Yes, this works, and, also, setSetting NEED a string, not a number, not a progressive ID, whn using 'type="labelenum" '

Code:
<settings>
  <setting value="2" id="audio_sorting"/>
  <setting value="Italiano" id="language"/>
  <setting value="0" id="video_sorting"/>
</settings>

Id not work, please REMOVE from api doc:http://mirrors.xbmc.org/docs/python-docs/stable/xbmcplugin.html


RE: setSetting() doesn't work [Frodo] - demmax2004 - 2013-12-19

Му config: XBMC\addons\script.ambibox\resources\settings.xml

PHP Code:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<settings>
  <!-- General -->
  <category label="32000">
    <setting id="host" type="text" label="32001"  default="127.0.0.1" /> 
    <setting id="port" type="number" label="32002" default="3636" /> 
    <setting id="notification" type="bool" label="32003" default="true" />
  </category>
  
  <category label="32010">
    <setting id="default_enable" type="bool" label="32011"  default="true" /> 
    <setting id="default_profile" type="text" label="32012" default="default" subsetting="true" visible="eq(-1,true)" /> 
    <setting id="video_enable" type="bool" label="32013" default="true" /> 
    <setting id="video_profile" type="text" label="32014" default="default" subsetting="true" visible="eq(-1,true)"  /> 
    <setting id="audio_enable" type="bool" label="32015" default="true" /> 
    <setting id="audio_profile" type="text" label="32016" default="default" subsetting="true" visible="eq(-1,true)"   /> 
    <setting id="show_menu" type="text" label="32002" value="error" default="error" />  
  </category>

  <category label="32020">
    <setting id="show_menu" type="number" label="32023" value="0" default="0" />  
  </category>
</settings> 

My code does not work

PHP Code:
__settings__ xbmcaddon.Addon"script.ambibox" )
__settings__.setSetting('show_menu''1'//or __settings__.setSetting("show_menu", "1")
or
sett xbmcaddon.Addon()
sett.setSetting('show_menu''1'//or __settings__.setSetting("show_menu", "1") 

WTF Huh


RE: setSetting() doesn't work [Frodo] - Karnagious - 2013-12-19

Maybe try this?
Code:
sett.setSetting(id="show_menu",value='1')



RE: setSetting() doesn't work [Frodo] - demmax2004 - 2013-12-19

(2013-12-19, 08:36)Karnagious Wrote: Maybe try this?
Code:
sett.setSetting(id="show_menu",value='1')
or
sett.setSetting(id="show_menu",value="1")

not work


RE: setSetting() doesn't work [Frodo] - realtebo - 2013-12-19

please copy/past the setting file (i tink it's in userdata folder) to undersand how xbmc set it natively


RE: setSetting() doesn't work [Frodo] - demmax2004 - 2013-12-19

settings file in c:\Users\dem\AppData\Roaming\XBMC\addons\script.ambibox\resources\settings.xml


RE: setSetting() doesn't work [Frodo] - giftie - 2013-12-21

(2013-12-19, 06:14)demmax2004 Wrote: Му config: XBMC\addons\script.ambibox\resources\settings.xml

PHP Code:
<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<settings>
  <!-- General -->
  <category label="32000">
    <setting id="host" type="text" label="32001"  default="127.0.0.1" /> 
    <setting id="port" type="number" label="32002" default="3636" /> 
    <setting id="notification" type="bool" label="32003" default="true" />
  </category>
  
  <category label="32010">
    <setting id="default_enable" type="bool" label="32011"  default="true" /> 
    <setting id="default_profile" type="text" label="32012" default="default" subsetting="true" visible="eq(-1,true)" /> 
    <setting id="video_enable" type="bool" label="32013" default="true" /> 
    <setting id="video_profile" type="text" label="32014" default="default" subsetting="true" visible="eq(-1,true)"  /> 
    <setting id="audio_enable" type="bool" label="32015" default="true" /> 
    <setting id="audio_profile" type="text" label="32016" default="default" subsetting="true" visible="eq(-1,true)"   /> 
    <setting id="show_menu" type="text" label="32002" value="error" default="error" />  
  </category>

  <category label="32020">
    <setting id="show_menu" type="number" label="32023" value="0" default="0" />  
  </category>
</settings> 

My code does not work

PHP Code:
__settings__ xbmcaddon.Addon"script.ambibox" )
__settings__.setSetting('show_menu''1'//or __settings__.setSetting("show_menu", "1")
or
sett xbmcaddon.Addon()
sett.setSetting('show_menu''1'//or __settings__.setSetting("show_menu", "1") 

WTF Huh

For one you have two key labels the same... You more than one key label('show_menu') in the settings file.