how to set a xbmc setting -or- how to activate debug from python - 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: how to set a xbmc setting -or- how to activate debug from python (/showthread.php?tid=45178) Pages:
1
2
|
[RESOLVED] how to set a xbmc setting -or- how to activate debug from python - solexalex - 2009-02-08 Hi It has been a long time since i post here ! I had to slow down xbmc plugin/scripts because I needed more family time... Anyway, I'm a little bit back, and I need some help. I just thought of something so interesting for developpers, that I'm surprised I can't find anything about it... Maybe I don't know what terms I need to look for in the forum. I think it could be interesting to activate/deactivate XBMC debug logging from our python scripts/plugins. So the infos I think about are : - a variable to get the debug status - a command to set on/off debug logging (as the XBMC setting does) I tried to find a solution without any success. Does someone can help me ? - Voinage - 2009-02-08 Try setting it via plugin settings- bool. Try these: xbmc.executehttpapi("") with GetLogLevel xbmc.executehttpapi("") with SetLogLevel yeah - solexalex - 2009-02-09 Hi Thanks a lot !! I searched but did not see it (ok i didn't read all, just trying to find 'debug' word and not 'loglevel' ... ) It works like a charm, and I think I will propose this as an option in my scripts/plugins in the future. Here is a sample code for those who need it Code: import xbmc - queeup - 2009-10-18 ea nice one but i can't figure out how can I change to debug level (1) on plugin/script exit. I use this code on my plugin: Code: if xbmcplugin.getSetting("debug") == "true": what can I do to revert back debug level on exit? - rwparris2 - 2009-10-18 queeup Wrote:what can I do to revert back debug level on exit? Just set it back at the end of your plugin? Code: originalloglevel = xbmc.executehttpapi("GetLogLevel").replace("<li>","") If you're doing this you'll need to wrap the main part of your plugin in a try/except so you can be sure to set the user's setting back to how they were regardless of anything exiting prematurely. This of course raises the question of why you would want to change the user's log level? - queeup - 2009-10-18 I prefer change Debug level from plugin setting instead of going System settings. It's easy for debugging errors. Your suggestion not working because I'm not using separate modules for this plugin. This is my latest plugin. I need the solve some problems before submit. http://xbmc.pastebin.com/m153a96b - solexalex - 2009-10-18 The answer from rwparris2 is totally what you have to do to set the loglevel to what is was before running.... What's wrong with it ? - queeup - 2009-10-18 noting wrong but I can't get it work. I want to revert log level on plugin exit. - amet - 2009-10-18 queeup Wrote:noting wrong but I can't get it work. I want to revert log level on plugin exit. PHP Code: # Constants This works, maybe post the whole plugin Cheers Zeljko - solexalex - 2009-10-18 If it is a plugin, it may be because you lose the info between to cycle of the plugin. Look this way. Or maybe you placed the restoration stuff too late in the plugin.... - queeup - 2009-10-18 I think my English not enough to explain my situation. Ok after few minutes I release this plugin, then maybe someone help me on this. - amet - 2009-10-18 queeup Wrote:I think my English not enough to explain my situation. Ok after few minutes I release this plugin, then maybe someone help me on this. spelling mistake line 33 in default.py, it should be PHP Code: xbmc.executehttpapi('SetLogLevel(3)') you have it as: PHP Code: xbmc.executehttpapi('SettLogLevel(3)') Zeljko - queeup - 2009-10-18 Yea i overlook that thx. Actually I commented out that lines on release - amet - 2009-10-18 queeup Wrote:Yea i overlook that thx. Actually I commented out that lines on release I know I un-commented(sp) it and fixed the spelling, if I enable debug in plugin settings it correctly sets debug level to 3 every time I click on the listitem and back to 1 after it finishes. - queeup - 2009-10-18 Quote:if I enable debug in plugin settings it correctly sets debug level to 3 every time I click on the listitem and back to 1 after it finishesYes I ask this question because of this situation. I need to revert back to debug level 1 just once on the plugin exit. Bahh never mind. It's not important actually |