• 1
  • 16
  • 17
  • 18
  • 19(current)
  • 20
Release Security CAM Overlay add-on
Thanks for making this add-on!!!  It's exactly what I had in mind and needed.  I wanted to post here though because I had to tweak the code a little bit.  I have Dahua cameras, which require Digest and not basic authentication.  I made a little change to the code so I can get digest authentication to work.  I also changed the addon id to drivewaycam so I can  have multiple cameras pop up, and added a 4 second timeout to the jpg grab.  Sometimes the cameras give an HTTP 500 error, which I found out, happens if you set your quality too high.  

There's a little gotcha with it too.  You need to change the realm and FQDN in the add_password line to whatever your camera answers with.  To get the realm, run the python script below...

Hopefully this helps some people out.  I know the code isn't the greatest, but it seems to work for digest auth.  Good Luck!

Code:

--- default-orig.py    2020-04-10 07:05:01.018475968 -0500
+++ default.py    2020-04-10 07:06:22.163698273 -0500
@@ -5,7 +5,7 @@
 ACTION_PREVIOUS_MENU = 10
 ACTION_BACKSPACE = 110
 ACTION_NAV_BACK = 92
-ADD_ON_ID = 'script.securitycam'
+ADD_ON_ID = 'script.drivewaycam'
 
 # Set plugin variables
 __addon__    = xbmcaddon.Addon()
@@ -64,7 +64,7 @@
     def downloadSnapshot(self, url, destination):
         log('Retreiving Image \n', xbmc.LOGDEBUG)
         try:
-            imgData = urllib2.urlopen(url).read()
+            imgData = urllib2.urlopen(url,timeout=4).read()
             filename = snapshot = xbmc.translatePath( os.path.join( destination, 'snapshot' + str(time.time()) + '.jpg' ).encode("utf-8") ).decode("utf-8")
             output = open(filename,'wb')
             log('Saving Image To: [' + filename + ']\n', xbmc.LOGDEBUG)
@@ -95,11 +95,9 @@
 
 # Add Basic Authentication Headers
 if (username is not None and username != ''):
-    passwordManager = urllib2.HTTPPasswordMgrWithDefaultRealm()
-    passwordManager.add_password(None, url, username, password)
-    authhandler = urllib2.HTTPBasicAuthHandler(passwordManager)
-    opener = urllib2.build_opener(authhandler)
-    urllib2.install_opener(opener)
+    ah = urllib2.HTTPDigestAuthHandler()
+    ah.add_password('Login to <some random code>', 'http://driveway.foo.bar/', username, password)
+    urllib2.install_opener(urllib2.build_opener(ah))
 
 # Replace URL agruments
 argCount = len(sys.argv)


And here is that program you can run to grab the realm.  

Code:
#!/usr/bin/python
import os,urllib2

theurl = "http://driveway.foo.bar/cgi-bin/snapshot.cgi?0"

req = urllib2.Request(theurl)
try:
    handle = urllib2.urlopen(req)
except IOError, e:
    if hasattr(e, 'code'):
        if e.code != 401:
            print 'We got another error'
            print e.code
        else:
            print e.headers
            print e.headers['www-authenticate']
Reply
Hi, add on looks great, big thank you for the update.
Just as an request, did you play around with mqtt? I have a camera which sends mqtt message when motion is triggered and of course I want to use it as a trigger for add on to start. Any idea where should I start looking for mqtt for kodi? There is 1 addon in the history but it is not updated for many years now.
Reply
It is probably me, but could someone give me an example when i press "3"on my keyboard i want to show overlay of cam1.
How, or what must i put in keyboard.xml to get this?
<keymap>
<global>
<keyboard>
<three>ExecuteAddon i just do not know what to put in here could someone please help me? thank you</three>

or is this not possible?

thanks in advance

Could someone please tell me if this is possible, i have been searching and testing all night and day to get this working, but i just do not know how.

In my keyboard.xml:
I try   <three>RunAddon(script.securitycam?action=CamPreview=1)</three>
or         <three>XBMC.RunScript(script.securitycam?action=Cam=1)</three>
And lots of other options, but i just do not know if or how this can be working.

Someone please help?
Reply
(2019-03-30, 17:12)Spirou Wrote: If you are interested in an updated version that supports multiple cam feeds, positioning of the overlay window(s) and that is compatible with kodi 18 you may want to look here.

