PolyGlot allow use of Ruby programs.
Opened this issue · 7 comments
BACKGROUND
I have several ONVIF compliant IP cameras, which I would like to create on ONVIF event server to allow the ISY to monitor motion events.
At one point Polyglot (hence the name) goal was to allow use of multiple programming languages. I am interested in using an ONVIF Ruby GEM to create an ONVIF event server for the ISY, since I am already versed in Ruby
http://www.rubydoc.info/gems/ruby_onvif_client
QUESTION
Can execution of Ruby programs be added to UDI polyglot?
Unfortunately I personally know nothing about Ruby much less the ONVIF events. Can you code a simple python wrapper to handle your request?
I think the previous comment hits the heart of the issue -- is the need to be able to launch Ruby programs, or is the need to have a framework written in Ruby analogous to the Python node server framework currently offered along with Polyglot?
The former is easy. Below is some code that I use to do exactly this, albeit to launch a Perl script. I think it is reasonable to add a mechanism to Polyglot to either incorporate such a launcher script or make it unnecessary. The latter - a proper framework for Ruby -- is more ambitious, and not likely to be a short-term or simple thing.
#!/usr/bin/python
import os, sys
exe='/usr/bin/perl'
script='my-perl-nodeserver.pl'
sdir = os.path.abspath(os.path.dirname(sys.argv[0]))
os.execl(exe, exe, sdir + '/' + script)
Hello everyone,
Thanks so very much for all the input.
From my perspective:
-
It would be good to have different language bindings. This said – and if I take Node.js as an example – the only external binding that is fully supported is a C++ library. So, I am worried that if we add more language bindings on top of Python, we will be sitting here fixing language issues rather than Polyglot issues
-
One question: out of the team, how many are familiar with Node.js?
With kind regards,
Michel Kohanim
CEO
(p) 818.631.0333
(f) 818.436.0702
http://www.universal-devices.comhttp://www.universal-devices.com/
From: Mike Westerhof [mailto:notifications@github.com]
Sent: Sunday, March 20, 2016 9:54 AM
To: UniversalDevicesInc/Polyglot Polyglot@noreply.github.com
Subject: Re: [Polyglot] PolyGlot allow use of Ruby programs. (#14)
I think the previous comment hits the heart of the issue -- is the need to be able to launch Ruby programs, or is the need to have a framework written in Ruby analogous to the Python node server framework currently offered along with Polyglot?
The former is easy. Below is some code that I use to do exactly this, albeit to launch a Perl script. I think it is reasonable to add a mechanism to Polyglot to either incorporate such a launcher script or make it unnecessary. The latter - a proper framework for Ruby -- is more ambitious, and not likely to be a short-term or simple thing.
#!/usr/bin/python
import os, sys
exe='/usr/bin/perl'
script='my-perl-nodeserver.pl'
sdir = os.path.abspath(os.path.dirname(sys.argv[0]))
os.execl(exe, exe, sdir + '/' + script)
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHubhttps://github.com//issues/14#issuecomment-198962413
- I agree with Michel on this. Also, if just spawning a sub-processes, you need to create a new well defined communication mechanism between polyglot and the spawned process. Personally I would have preferred Perl over Python since I use that every day at work, but understand why Python was chosen, and am learning Python because of it :)
- I am familiar with Node.js, but very rusty since I have not used it in a few years.
Hi jimboca,
Thank you. The reason I asked about Node.js is because: we are getting rid of Java (for Admin Console) and moving to standards (JS/AJAX). I am not sure how long the migration takes though. So, if we are using JS for UI, the question is why not use Node.JS for Polyglot: it would make things a little easier. Also, we will have to update our ISY APIs to send/receive JSON (in addition to XML).
With kind regards,
Michel Kohanim
CEO
(p) 818.631.0333
(f) 818.436.0702
http://www.universal-devices.comhttp://www.universal-devices.com/
From: jimboca [mailto:notifications@github.com]
Sent: Sunday, March 20, 2016 11:51 AM
To: UniversalDevicesInc/Polyglot Polyglot@noreply.github.com
Cc: Michel Kohanim michel@universal-devices.com
Subject: Re: [Polyglot] PolyGlot allow use of Ruby programs. (#14)
- I agree with Michel on this. Also, if just spawning a sub-processes, you need to create a new well defined communication mechanism between polyglot and the spawned process. Personally I would have preferred Perl over Python since I use that every day at work, but understand why Python was chosen, and am learning Python because of it :)
- I am familiar with Node.js, but very rusty since I have not used it in a few years.
—
You are receiving this because you commented.
Reply to this email directly or view it on GitHubhttps://github.com//issues/14#issuecomment-198987696
+1 for Node.js there is a npm package for ONVIF cameras. https://www.npmjs.com/package/onvif
Although, event (motion) notification is still a WIP.
I have an update to this. I am about 3/4 of the way through creating a nodejs framework that mirrors the python nodeserver_api interface. Here is my current work on the subject.
Obviously this is a work in progress, but the bones are there. Works with MQTT or STDIN/STDOUT.