What's the prefered way to save userdata?
#1
I'm looking to implement a "favourite" feature to my addon.
What is the recommended/prefered way, by XBMC, to store persistent userdata in an addon?

I could not find any relevant info on the wiki.
Reply
#2
I don't know if it's the preferred way, but I always save any user data to the special://profile/addon-data/%addonid% data directory - one of the few locations scripts are allowed to write to if they want to be on the repo - details are definately on the wiki somewhere. If you're storing a database, though, the common cache script might be of interest.

(Where %addonid% == xbmcaddon.Addon().getAddonInfo('id'))
Reply
#3
Alright, thanks!

Haven't seen that folder mentioned anywhere before in the addon docs. Found it here though: http://wiki.xbmc.org/?title=Userdata
Reply
#4
Oh, and the correct path is special://profile/addon_data/%addonid%
Reply
#5
The common cache script works very nice, easy to use

Other options are to store them in your own sqlite db in the same location mentioned above
Reply
#6
Thanks for the tip!

Went for storing a JSON file in "addon_data" instead though. The drawback is, obviously, a lot of IO when you are reading/writing items as I cannot store anything in memory.
Reply

Logout Mark Read Team Forum Stats Members Help
What's the prefered way to save userdata?0