This post is to summarize some stuff you can find earlier in this thread, and present fixes for common problems that newcomers to this thread might stumble onto/over.
Firstly... the C1/"Foscam HD Override" bug...
I'm not sure if the .zip file for v1.2.3 that is on Maikito26's repo is exactly the same version as the source code in his github, but either way, I think both have a bug that breaks the "Foscam HD Override" camera type. Or I'm not configuring my cameras correctly. Either way, there's some fixes.
Credit to Maikito26, ogremalfeitor, and RaysceneNS who all left a trail of breadcrumbs behind for me to look through. I'll summarize their edits here...
(2016-04-28, 14:01)maikito26 Wrote: @ogremalfeitor It's an error in my code Sorry!
Update file: [kodi settings folder]/addons/plugin.video.surveillanceroom/resources/lib/ipcam_api_foscamhd.py
Update lines: around 807-835 from 'class FoscamCameraOverride(FoscamCamera)'- From:
super(FoscamCamera, self).init(camera_settings, daemon = False, verbose = True)
- ___To:
super(FoscamCameraOverride, self).init(camera_settings, daemon = False, verbose = True)
.- From:
_mjpegUrl = "http://{0}/cgi-bin/CGIStream.cgi?cmd={GetMJStream}&usr={1}&pwd={2}&".format(self.url, self.usr, self.pwd)
- ___To:
_mjpegUrl = "http://{0}/cgi-bin/CGIStream.cgi?cmd=GetMJStream&usr={1}&pwd={2}&".format(self.usr, self.pwd)
.- From:
_snapshotUrl = "http://{0}/cgi-bin/CGIProxy.fcgi?cmd={snapPicture2}&usr={1}&pwd={2}&".format(self.url, self.usr, self.pwd)
- ___To:
_snapshotUrl = "http://{0}/cgi-bin/CGIProxy.fcgi?cmd=snapPicture2&usr={1}&pwd={2}&".format(self.usr, self.pwd)
This is because I didn't properly test it after making the API Wrapper changes. Hope that fixes it!
Those fixes didn't work or weren't sufficient for ogremalfeitor, who fixed some of those fixes and added another fix for the rtsp stream since the port defaults to the rtsp-default of 554 for C1's, instead of 88 which was used on earlier cameras...
(2016-04-29, 23:57)ogremalfeitor Wrote: I changed the lines you mentioned, but had to be to:
- From:
_mjpegUrl = "http://{0}/cgi-bin/CGIStream.cgi?cmd={GetMJStream}&usr={1}&pwd={2}&".format(self.url, self.usr, self.pwd)
- ___To:
_mjpegUrl = "http://{0}/cgi-bin/CGIStream.cgi?cmd=GetMJStream&usr={1}&pwd={2}&".format(self.url, self.usr, self.pwd)
.- From:
_snapshotUrl = "http://{0}/cgi-bin/CGIProxy.fcgi?cmd={snapPicture2}&usr={1}&pwd={2}&".format(self.url, self.usr, self.pwd)
- ___To:
_snapshotUrl = "http://{0}/cgi-bin/CGIProxy.fcgi?cmd=snapPicture2&usr={1}&pwd={2}&".format(self.url, self.usr, self.pwd)
.- From:
_videoUrl = "rtsp://{0}:{1}@{2}/videoMain".format(self.usr, self.pwd, self.url)
- ___To:
_videoUrl = "rtsp://{0}:{1}@{2}/videoMain".format(self.usr, self.pwd, self.host)
This was a nice elegant fix that I assume worked based on the RTSP protocol defaulting to 554 unless otherwise overridden by swapping the combined host+IP "url" variable with just the host variable.
But there's a specific thing here where I'm super super confused: Since ogremalfeitor didn't mention the
super(FoscamCamera, self)
... line, it kinda sounds like it worked for him?? Or maybe he just easily saw a fix, applied it, and forgot to mention it. Either way, that needed further TLC, which was provided in a fork on github by RaysceneNS:
https://github.com/maikito26/plugin.vide...187716d0cc
His edits were...
github user RaysceneNS Wrote:Fix for __init__ FoscamCameraOverride class:
- Change video_url to use port 554 for RTSP stream in this model.
- Fix for cmd attributes of snapshot_url and mjpeg_url.- From:
super(FoscamCamera, self).init(camera_settings, daemon = False, verbose = True)
- ___To:
FoscamCamera.__init__(self, camera_settings, daemon, verbose)
.- From:
_mjpegUrl = "http://{0}/cgi-bin/CGIStream.cgi?cmd={GetMJStream}&usr={1}&pwd={2}&".format(self.url, self.usr, self.pwd)
- ___To:
_mjpegUrl = "http://{0}/cgi-bin/CGIStream.cgi?cmd=GetMJStream&usr={1}&pwd={2}&".format(self.url, self.usr, self.pwd)
.- From:
_snapshotUrl = "http://{0}/cgi-bin/CGIProxy.fcgi?cmd={snapPicture2}&usr={1}&pwd={2}&".format(self.url, self.usr, self.pwd)
- ___To:
_snapshotUrl = "http://{0}/cgi-bin/CGIProxy.fcgi?cmd=snapPicture2&usr={1}&pwd={2}&".format(self.url, self.usr, self.pwd)
.- From:
_videoUrl = "rtsp://{0}:{1}@{2}/videoMain".format(self.usr, self.pwd, self.url)
- ___To:
_videoUrl = "rtsp://{0}:{1}@{2}:554/videoMain".format(self.usr, self.pwd, self.host)
However, I asked RaysceneNS about exactly why that fix worked, and he wasn't exactly sure either.
Also, there's nothing wrong with specifying the :554 in there, but I *think* that was unnecessary...?
Anyway, I ultimately tried my hand at some edits and along the way found a different fix for the error-generating
super(FoscamCamera, self)...
line. I don't know if mine is any better than RaysceneNS's, but it's closer to SR's author's original suggestion, so I'm going to personally roll with it. Another thing I did was make the rtsp port dynamic instead of hardcoded, fed into the code live like the other port, via the addon's settings. Doing that requires several other edits so I'll put that in the next section of this post, and leave a slightly modified version of RaysceneNS's edits which represents my final edits to date (except without my dynamic rtsp, which we'll get to).
For anyone wanting to just quick-edit their own C1-type fix, do these at the bottom of the file mentioned above:
- From:
super(FoscamCamera, self).init(camera_settings, daemon = False, verbose = True)
- ___To:
super(FoscamCamera, self).__init__(camera_settings, daemon = False, verbose = True)
.
- From:
_mjpegUrl = "http://{0}/cgi-bin/CGIStream.cgi?cmd={GetMJStream}&usr={1}&pwd={2}&".format(self.url, self.usr, self.pwd)
- ___To:
_mjpegUrl = "http://{0}/cgi-bin/CGIStream.cgi?cmd=GetMJStream&usr={1}&pwd={2}&".format(self.url, self.usr, self.pwd)
.
- From:
_snapshotUrl = "http://{0}/cgi-bin/CGIProxy.fcgi?cmd={snapPicture2}&usr={1}&pwd={2}&".format(self.url, self.usr, self.pwd)
- ___To:
_snapshotUrl = "http://{0}/cgi-bin/CGIProxy.fcgi?cmd=snapPicture2&usr={1}&pwd={2}&".format(self.url, self.usr, self.pwd)
.
- From:
_videoUrl = "rtsp://{0}:{1}@{2}/videoMain".format(self.usr, self.pwd, self.url)
- ___To:
_videoUrl = "rtsp://{0}:{1}@{2}:554/videoMain".format(self.usr, self.pwd, self.host)
Secondly... dynamic RTSP port...
If you forward your RTSP port through a firewall, or your IPCam uses a nonstandard port, you might want to dynamically adjust it. If you were going to code it yourself, that last line would look like:
_videoUrl = "rtsp://{0}:{1}@{2}:{3}/videoMain".format(self.usr, self.pwd, self.host, self.rtsp)
But you'll also need these other edits:
- requires a new getCameraSettings rtsp= assignment block-of-code in ipcam_api_wrapper
- and appending 'rtsp' to the return array
- and a new RTSP port entry in each cam# settings page
- and re-"targetting" the relative comparators (e.g.
enable=eq(-5,3)
etc) if that setting is listed above the 'alarm#' enum setting
Thirdly... try out my fork if you want...
This is the version that includes the dynamic RTSP and the "double-underscore" fix...
- directly download the zip to your kodi box, and install-from-zip: https://github.com/jasonbuechler/k/blob/...1.2.3d.zip
- OR... add an http filesource (and install-from-zip) using this url: https://rawgit.com/jasonbuechler/k/master/sr/
...and some before/after screenshots showing the difference...