Is there a version that works on Kodi v19 Matrix / Python 3?

Thanks
Reply
Really? No one?
Reply
(2021-03-05, 13:54)jinux Wrote: Really? No one?

Have a look at the github link in the quote two posts above. The latest version of the code should also run with kodi 19 / python 3.
Reply
(2021-05-11, 09:38)Spirou Wrote:
(2021-03-05, 13:54)jinux Wrote: Really? No one?

Have a look at the github link in the quote two posts above. The latest version of the code should also run with kodi 19 / python 3.

I know, i think you quoted the wrong post.
Reply
(2021-02-22, 21:49)jinux Wrote: Someone please help?
The correct call is:

RunAddon(script.securitycam,streamid=2)

where 2 is just an example. It can be 1, 2, 3, 4. It is the index of the camera feed as configured in the addon.
Reply
(2021-05-17, 10:56)Spirou Wrote:
(2021-02-22, 21:49)jinux Wrote: Someone please help?
The correct call is:

RunAddon(script.securitycam,streamid=2)

where 2 is just an example. It can be 1, 2, 3, 4. It is the index of the camera feed as configured in the addon.
Hey great, thanks. I now just installed the scipt 4 times with a different name and use only cam1 of the script. then did this:
<three>RunScript(script.securitycam1)</three>
<four>RunScript(script.securitycam2)</four>
and so on....

It works, but ill try yours too, seems more logical to use the script/add-on, only to install once instead of 4 times under different name.

Thank you :-)
Reply
Any tips for installing this in v19.5+?  I keep getting errors about missing python dependency 2.14.0 on a new install.  I have some existing ones that were upgraded kodi clients from V17 or 18 that do work with it.
Reply
(2023-03-04, 19:28)Dweber85rc Wrote: Any tips for installing this in v19.5+?  I keep getting errors about missing python dependency 2.14.0 on a new install.  I have some existing ones that were upgraded kodi clients from V17 or 18 that do work with it.
python 2 is deprecated in kodi and it uses python 3+ now, python2 code is largely incompatible with python3
... so nothing short of the developer updating the addon to python3 will not get this to work with newer versions of kodi
Reply
(2023-03-04, 19:28)Dweber85rc Wrote: Any tips for installing this in v19.5+?  I keep getting errors about missing python dependency 2.14.0 on a new install.  I have some existing ones that were upgraded kodi clients from V17 or 18 that do work with it.

In addition to the Python 2 dependency issue I took a look at the addon code and there are a few other Kodi level changes required to run this addon under Kodi 19 or 20.  I'll put this one on my To-Do list to port to Kodi 19 but I am not exactly sure when I'll be able to gt to it.  That will depend upon how much longer my current project takes.


Thanks,

Jeff
Running with the Mezzmo Kodi addon.  The easier way to share your media with multiple Kodi clients.
Service.autostop , CBC Sports, Kodi Selective Cleaner and Mezzmo Kodi addon author.
Reply
(2023-03-04, 19:28)Dweber85rc Wrote: Any tips for installing this in v19.5+?  I keep getting errors about missing python dependency 2.14.0 on a new install.  I have some existing ones that were upgraded kodi clients from V17 or 18 that do work with it.

I saw this link above to a Kodi security cam port of the code which looks like it supports Kodi 18 and 19.  I am not sure if you've tried it ?


Thanks,

Jeff
Running with the Mezzmo Kodi addon.  The easier way to share your media with multiple Kodi clients.
Service.autostop , CBC Sports, Kodi Selective Cleaner and Mezzmo Kodi addon author.
Reply
(2023-03-04, 20:37)jbinkley60 Wrote:
(2023-03-04, 19:28)Dweber85rc Wrote: Any tips for installing this in v19.5+?  I keep getting errors about missing python dependency 2.14.0 on a new install.  I have some existing ones that were upgraded kodi clients from V17 or 18 that do work with it.

I saw this link above to a Kodi security cam port of the code which looks like it supports Kodi 18 and 19.  I am not sure if you've tried it ?


Thanks,

Jeff

Thank you, I totally missed that before, that must be what I have installed on my other kodi instances and didn't realize it!  That works
Reply
Is there a way to run either a second instance of this addon or a way to edit this one to support more than 4 cameras?
Reply
  • 1
  • 16
  • 17
  • 18
  • 19(current)
  • 20

Logout Mark Read Team Forum Stats Members Help
Security CAM Overlay add-on1