• 1
  • 11
  • 12
  • 13(current)
  • 14
  • 15
  • 20
Release Security CAM Overlay add-on
OK after you said this post helped you I went and found it and changed my link.... It works AWSOME thanks so much guys :-D
(2014-05-27, 00:21)MFKinSINY Wrote: DUDE!!! This addon freakin RULES!!! Thank you for all your efforts! I wanna share what I've learned after accidentally stumbling upon this gem. It may help some other people figure out their problem(s)
I got stuck right out of the gate with the image url. Thankfully, my parents gave me the gift of relentlessness. I have an X10 ip camera. (yeah, I know.... X10 is blah compared to zWave & so many other better & newer technologies but eh)
The url I use to get to my cameras webpage is 192.168.1.xxx/IPCameramob.htm and there it asks for username & password, so of course I thought that this is what I needed to enter into the config. WRONG!!! Did not work. Ultimately I had to blank the two fields for username & password and "construct" a url based on what I discovered by right-clicking on the webpage & selecting "view source"
My url ended up being: http://192.168.1.xxx/snapshot.cgi?user=u...ut.value=4;
Of course, my username & password were used in place of my idiot markers above. Below is a portion of the "source" that led me to this url construct. Note that I can add more parameters after each semicolon if I choose to (or need to)
Good luck to all. I hope this helps out someone. Look for clues in the source of your webpage. Nobody ever uses my doorbell (I dont know why) so I will be setting up an infrared trip line hooked up to an Arduino that sends your json request when it is tripped (and I built an xbmc remote on my iPhone using iRule that will include a new button to initiate the same request, like a panic button on a security dvr) Now that I am thinking about it, two successive trip lines with logic so the request only gets sent when someone is coming & not when they are going. hmmmmmm Again.... MUCH thanks to the author of this addon! It was an exciting day for me Smile

function body_onload()
{
imgDisplay.src="snapshot.cgi?user="+top.user+"&pwd="+top.pwd;
snap_href.href="snapshot.cgi?user="+top.user+"&pwd="+top.pwd;

brightness_input.value=6;
contrast_input.value=4;
resolution_sel.value=resolution;
mode_sel.value=mode;
brightness_input.value=Math.round(brightness / 16);
contrast_input.value=contrast;
image_reversal.checked=(flip&0x01)?true:false;
image_mirror.checked=(flip&0x02)?true:false;
window.status='';
}
function load_video()
{
window.status=" ";
setTimeout("reload_image()",40);
}
function reload_image()
{
var xx = new Image();
xx.src = "snapshot.cgi?user="+top.user+"&pwd="+top.pwd+"&count="+count;
count++;
document.getElementById("imgDisplay").src = xx.src;
window.status=" ";
}
function reset_image()
{
window.status=" ";
setTimeout("reload_image()",40);
}
Reply
Has anyone been able to modify this add-on so more than one camera can be viewed at the same time ?

thank you,
Reply
I've found this piece of code which is a hybrid of this thread's code and the previous (doorbell script) :

im way out of my league in python, I would appreciate any help with it : ... im basically simply trying to get the feed from 4 cameras, I don't need any trigger or anything, just want to click on the addon and have the camera feeds show on screen indefinitely with a reload every x seconds.


Code:
# Import the XBMC/XBMCGUI modules

import os, time, urllib2, xbmc, xbmcaddon, xbmcgui, xbmcvfs

__addon__ = xbmcaddon.Addon()
__addonid__ = 'script.doorbell'

url=’http://192.168.1.240:240/image/jpeg.cgi’
url1=’http://192.168.1.241:241/image/jpeg.cgi’
url2=’http://192.168.1.242:242/image/jpeg.cgi’
url3=’http://192.168.1.243:243/image/jpeg.cgi’

