Posts: 6
Joined: Jul 2016
Reputation:
0
Hello!
What is the best way to share data between service and add-on? I have a service that gets some data from the internet, and then i want to display this data in my add-on.
Where to save the file from service, or how is the best way to implement this?
Posts: 179
Joined: May 2013
Reputation:
4
808?
Senior Member
Posts: 179
Which service and which add-on?
Posts: 1,665
Joined: Jun 2011
Reputation:
119
An addon profile folder .../userdata/addon_data/my.addon/ is usually a recommended place to save all addon-specific data. The path can be retrieved via addon.getAddonInfo('profile') method.
As for data format, pickling is the most natural format for storing Python objects, but you can use any data format you like: JSON, SQLite, CSV and so on.
Posts: 261
Joined: Mar 2015
Reputation:
24
I've been contemplating on this issue as well.
Not to share between service and addon but when your addon calls itself to list something else.
I've seen some addon use xbmcgui.Window(10000).setProperty() / getProperty()
xbmcswift2 has some sort of storage mechanism that uses files.
there's also "import shelve" from python.
I have only tested the Window(10000) method.