Posts: 69
Joined: Feb 2013
Reputation:
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.
removed151214
Unregistered
removed151214
Unregistered
Posts: N/A
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'))
Posts: 69
Joined: Feb 2013
Reputation:
1
Oh, and the correct path is special://profile/addon_data/%addonid%
Posts: 646
Joined: May 2009
Reputation:
30
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
Posts: 69
Joined: Feb 2013
Reputation:
1
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.