path = xbmc.translatePath(‘special://profile/addon_data/%s’ % __addonid__)

if not xbmcvfs.exists(path):
xbmcvfs.mkdir(path)

imagefile = os.path.join(path, ‘cam1.png’)
imagefile1 = os.path.join(path, ‘cam2.png’)
imagefile2 = os.path.join(path, ‘cam3.png’)
imagefile3 = os.path.join(path, ‘cam4.png’)

#========================================================================
# Class – Set the initial image
#========================================================================

class CamView(xbmcgui.WindowDialog):
#class CamView(xbmcgui.Window):

def __init__(self):
#
#set the initial image before the window is shown
#aspectRatio : [opt] integer – (values
# 0 = stretch (default),
# 1 = scale up (crops),
# 2 = scale down (black bars)
# colorDiffuse : hexString – (example, ’0xC0FF0000' (red tint))

urllib.urlretrieve(url, imagefile)
self.image = xbmcgui.ControlImage(0, 0, 640, 360, imagefile, aspectRatio=2) # top-left
self.addControl(self.image)

urllib.urlretrieve(url1, imagefile1)
self.image1 = xbmcgui.ControlImage(640, 0, 640, 360, imagefile1, aspectRatio=2) # top-right
self.addControl(self.image1)

urllib.urlretrieve(url2, imagefile2)
self.image2 = xbmcgui.ControlImage(0, 360, 640, 360, imagefile2, aspectRatio=2) # bottom-left
self.addControl(self.image2)

urllib.urlretrieve(url3, imagefile3)
self.image3 = xbmcgui.ControlImage(640, 360, 640, 360, imagefile3, aspectRatio=2) # bottom-right
self.addControl(self.image3)

#========================================================================
# Program
#========================================================================

viewer = CamView()
viewer.show()

start_time = time.time()
firstimage = True

while(time.time() – start_time <= 59):

urllib.urlretrieve(url, imagefile)
viewer.image.setImage("")
viewer.image.setImage(imagefile)

urllib.urlretrieve(url1, imagefile1)
viewer.image1.setImage("")
viewer.image1.setImage(imagefile1)

urllib.urlretrieve(url2, imagefile2)
viewer.image2.setImage("")
viewer.image2.setImage(imagefile2)

urllib.urlretrieve(url3, imagefile3)
viewer.image3.setImage("")
viewer.image3.setImage(imagefile3)

xbmc.sleep(500)

viewer.close()
del viewer
Reply
bump ...
Reply
(2014-11-16, 16:32)Extraze Wrote: I've found this piece of code which is a hybrid of this thread's code and the previous (doorbell script) :

im way out of my league in python, I would appreciate any help with it : ... im basically simply trying to get the feed from 4 cameras, I don't need any trigger or anything, just want to click on the addon and have the camera feeds show on screen indefinitely with a reload every x seconds.


Code:
# Import the XBMC/XBMCGUI modules

import os, time, urllib2, xbmc, xbmcaddon, xbmcgui, xbmcvfs

__addon__ = xbmcaddon.Addon()
__addonid__ = 'script.doorbell'

url=’http://192.168.1.240:240/image/jpeg.cgi’
url1=’http://192.168.1.241:241/image/jpeg.cgi’
url2=’http://192.168.1.242:242/image/jpeg.cgi’
url3=’http://192.168.1.243:243/image/jpeg.cgi’

path = xbmc.translatePath(‘special://profile/addon_data/%s’ % __addonid__)

if not xbmcvfs.exists(path):
xbmcvfs.mkdir(path)

imagefile = os.path.join(path, ‘cam1.png’)
imagefile1 = os.path.join(path, ‘cam2.png’)
imagefile2 = os.path.join(path, ‘cam3.png’)
imagefile3 = os.path.join(path, ‘cam4.png’)

#========================================================================
# Class – Set the initial image
#========================================================================

class CamView(xbmcgui.WindowDialog):
#class CamView(xbmcgui.Window):

def __init__(self):
#
#set the initial image before the window is shown
#aspectRatio : [opt] integer – (values
# 0 = stretch (default),
# 1 = scale up (crops),
# 2 = scale down (black bars)
# colorDiffuse : hexString – (example, ’0xC0FF0000' (red tint))

urllib.urlretrieve(url, imagefile)
self.image = xbmcgui.ControlImage(0, 0, 640, 360, imagefile, aspectRatio=2) # top-left
self.addControl(self.image)

urllib.urlretrieve(url1, imagefile1)
self.image1 = xbmcgui.ControlImage(640, 0, 640, 360, imagefile1, aspectRatio=2) # top-right
self.addControl(self.image1)

urllib.urlretrieve(url2, imagefile2)
self.image2 = xbmcgui.ControlImage(0, 360, 640, 360, imagefile2, aspectRatio=2) # bottom-left
self.addControl(self.image2)

urllib.urlretrieve(url3, imagefile3)
self.image3 = xbmcgui.ControlImage(640, 360, 640, 360, imagefile3, aspectRatio=2) # bottom-right
self.addControl(self.image3)

#========================================================================
# Program
#========================================================================

viewer = CamView()
viewer.show()

start_time = time.time()
firstimage = True

while(time.time() – start_time <= 59):

urllib.urlretrieve(url, imagefile)
viewer.image.setImage("")
viewer.image.setImage(imagefile)

urllib.urlretrieve(url1, imagefile1)
viewer.image1.setImage("")
viewer.image1.setImage(imagefile1)

urllib.urlretrieve(url2, imagefile2)
viewer.image2.setImage("")
viewer.image2.setImage(imagefile2)

urllib.urlretrieve(url3, imagefile3)
viewer.image3.setImage("")
viewer.image3.setImage(imagefile3)

xbmc.sleep(500)

viewer.close()
del viewer

I had a quick go at this. Try script.multi.cam-0.0.1.zip.
Leopold's Repository: Home of LibreELEC Dev Updater ...
Reply
Is there a way to disable / hide the rss feed when the camera image is shown?
Reply
(2014-12-06, 00:08)Leopold Wrote:
(2014-11-16, 16:32)Extraze Wrote: I've found this piece of code which is a hybrid of this thread's code and the previous (doorbell script) :

im way out of my league in python, I would appreciate any help with it : ... im basically simply trying to get the feed from 4 cameras, I don't need any trigger or anything, just want to click on the addon and have the camera feeds show on screen indefinitely with a reload every x seconds.


Code:
# Import the XBMC/XBMCGUI modules

import os, time, urllib2, xbmc, xbmcaddon, xbmcgui, xbmcvfs

__addon__ = xbmcaddon.Addon()
__addonid__ = 'script.doorbell'

url=’http://192.168.1.240:240/image/jpeg.cgi’
url1=’http://192.168.1.241:241/image/jpeg.cgi’
url2=’http://192.168.1.242:242/image/jpeg.cgi’
url3=’http://192.168.1.243:243/image/jpeg.cgi’

path = xbmc.translatePath(‘special://profile/addon_data/%s’ % __addonid__)

if not xbmcvfs.exists(path):
xbmcvfs.mkdir(path)

imagefile = os.path.join(path, ‘cam1.png’)
imagefile1 = os.path.join(path, ‘cam2.png’)
imagefile2 = os.path.join(path, ‘cam3.png’)
imagefile3 = os.path.join(path, ‘cam4.png’)

#========================================================================
# Class – Set the initial image
#========================================================================

class CamView(xbmcgui.WindowDialog):
#class CamView(xbmcgui.Window):

def __init__(self):
#
#set the initial image before the window is shown
#aspectRatio : [opt] integer – (values
# 0 = stretch (default),
# 1 = scale up (crops),
# 2 = scale down (black bars)
# colorDiffuse : hexString – (example, ’0xC0FF0000' (red tint))

urllib.urlretrieve(url, imagefile)
self.image = xbmcgui.ControlImage(0, 0, 640, 360, imagefile, aspectRatio=2) # top-left
self.addControl(self.image)

urllib.urlretrieve(url1, imagefile1)
self.image1 = xbmcgui.ControlImage(640, 0, 640, 360, imagefile1, aspectRatio=2) # top-right
self.addControl(self.image1)

urllib.urlretrieve(url2, imagefile2)
self.image2 = xbmcgui.ControlImage(0, 360, 640, 360, imagefile2, aspectRatio=2) # bottom-left
self.addControl(self.image2)

urllib.urlretrieve(url3, imagefile3)
self.image3 = xbmcgui.ControlImage(640, 360, 640, 360, imagefile3, aspectRatio=2) # bottom-right
self.addControl(self.image3)

#========================================================================
# Program
#========================================================================

viewer = CamView()
viewer.show()

start_time = time.time()
firstimage = True

while(time.time() – start_time <= 59):

urllib.urlretrieve(url, imagefile)
viewer.image.setImage("")
viewer.image.setImage(imagefile)

urllib.urlretrieve(url1, imagefile1)
viewer.image1.setImage("")
viewer.image1.setImage(imagefile1)

urllib.urlretrieve(url2, imagefile2)
viewer.image2.setImage("")
viewer.image2.setImage(imagefile2)

urllib.urlretrieve(url3, imagefile3)
viewer.image3.setImage("")
viewer.image3.setImage(imagefile3)

xbmc.sleep(500)

viewer.close()
del viewer

I had a quick go at this. Try script.multi.cam-0.0.1.zip.

simply amazing ... thank you !!!

love the fact that you put in a black background ! where do I send the case of beer to ?
Reply
just found a little bug.

the directory storing the images never clears itself, so it doesn't take long for it to get to 1GB+ of jpg files.

is there a way to clean the directory every couple of seconds ?
Reply
(2014-12-20, 21:47)Extraze Wrote: just found a little bug.

the directory storing the images never clears itself, so it doesn't take long for it to get to 1GB+ of jpg files.

is there a way to clean the directory every couple of seconds ?

The script is meant to clean up after itself when the cam overlay is closed. Are you seeing different behavior or is the issue that you're leaving the overlay open long enough that the snapshots start to add up?

(2014-12-07, 22:22)Slurm Wrote: Is there a way to disable / hide the rss feed when the camera image is shown?

Not that I'm aware of and I didn't find anything in a quick search. If you could find a "disable RSS" setting available in the xbmc/kodi API then you could build a macro on a button to perform both steps.
Reply
(2014-12-20, 21:59)iolaus Wrote:
(2014-12-20, 21:47)Extraze Wrote: just found a little bug.

the directory storing the images never clears itself, so it doesn't take long for it to get to 1GB+ of jpg files.

is there a way to clean the directory every couple of seconds ?

The script is meant to clean up after itself when the cam overlay is closed. Are you seeing different behavior or is the issue that you're leaving the overlay open long enough that the snapshots start to add up?


yeah, I can see in the code the clean-up part on close... im trying to make it clean up every couple of seconds but I suck so much in python, (I had to ask my GF to help me out with the first iteration of this program lol)

The actual purpose of this particular RaspberryPi is to monitor these 4 cameras, (it will sometimes be used for media but only in rare occurrences) so in about 1 hour of viewing, I got close to 1GB of images... so it wouldn't take long for the SD card to fill up.
Reply
so I inserted the following after xbmc.sleep(500)

Code:
for f in glob.glob(os.path.join(data_path, "*.jpg")):
                    os.remove(f)

it seems to be doing the trick, not too sure if this is the way to do it ... let me know

thanks
Reply
(2014-12-21, 00:29)Extraze Wrote: yeah, I can see in the code the clean-up part on close... im trying to make it clean up every couple of seconds but I suck so much in python, (I had to ask my GF to help me out with the first iteration of this program lol)
I'll add some code to do that and will start another thread so we can discuss it there.

(2014-12-21, 00:29)Extraze Wrote: The actual purpose of this particular RaspberryPi is to monitor these 4 cameras, (it will sometimes be used for media but only in rare occurrences) so in about 1 hour of viewing, I got close to 1GB of images... so it wouldn't take long for the SD card to fill up.
If that's the sole purpose then you don't really need Kodi right? You could run four instances of omxplayer with the appropriate --win parameters to put each one in a corner. I set up something similar using Arch Linux and systemd to boot directly into an ip camera stream. It's off topic here though. I can PM you the details.
Leopold's Repository: Home of LibreELEC Dev Updater ...
Reply
If it is any help, here's what I did to get this addon sorted:

1. zipped the files from guthub. extracted them and rezipped just the script folder. installed the addon.
2. for the url I was a bit miffed for some time, but then it occurred to me to log into the camera, right click on the image and get the url that way. I am using a D-Link DCS-2132LB1 and it ended up being http://xxx.xxx.xxx.xxx/dms?nowprofileid=...9569999278 which I truncated to http://xxx.xxx.xxx.xxx/dms?nowprofileid=2. none of my web searches suggested that this was the url to use, in fact I was using others which were not correct.
Reply
Hi guys

the script mentioned above with the 4 cams is from homeawesomation
https://homeawesomation.wordpress.com/20...mc-update/

and i and 4lb3rto did some changes to get it better.

Have a look at - Sorry all in german!
http://www.kodinerds.net/index.php/Threa.../?pageNo=1

Latest files can be downloaded at - Kodi ready!
http://workupload.com/file/9BNwarqR

At the moment there are 6 cams in the script as overlay with no black background - overlay
The url of the cams can be entered in the settings menu.

The problem at the moment is that i want to integrate the addon into the main menu and start it when enttering security main menu point and end it when leaving.

The integration in the Skin is not the Problem there is mad max helping to get this done.

The main problem is that when the script is running it blocks all kind of navigation in the menu.
This is worse because i want to navigate throug the cams and make them clickable to start a fullscreen stream.

The starting of the stream is also ready to go.

Is there somone good in Python who can help me to change the script so that a navigation is possible when it is running.

I am a noob in pyhton and thats the biggest problem at the moment.

Bye Shigoru (Homeserver in the german forum)
Reply
shigoru,

thanks for the link to your addon,

i just tried it, substituted in the "test urls", and i get this error...

Code:
File "C:\Users\MyName\AppData\Roaming\Kodi\addons\script.securitycams\default.py", line 21, in <module>
                                                '''
                                            ImportError: No module named PIL
                                            -->End of Python script error report<--

installed this ->
Code:
http://www.pythonware.com/products/pil/#pil117

pls how can i install PIL module, so that the addon can see it?

thx in advance,
Dam0
Reply
  • 1
  • 11
  • 12
  • 13(current)
  • 14
  • 15
  • 20

Logout Mark Read Team Forum Stats Members Help
Security CAM Overlay add-on1
This forum uses Lukasz Tkacz MyBB addons.