Info & data exchange between two addons
#1
I am working on two addons, that need to operate on a common data base.

First addon is a service addon that repeatedly scans a folder for existence of symbolic links to the vdr recording directory for video conversion, the other addon is a script addon that can be invoked to select one or multiple recordings and places a link/links in the scan folder.

Since I haven't found a way to combine both add ons into a single one, I am looking for a way to share data between the two. I am currently thinking of reading the path location of the service addon via JSON-RPC and then read the settings.xml file directly (the settings file contains the path to vdr recordings and scan directory).

Any hint is welcome also if you think this can be achieved in a better, easer fashion.
Reply
#2
There's a rather hacky but legit way to use xbmcgui.Window class as a key/value in-memory storage for inter-process communication in Python addons.
You need to create an xbmcgui.Window instance using one of the existing windod IDs, and then use setProperty and getProperty methods to store and retrieve arbitrary string values. That is, you can store there anything as long as it's a string, so non-string data need to be serialized/de-serialized, using JSON or pickle for example.

And since the data are stored in the Kodi core, they can be shared between Python processes as long as you use the same window ID.
Reply
#3
have a look at the simplecache script module.
http://mirrors.kodi.tv/addons/krypton/sc...mplecache/

i think it uses the method described by Roman_V_M to serve as a cache database for other addons.
Do not PM or e-mail Team-Kodi members directly asking for support.
Always read the Forum rules, Kodi online-manual, FAQ, Help and Search the forum before posting.
Reply
#4
Thanks. I will look into the simplecache script module for guidance. What about accessing the settings via
Quote:addon = xbmcaddon.Addon('service.xyz')
devicePath = addon.getSetting('Device Path')
startVolume = addon.getSetting('Starting Volume')
Would that work?
Reply
#5
Yes, it would, I tried it... but probably not recomended Smile
Reply
#6
(2017-02-13, 14:52)Spirou Wrote: Thanks. I will look into the simplecache script module for guidance. What about accessing the settings via
Quote:addon = xbmcaddon.Addon('service.xyz')
devicePath = addon.getSetting('Device Path')
startVolume = addon.getSetting('Starting Volume')
Would that work?

I guess it will work, but you will have file read/write overhead for settings.xml. Addon settings are better if you need persistency.
Reply
#7
Thank you all. Always good to have more than one option. I'll need the settings.xml for the service addon anyways, as it needs to be customizable for individual storage locations of vdr recordings and destination folder.

Will try and report...
Reply

Logout Mark Read Team Forum Stats Members Help
Info & data exchange between two addons0