szymex / xbmc-finnish-tv

XBMC Video Plugins for playing Finnish television content containers.
GNU General Public License v3.0
31 stars 38 forks source link

Settings related small bug in Areena ? #41

Closed rasjani closed 10 years ago

rasjani commented 10 years ago

Got a script error while trying to browse Areena after clean installation.

Going into settings and saving the default values, and restarting the addon and things started to work.

xbmc error pointed to yleareena.py, line 348:

intSetting = int(self.addon.getSetting("international"))

and actual error: Error Contents: invalid literal for int() with base 10: 'no'

So i'd assume that getSetting returns with a undefined value and then areena breaks.

Suggestion: during startup of the addon, check if there's config's available and initialize with proper defaults if they are not found.. Or, check out how xbmcplugin.getSetting() works with undefined values and come up with layer that would provide default values?

pasiz commented 10 years ago

https://github.com/szymex/xbmc-finnish-tv/blob/master/plugin.video.yleareena/resources/settings.xml

If getSetting works like it's documented, it should take defaults from there.

-Pasi

rasjani commented 10 years ago

Defaults to "no" .. and code to fetch that after initial installation:

intSetting = int(self.addon.getSetting("international"))

and error that was triggered:

Error Contents: invalid literal for int() with base 10: 'no'

Quite clear indication that default value of international to "no" is the trigger failure because you have string values as default parameters (and value that actually gets stored is integer)

pasiz commented 10 years ago

So the addon.getSetting() is not working as it should, because it's documented to provide integer values, but in initial condition it doesn't in your setup provide it correctly.

Could you specify your build and platform?

I'm referring to this: http://wiki.xbmc.org/index.php?title=Addon_Settings

dunno, if it's accurate, but official.

For "enum"-type settings the index of the value is saved, starting at 0 for the first value. For "labelenum"-type settings >the value is saved or, in case the lvalues attribute is used, the language id of the chosen value:

szymex commented 10 years ago

For other settings it works correctly (for example lang), it is a bug in xbmc. Anyway, just made a fix which handles exception.