How to access other addon xml files
#1
Could someone please advise the syntax for accessing other addons xml files from our own addon?

The xml files are in the userdata addon addon name directory.

Can we simply make a temporary change to the addon_id and then reinstate our own addon_id after the call to the 3rd parties addons xml file?

So something like this:

Code:
addon_id = "service.3rdpartyAddon"
Addon = xbmcaddon.Addon(addon_id)
datadir = Addon.getAddonInfo('profile')
addondir = Addon.getAddonInfo('path')

document = xml.dom.minidom.parse(xbmc.translatePath(datadir + "3rdparty.xml"))
............ work on document ......................

addon_id = "script.Ouraddon"
Addon = xbmcaddon.Addon(addon_id)
datadir = Addon.getAddonInfo('profile')
addondir = Addon.getAddonInfo('path')

.................proceed with OurAddon .......................
Easy Home Automation to Control your RF device within Kodi XBMC
Want to watch TV everywhere you go? Pop by the Want To Watch TV site.
Image
Reply
#2
what? you want to modify another addon? no. just no.
Reply
#3
(2015-02-27, 14:10)ironic_monkey Wrote: what? you want to modify another addon? no. just no.

We are not really modifying the 3rd party addon just the data xml that it operates with.
Easy Home Automation to Control your RF device within Kodi XBMC
Want to watch TV everywhere you go? Pop by the Want To Watch TV site.
Image
Reply
#4
(2015-02-27, 14:20)pieman Wrote:
(2015-02-27, 14:10)ironic_monkey Wrote: what? you want to modify another addon? no. just no.

We are not really modifying the 3rd party addon just the data xml that it operates with.

what do you want to do because it's not clear.

writing to it or only reading?
"not really modifying" is exactly the same as modifying it and that is absolutely not done, ever!
Read/follow the forum rules.
For troubleshooting and bug reporting, read this first
Interested in seeing some YouTube videos about Kodi? Go here and subscribe
Reply
#5
if all you need is to read props, you instance an xbmcaddon.Addon() like you do, and read the info. you can instance as many of those objects you see fit.
Reply
#6
(2015-02-27, 14:36)Martijn Wrote:
(2015-02-27, 14:20)pieman Wrote:
(2015-02-27, 14:10)ironic_monkey Wrote: what? you want to modify another addon? no. just no.

We are not really modifying the 3rd party addon just the data xml that it operates with.

what do you want to do because it's not clear.

writing to it or only reading?
"not really modifying" is exactly the same as modifying it and that is absolutely not done, ever!
The 3rd party addon is a scheduling service which allows users to schedule addons at various points through the day. This 3rd party addon creates an xml file with cron style data to hold the schedule times and schedule activities etc. There are a few features that the addon doesn't have that would be useful for our own addon. So what we would like to do is access the cron data xml file (not settings.xml or strings.xml) to cover the missing features required by our addon. This involves reading and writing to the cron data xml file but not the underlying 3rd party addon (defaulty.py, settings.xml, strings.xml).

Are you saying it is not acceptable to read and write to the 3rd party cron data xml?
Easy Home Automation to Control your RF device within Kodi XBMC
Want to watch TV everywhere you go? Pop by the Want To Watch TV site.
Image
Reply
#7
So you don't want the addon.xml file, you just want to read and write to an xml file created by another addon. Why not use any python xml library, there are a few. The addon you reference probably already has functions for this. Check their source.
Reply
#8
I just realized you are probably the same user that left the request on my github repo for the cron addon a week or so ago. I'm going to assume that is the addon you are wanting to work with. Rather than modifying that file directly what if I provided a way to call my addon from yours to add, list, or remove jobs? That would probably be a lot cleaner and your addon wouldn't break if something changed with the cron addon. I've been meaning to update it for some helix functionality anyway.
Reply
#9
(2015-02-28, 05:47)robweber Wrote: I just realized you are probably the same user that left the request on my github repo for the cron addon a week or so ago. I'm going to assume that is the addon you are wanting to work with. Rather than modifying that file directly what if I provided a way to call my addon from yours to add, list, or remove jobs? That would probably be a lot cleaner and your addon wouldn't break if something changed with the cron addon. I've been meaning to update it for some helix functionality anyway.

Hi robweber,

Your Addon is indeed the 3rd party Addon referenced in this thread and last night we finished the interface between our Addon and yours. As evidenced from this thread we have quite basic Python / Kodi experience and I'm sure coders would be appalled if they saw the hacks in our code.

However it seems to work and quite well. The full details of what we are doing is:

We have coded a micro controller to learn RF codes for 'any' device, except rolling codes, and it is connected to a machine running Kodi. With a single click of the TV remote control we can activate our immersion heater (or other RF controlled equipment) to run for 19 minutes for a hot shower. Not 15 minutes or 30 minutes like some timers but precisely the optimum duration for a hot shower without paying for electricity that is not needed.

Screenshot of the Addon settings:

Image

Pop up notification that the immersion heater is on for 19 minutes:

Image

Pop up notification, 19 minutes later, that the immersion heater is now off:

Image

RF devices can also be activated automatically at future times without input from the user.

One thing we have noticed is that our hack of your cron.xml file is adding whitespace between the records. It is only a few characters but over a few months these few characters would mount up. Any clues as to where the whitespace is coming from?

A method of adding, listing, deleting or editing your cron.xml from our Addon would be very useful and as you say it would cover any changes you make to your Addon. We really should have gone down the service route, rather than the script route, for our Addon as it would have been much easier for us to turn off the RF controlled device after the preconfigured number of minutes. It shows our lack of experience in this field but when we realised we should have gone for the service route we came across your Addon. Rather than reinvent the wheel we interfaced our Addon with yours.

Currently we don't have a requirement to edit existing cron tasks as they are either waiting to send the OFF signal at which point the task is deleted or the task hasn't been requested by the operator yet, in which case there is no entry in cron. That said, for further enhancements of our Addon I'm sure that editing tasks will be very useful.
Easy Home Automation to Control your RF device within Kodi XBMC
Want to watch TV everywhere you go? Pop by the Want To Watch TV site.
Image
Reply
#10
I've updated the main CronXbmc thread to reflect some of the changes you're asking about. I've also updated the addon to use some of the newer Helix service addon methods (hopefully this makes CPU usage more efficient). The format of the cron.xml file has remained the same so even without doing anything other than updating the addon your scripts should function. The module addition I've made is a much cleaner way of interfacing but not necessary.

http://forum.kodi.tv/showthread.php?tid=124888
Reply
#11
(2015-03-02, 21:14)robweber Wrote: I've updated the main CronXbmc thread to reflect some of the changes you're asking about. I've also updated the addon to use some of the newer Helix service addon methods (hopefully this makes CPU usage more efficient). The format of the cron.xml file has remained the same so even without doing anything other than updating the addon your scripts should function. The module addition I've made is a much cleaner way of interfacing but not necessary.

http://forum.kodi.tv/showthread.php?tid=124888

Thanks, I have just downloaded the zip from your Github and will work through the changes asap.
Easy Home Automation to Control your RF device within Kodi XBMC
Want to watch TV everywhere you go? Pop by the Want To Watch TV site.
Image
Reply

Logout Mark Read Team Forum Stats Members Help
How to access other addon xml files0