2015-12-10, 10:52
hi,
i would like to know if there's a proper way to import/add python libraries to a kodi (15) addon ?
when i say python libraries i do mean regular python libraries, unrelated to kodi.
I'm running a python daemon (deluged) on Openelec6 (raspi and other arm devices) alongside kodi.
Kodi can still be used to interact with the daemon mostly to modify its basic (first run) configuration, but nothing else, maybe i'll also make it start / stop the daemon through systemd calls.
That python program requires many libraries (python and binaries) that are not shipped with kodi (or openelec) and i'm simply trying to include them in my addon.
i'll describe what i'm doing on my Openelec6 setup (i understand it should be platform independent but i'll address that later).
I also have to say that i have no real knowledge of git repositories nor kodi repositories which to my surprise do have some library addons but i have not yet found where they came from or how they were build.
So to add package libraries i have chrooted into an arch distro on the device, and installed the missing packages inside the chroot.
The python version is different from the host one but not significantly (2.7.3 vs 2.7.10), and at the moment the python program does run on the host, but the way i've added those python libraries to the host is very messy.
Indeed i simply copied the python module files (looking at the package files list in the chroot) inside my addonname/lib/ directory. It does work for some of the modules but for others, in sub directories it didn't.
i've then found a couple of existing script.module... addons (zope interface) from kodi repositories and noticed that the __init__.py are very different from the ones from the chroot packages, so i'm gessing it's the __init__ fault that some modules are not recognized by python on the host.
i did read about those __init__.py in the wiki but no real tutorial describing how to write them, i've started to look at python docs and well i'm getting lost in there..
I have a second question, once i've found how to add python libraries properly, i wanted to know if it was preferred to split every library into a different script.module... addon or if it made no difference putting everything inside my addon lib dir ?
thx for your input
i would like to know if there's a proper way to import/add python libraries to a kodi (15) addon ?
when i say python libraries i do mean regular python libraries, unrelated to kodi.
I'm running a python daemon (deluged) on Openelec6 (raspi and other arm devices) alongside kodi.
Kodi can still be used to interact with the daemon mostly to modify its basic (first run) configuration, but nothing else, maybe i'll also make it start / stop the daemon through systemd calls.
That python program requires many libraries (python and binaries) that are not shipped with kodi (or openelec) and i'm simply trying to include them in my addon.
i'll describe what i'm doing on my Openelec6 setup (i understand it should be platform independent but i'll address that later).
I also have to say that i have no real knowledge of git repositories nor kodi repositories which to my surprise do have some library addons but i have not yet found where they came from or how they were build.
So to add package libraries i have chrooted into an arch distro on the device, and installed the missing packages inside the chroot.
The python version is different from the host one but not significantly (2.7.3 vs 2.7.10), and at the moment the python program does run on the host, but the way i've added those python libraries to the host is very messy.
Indeed i simply copied the python module files (looking at the package files list in the chroot) inside my addonname/lib/ directory. It does work for some of the modules but for others, in sub directories it didn't.
i've then found a couple of existing script.module... addons (zope interface) from kodi repositories and noticed that the __init__.py are very different from the ones from the chroot packages, so i'm gessing it's the __init__ fault that some modules are not recognized by python on the host.
i did read about those __init__.py in the wiki but no real tutorial describing how to write them, i've started to look at python docs and well i'm getting lost in there..
I have a second question, once i've found how to add python libraries properly, i wanted to know if it was preferred to split every library into a different script.module... addon or if it made no difference putting everything inside my addon lib dir ?
thx for your input