Posts: 6
Joined: Jan 2015
Reputation:
0
2015-02-01, 04:21
(This post was last modified: 2015-02-01, 04:25 by dna3e8.)
I am not getting preview / alarm is not triggering.When I click the script it opens full screen and shows the camera.
Under alarm it is set to Motion and sound
sensitivity high, trigger 1 sec
I just enabled logging but don't see where it is saving them
I am on Kodi (14.0) plugin versoin .21
Hummmm when I rt click and do info on the addon (in programs) Status says disabled...
IF I click disable enable I get a short 'script error" pop up
Posts: 45
Joined: Jan 2014
Reputation:
1
Same 'Username required\n' debug error on motion alert with a FI9831P - exception thrown with error including debug entry below:
System version 1.4.1.10 / Application firmware 2.11.1.118
Running Openelec Kodi 14.1 on ARM7
20:14:12 T:1815651392 ERROR: EXCEPTION Thrown (PythonToCppException) : -->Python callback/script returned the following error<--
- NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
Error Type: <type 'exceptions.ValueError'>
Error Contents: invalid literal for int() with base 10: 'Username required\n'
Traceback (most recent call last):
File "/storage/.kodi/addons/script.foscam/service.py", line 167, in <module>
Main()
File "/storage/.kodi/addons/script.foscam/service.py", line 33, in __init__
self.alarm_check()
File "/storage/.kodi/addons/script.foscam/service.py", line 162, in alarm_check
self.duration_shown = preview.start()
File "/storage/.kodi/addons/script.foscam/resources/lib/gui.py", line 103, in start
duration = self.extract_mjpeg.start()
File "/storage/.kodi/addons/script.foscam/resources/lib/utils.py", line 171, in start
frame = get_mjpeg_frame(self.stream)
File "/storage/.kodi/addons/script.foscam/resources/lib/utils.py", line 142, in get_mjpeg_frame
bytes = int(content_length.split(':')[-1])
ValueError: invalid literal for int() with base 10: 'Username required\n'
-->End of Python script error report<--
My settings.xml
<settings>
<setting id="check_interval" value="5" />
<setting id="debug" value="0" />
<setting id="host" value="192.168.1.18" />
<setting id="mjpeg" value="false" />
<setting id="motion_enable" value="true" />
<setting id="motion_sensitivity" value="0" />
<setting id="motion_trigger_interval" value="5" />
<setting id="password" value="REMOVED MY ACTUAL PASSWORD" />
<setting id="port" value="88" />
<setting id="preview_duration" value="10" />
<setting id="preview_position" value="Bottom right" />
<setting id="preview_scaling" value="1.000000" />
<setting id="sound_enable" value="false" />
<setting id="sound_sensitivity" value="1" />
<setting id="sound_trigger_interval" value="15" />
<setting id="username" value="admin" />
</settings>
Cheers!
Posts: 45
Joined: Jan 2014
Reputation:
1
2015-02-13, 00:44
(This post was last modified: 2015-02-13, 00:48 by quixers.)
Two changes fixed the motion detection pop up for my FI9831P camera.
1) Change in addons/script.foscam/resources/lib/utils.py
Alter the get_mjpeg_frame function to look like this. Seems sometimes the headers aren't consistent, or the previous frame doesnt end in a carriage return meaning you need a different number of readlines frame to frame. My change will keep reading the stream till it finds the content length header its looking for.
def get_mjpeg_frame(stream):
try:
content_length = stream.readline()
while not "Content-Length" in content_length:
content_length = stream.readline()
bytes = int(content_length.split(':')[-1])
stream.readline()
return stream.read(bytes)
except requests.RequestException as e:
utils.log_error(str(e))
return None
2) Change alter addons/script.foscam/resources/lib/foscam.py
Alter self._stream_url_fmt line to look like this. The url had to be changed as my camera is very particular about the ordering of the get parameters, username had to come first thus the 'Username required' error. Also the username/pass is passed as get parameters as below not as basic http creds.
self._stream_url_fmt = "http://{0}:{1}/cgi-bin/CGIStream.cgi?usr={2}&pwd={3}&cmd={{cmd}}".format(host,
port,
user,
password)
Posts: 45
Joined: Jan 2014
Reputation:
1
Yea will try and attach them later today and add a branch/pull request to GitHub
Posts: 45
Joined: Jan 2014
Reputation:
1
2015-02-15, 16:36
(This post was last modified: 2015-02-15, 16:36 by quixers.)
Its flickers a bit but think thats normal?