Kodi Community Forum
Universal method to save user settings in file - 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: Universal method to save user settings in file (/showthread.php?tid=213088)



Universal method to save user settings in file - 88piotras - 2014-12-31

Hi

I'm new to XMBC plugin development.

I would like to save custom list in file locally, it should be working on platforms like windows, linux and android
User should be able to modify this list via plugin, so I will have to have permissions to modify that local file.

What would you advice?

Thx


RE: Universal method to save user settings in file - nampdn - 2016-01-09

This is what I'm looking for. Hope will get some helps.
Thanks in advance!!


RE: Universal method to save user settings in file - ronie - 2016-01-09

addons can (must) store everything in their own subfolder in addon_data.
to get the path to this folder in python:
Code:
folder = xbmc.translatePath(xbmcaddon.Addon().getAddonInfo('profile')).decode('utf-8')

for the rest, use xbmcvfs to create/read/write files:
http://mirrors.xbmc.org/docs/python-docs/16.x-jarvis/xbmcvfs.html