RyanMelenaNoesis / XbmcSecurityCamOverlayAddOn

MIT License
19 stars 15 forks source link

CGI Support #1

Open ioguy opened 8 years ago

ioguy commented 8 years ago

How about adding support for cameras that grab the image via cgi (Trendnet): http://cameraip/image/jpeg.cgi

RyanMelenaNoesis commented 8 years ago

So long as the url returns a jpeg image it should work already.

ioguy commented 8 years ago

It does return a jpeg (and only a jpeg). I'm uing 15.2, maybe that's the issue? I get nothing returned or an error (just the default camera picture from the addon). Pointing a web broweser at http://user:pass@cameraip/image/jpeg.cgi works fine.

RyanMelenaNoesis commented 8 years ago

Please post logs to help determine the root cause of the error.

ioguy commented 8 years ago

Had to enable debug too see everything:

14:03:04 T:15148 DEBUG: CPythonInvoker(7, C:\Users\Test\AppData\Roaming\Kodi\addons\script.securitycam\default.py): start processing 14:03:04 T:15148 DEBUG: -->Python Interpreter Initialized<-- 14:03:04 T:15148 DEBUG: CPythonInvoker(7, C:\Users\Test\AppData\Roaming\Kodi\addons\script.securitycam\default.py): the source file to load is "C:\Users\Test\AppData\Roaming\Kodi\addons\script.securitycam\default.py" 14:03:04 T:15148 DEBUG: CPythonInvoker(7, C:\Users\Test\AppData\Roaming\Kodi\addons\script.securitycam\default.py): setting the Python path to C:\Users\Test\AppData\Roaming\Kodi\addons\script.securitycam;C:\Program Files (x86)\Kodi\system\python\DLLs;C:\Program Files (x86)\Kodi\system\python\Lib;C:\Program Files (x86)\Kodi\python27.zip;C:\Program Files (x86)\Kodi\system\python\lib\plat-win;C:\Program Files (x86)\Kodi\system\python\lib\lib-tk;C:\Program Files (x86)\Kodi;C:\Program Files (x86)\Kodi\system\python;C:\Program Files (x86)\Kodi\system\python\lib\site-packages 14:03:04 T:15148 DEBUG: CPythonInvoker(7, C:\Users\Test\AppData\Roaming\Kodi\addons\script.securitycam\default.py): entering source directory C:\Users\Test\AppData\Roaming\Kodi\addons\script.securitycam 14:03:04 T:15148 DEBUG: CPythonInvoker(7, C:\Users\Test\AppData\Roaming\Kodi\addons\script.securitycam\default.py): instantiating addon using automatically obtained id of "script.securitycam" dependent on version 2.14.0 of the xbmc.python api 14:03:04 T:15148 DEBUG: script.securitycam: AutoClose: [False] 14:03:04 T:15148 DEBUG: script.securitycam: Duration: [15000] 14:03:04 T:15148 DEBUG: script.securitycam: Interval: [500] 14:03:04 T:15148 DEBUG: script.securitycam: Width: [640] 14:03:04 T:15148 DEBUG: script.securitycam: Height: [400] 14:03:04 T:15148 DEBUG: script.securitycam: Original URL: [http://192.168.0.112/image/jpeg.cgi] 14:03:04 T:15148 DEBUG: script.securitycam: Final URL: [http://192.168.0.112/image/jpeg.cgi] 14:03:04 T:15148 DEBUG: script.securitycam: CamPreviewDialog Initialized 14:03:04 T:10948 DEBUG: ------ Window Init () ------ 14:03:04 T:15148 DEBUG: script.securitycam: CamPreviewDialog Started 14:03:04 T:15148 DEBUG: script.securitycam: Retreiving Image 14:03:04 T:10948 DEBUG: ------ Window Deinit (DialogAddonInfo.xml) ------ 14:03:05 T:15148 DEBUG: script.securitycam: Retreiving Image 14:03:11 T:10948 DEBUG: Previous line repeats 13 times. 14:03:11 T:10948 DEBUG: Keyboard: scancode: 0x01, sym: 0x001b, unicode: 0x001b, modifier: 0x0 14:03:11 T:10948 DEBUG: CInputManager::OnKey: escape (0xf01b) pressed, action is PreviousMenu 14:03:12 T:15148 DEBUG: script.securitycam: Received Action: 10 14:03:12 T:15148 INFO: CPythonInvoker(7, C:\Users\Test\AppData\Roaming\Kodi\addons\script.securitycam\default.py): script successfully run 14:03:12 T:15148 INFO: Python script stopped

ioguy commented 8 years ago

I'm guessing what is returned is not a proper jpg. I can save the picture in IE and there is no source to view, but when I try a standard jpg image from something like microsoft.com it works fine.

RyanMelenaNoesis commented 8 years ago

You could try experimenting by using wget to download the given url and then examine the resultant file.

ioguy commented 8 years ago

I grabbed the file with wget, looks fine in my image editors. Renamed it to pic.jpg and uploaded it to a web server, played fine in your addon.

ioguy commented 8 years ago

Did one last test. If I rename the file back to jpeg.cgi and place it on my regular server it no longer works. So it's the filename that is killing the addon.

RyanMelenaNoesis commented 8 years ago

I'll try to take a look at it soon. The code downloads from the specified url to a filename of its own creation so it shouldn't be an issue with the resultant filename but perhaps urllib2 is having some issue with the url extension.