setSetting() doesn't work [Frodo]

  Thread Rating:
  • 0 Votes - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Post Reply
realtebo Offline
Senior Member
Posts: 165
Joined: Apr 2013
Reputation: 0
Post: #1
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|P​olski|Português"  />


There is something else to do after call setSetting()?
(This post was last modified: 2013-12-06 12:07 by realtebo.)
find quote
realtebo Offline
Senior Member
Posts: 165
Joined: Apr 2013
Reputation: 0
Post: #2
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.
find quote
fightnight Offline
Senior Member
Posts: 122
Joined: Dec 2012
Reputation: 1
Location: Portugal
Post: #3
You set the number of value.. Italiano should be 6.. starts in 0.
find quote
Martijn Offline
Team Kodi
Posts: 11,597
Joined: Jul 2011
Reputation: 167
Location: Dawn of time
Post: #4
it works in my addons for sure.
for existing or non existing IDs

Always read the XBMC online-manual, FAQ and search the forums before posting.
Do NOT e-mail Team-XBMC members asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting, make sure you read this first

For your mediacenter artwork go to
[Image: fanarttv.png]
(This post was last modified: 2013-12-06 18:28 by Martijn.)
find quote
divingmule Offline
Skilled Python Coder
Posts: 1,297
Joined: Oct 2008
Reputation: 61
Post: #5
Maybe use xbmcaddon instead of xbmcplugin. xbmcplugin seems redundant sense plugins rely on xbmcaddon, or am I missing something??
find quote
realtebo Offline
Senior Member
Posts: 165
Joined: Apr 2013
Reputation: 0
Post: #6
What's the difference from xbmcplugin and xbcaddon class?
find quote
Martijn Offline
Team Kodi
Posts: 11,597
Joined: Jul 2011
Reputation: 167
Location: Dawn of time
Post: #7
not sure the xbmcplugin.setSetting even works anymore. Will ask.
xbmcaddon.setSetting works for sure

Always read the XBMC online-manual, FAQ and search the forums before posting.
Do NOT e-mail Team-XBMC members asking for support. Read/follow the forum rules.
For troubleshooting and bug reporting, make sure you read this first

For your mediacenter artwork go to
[Image: fanarttv.png]
find quote
realtebo Offline
Senior Member
Posts: 165
Joined: Apr 2013
Reputation: 0
Post: #8
(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::setSetting" must be unicode or str"
find quote
realtebo Offline
Senior Member
Posts: 165
Joined: Apr 2013
Reputation: 0
Post: #9
(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
(This post was last modified: 2013-12-08 15:57 by realtebo.)
find quote
demmax2004 Offline
Junior Member
Posts: 22
Joined: Nov 2012
Reputation: 0
Post: #10
Му 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 Confused
(This post was last modified: 2013-12-19 06:16 by demmax2004.)
find quote
Karnagious Online
Fan
Posts: 622
Joined: Nov 2012
Reputation: 26
Post: #11
Maybe try this?
Code:
sett.setSetting(id="show_menu",value='1')
find quote
demmax2004 Offline
Junior Member
Posts: 22
Joined: Nov 2012
Reputation: 0
Post: #12
(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
(This post was last modified: 2013-12-19 09:55 by demmax2004.)
find quote
realtebo Offline
Senior Member
Posts: 165
Joined: Apr 2013
Reputation: 0
Post: #13
please copy/past the setting file (i tink it's in userdata folder) to undersand how xbmc set it natively
find quote
demmax2004 Offline
Junior Member
Posts: 22
Joined: Nov 2012
Reputation: 0
Post: #14
settings file in c:\Users\dem\AppData\Roaming\XBMC\addons\script.ambibox\resources\settings.xml
find quote
giftie Offline
Skilled Python Coder
Posts: 2,364
Joined: Mar 2010
Reputation: 54
Location: Calgary, Alberta
Post: #15
(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 Confused

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

[Image: e4f63e45ba34fe4695b3bb08eb2499d8e4ee484e...4c076g.jpg]
For troubleshooting and bug reporting please make sure you read this first you can also use XBMC Log Uploader Script.
Cinema Experience
Cinema Experience Wiki
cdART Manager
fanart.tv


find quote
Post Reply