SecuritySpy Image Downloading and Stitching

Posted on
Sat Feb 24, 2018 1:24 pm
vtmikel offline
Posts: 628
Joined: Aug 31, 2012
Location: Boston, MA

SecuritySpy Image Downloading and Stitching

I've created a utility plugin for SecuritySpy. I designed the plugin to ease the combined use of SecuritySpy with the Pushover plugin. SecuritySpy, even when running on the same Mac as Indigo, does not easily make available a jpg of each camera for Indigo to reference. The webcam feature only allows for FTP uploads which is not convenient.

With this plugin, you can:
  • Download individual camera snapshots from SecuritySpy, and save them to your Mac to a location you choose, driven by a variable.
  • Download multiple camera snapshots from SecuritySpy, and stitch them together vertically into a single image to a location you choose, driven by a variable

Once you do the above actions, it's easy to use the same variable to use an image in a Pushover notification. For example, if you saw motion in your camera, and you wanted to send yourself a notification with the image from that camera, this is now easy to accomplish.

I have not posted to the plugin store, yet. Available for testing here: https://github.com/mlamoure/indigo-secu ... downloader

Mike

Posted on
Sat Feb 24, 2018 2:32 pm
FlyingDiver offline
User avatar
Posts: 7189
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: SecuritySpy Image Downloading and Stitching

You're going to need to patch your version of ghpu.py to the curl version, as the version you're using is broken now.

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Sat Feb 24, 2018 5:45 pm
vtmikel offline
Posts: 628
Joined: Aug 31, 2012
Location: Boston, MA

Re: SecuritySpy Image Downloading and Stitching

Will do thanks


Sent from my iPhone using Tapatalk Pro

Posted on
Sun Feb 25, 2018 6:21 am
vtmikel offline
Posts: 628
Joined: Aug 31, 2012
Location: Boston, MA

Re: SecuritySpy Image Downloading and Stitching

I wasn’t aware of the problems with the ghpu because I’m running HS. I’ll do the same as you and remove while we wait for a plug-in store update mechanism.


Sent from my iPad using Tapatalk Pro

Posted on
Sun Feb 25, 2018 6:42 am
FlyingDiver offline
User avatar
Posts: 7189
Joined: Jun 07, 2014
Location: Southwest Florida, USA

Re: SecuritySpy Image Downloading and Stitching

vtmikel wrote:
I wasn’t aware of the problems with the ghpu because I’m running HS. I’ll do the same as you and remove while we wait for a plug-in store update mechanism.


I ended up patching ghpu.py with this code. Just substitute this for the original _GET function:

Code: Select all
    def _GET(self, requestPath):
        self.logger.debug('GET %s' % requestPath)
        headers = {
            'User-Agent': 'Indigo-Plugin-Updater',
            'Accept': 'application/vnd.github.v3+json'
        }
        data = None
        f = subprocess.Popen(["/usr/bin/curl",  'https://api.github.com'+ requestPath], stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=False)
        out, err = f.communicate()
        self.logger.debug(u'HTTP Err result: ' + unicode(err) )
        self.logger.debug(u'ReturnCode:{0}'.format(unicode(f.returncode)))
     
        if (int(f.returncode) == 0):
            data = json.loads(out)
            self.logger.debug(u'Json results:' + unicode(data))
        elif (400 <= f.status < 500):
            error = json.loads(out)
            self.logger.error('%s' % error['message'])
        else:
            self.logger.error('Error: %s' % unicode(err))
       
        return data

joe (aka FlyingDiver)
my plugins: http://forums.indigodomo.com/viewforum.php?f=177

Posted on
Sun Feb 25, 2018 1:08 pm
ZachBenz offline
Posts: 163
Joined: Feb 08, 2014

Re: SecuritySpy Image Downloading and Stitching

vtmikel wrote:
With this plugin, you can:
  • Download individual camera snapshots from SecuritySpy, and save them to your Mac to a location you choose, driven by a variable.
  • Download multiple camera snapshots from SecuritySpy, and stitch them together vertically into a single image to a location you choose, driven by a variable


Awesome! I've been wanting something just like this. Don't suppose you'd be interested in adding a third option to stitch them together into an animated GIF (and/or movie)? :-)

ZachBenz's Plugins: RingForIndigo

Posted on
Tue Feb 27, 2018 3:07 pm
vtmikel offline
Posts: 628
Joined: Aug 31, 2012
Location: Boston, MA

Re: SecuritySpy Image Downloading and Stitching

ZachBenz wrote:
vtmikel wrote:
With this plugin, you can:
  • Download individual camera snapshots from SecuritySpy, and save them to your Mac to a location you choose, driven by a variable.
  • Download multiple camera snapshots from SecuritySpy, and stitch them together vertically into a single image to a location you choose, driven by a variable


Awesome! I've been wanting something just like this. Don't suppose you'd be interested in adding a third option to stitch them together into an animated GIF (and/or movie)? :-)


You may be overestimating my python skills! GIF's dont seem to be supported by pushover, which was my main reason for building the plugin. I'm not opposed if I can find a simple example to use.

Posted on
Wed May 09, 2018 12:14 am
agame offline
Posts: 514
Joined: Jul 13, 2017
Location: Melbourne, Australia

Re: SecuritySpy Image Downloading and Stitching

very handy, thankyou!
Ive noticed the stitched image fails altogether if one of the Security Spy cams is unavailable.
I have a couple of flakey cams that go up and down for their own reasons.
might would be more elegant if the remaining image(s) still got stitched.

Posted on
Wed May 09, 2018 3:47 pm
vtmikel offline
Posts: 628
Joined: Aug 31, 2012
Location: Boston, MA

Re: SecuritySpy Image Downloading and Stitching

agame wrote:
very handy, thankyou!
Ive noticed the stitched image fails altogether if one of the Security Spy cams is unavailable.
I have a couple of flakey cams that go up and down for their own reasons.
might would be more elegant if the remaining image(s) still got stitched.


Thanks for the report.

Assuming I can reproduce it, I’ll get it fixed. Can you post the error you get?


Sent from my iPhone using Tapatalk Pro

Posted on
Fri May 11, 2018 8:37 am
vtmikel offline
Posts: 628
Joined: Aug 31, 2012
Location: Boston, MA

Re: SecuritySpy Image Downloading and Stitching

agame wrote:
very handy, thankyou!
Ive noticed the stitched image fails altogether if one of the Security Spy cams is unavailable.
I have a couple of flakey cams that go up and down for their own reasons.
might would be more elegant if the remaining image(s) still got stitched.



Give 1.0.2 a try and see if that resolves the problem you were having. I've made it so that if any camera isn't available, it will move on with the ones that are available.

Posted on
Sat May 12, 2018 4:41 pm
agame offline
Posts: 514
Joined: Jul 13, 2017
Location: Melbourne, Australia

Re: SecuritySpy Image Downloading and Stitching

apologies was offline ... will do today/!

Posted on
Sun May 13, 2018 7:24 pm
agame offline
Posts: 514
Joined: Jul 13, 2017
Location: Melbourne, Australia

Re: SecuritySpy Image Downloading and Stitching

I have tested it, and it works!
I attempted to stitch 4 cams, of which only 1 is operational - as hoped I get a single image saved in the specified directory.
I assume as intended there is an error message reported as follows (though not sure why its reporting just temp2 missing - presumably all but temp 1 would have been?):

Action Group capture and stitch gate cams
Image Downloader and SecuritySpy Helper getting image: http://xxxx/++image?cameraNum=2 and saving it to: /Users/yyyy/SecuritySpy/temp1.jpg
Image Downloader and SecuritySpy Helper Debug completed
Image Downloader and SecuritySpy Helper getting image: http://xxxx/++image?cameraNum=4 and saving it to: /Users/yyyy/SecuritySpy/temp2.jpg
Image Downloader and SecuritySpy Helper Error error getting image. Status code: 404
Image Downloader and SecuritySpy Helper Debug error obtaining image 2, skipping
Image Downloader and SecuritySpy Helper getting image: http://xxxx/++image?cameraNum=1 and saving it to: /Users/yyyy/SecuritySpy/temp3.jpg
Image Downloader and SecuritySpy Helper Error error getting image. Status code: 404
Image Downloader and SecuritySpy Helper Debug error obtaining image 3, skipping
Image Downloader and SecuritySpy Helper getting image: http://xxxx/++image?cameraNum=3 and saving it to: /Users/yyyy/SecuritySpy/temp4.jpg
Image Downloader and SecuritySpy Helper Error error getting image. Status code: 404
Image Downloader and SecuritySpy Helper Debug error obtaining image 4, skipping
Image Downloader and SecuritySpy Helper Error Error in plugin execution ExecuteAction:

Traceback (most recent call last):
File "plugin.py", line 178, in stitchImageAction
OSError: (2, 'No such file or directory', '/Users/yyyy/SecuritySpy/temp2.jpg')

Posted on
Sun May 13, 2018 7:51 pm
vtmikel offline
Posts: 628
Joined: Aug 31, 2012
Location: Boston, MA

Re: SecuritySpy Image Downloading and Stitching

Looks like I have to fix the cleanup code. It's failing trying to delete the temporary files that are created for each camera, since some of the cameras failed.

I need to revisit the event log output for this plugin, it's quite ugly. I'll put that on my list too.

Posted on
Mon May 14, 2018 6:15 am
agame offline
Posts: 514
Joined: Jul 13, 2017
Location: Melbourne, Australia

Re: SecuritySpy Image Downloading and Stitching

all nice to have...but lovely that it works regardless!

Posted on
Thu May 17, 2018 1:38 pm
vtmikel offline
Posts: 628
Joined: Aug 31, 2012
Location: Boston, MA

Re: SecuritySpy Image Downloading and Stitching

Version 1.1 makes the fixes to the temporary file cleanup after stitching if the cameras weren't available.

Also, if you are using Cynical SecuritySpy plugin with your cameras configured, the action dialogs will now automatically load the camera numbers and names.

Who is online

Users browsing this forum: No registered users and 0 guests