Skip to content

Commit 7edea7c

Browse files
authored
Merge pull request #73 from tchellomello/dev
version 1.1.9
2 parents 60fe5f9 + 183ce97 commit 7edea7c

File tree

6 files changed

+27
-6
lines changed

6 files changed

+27
-6
lines changed

Diff for: configure.ac

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
# GNU General Public License for more details.
1111
define([VERSION_MAJOR], [1])
1212
define([VERSION_MINOR], [1])
13-
define([VERSION_FIX], [8])
13+
define([VERSION_FIX], [9])
1414
define([VERSION_NUMBER], VERSION_MAJOR[.]VERSION_MINOR[.]VERSION_FIX)
1515
define([VERSION_SUFFIX], [_master])
1616

Diff for: python-amcrest.spec.in

+5-1
Original file line numberDiff line numberDiff line change
@@ -165,8 +165,12 @@ make check-local
165165
%{_sysconfdir}/profile.d/amcrest-cli-autocomplete.sh
166166

167167
%changelog
168+
* Sun Apr 16 2017 Marcelo Moreira de Mello <[email protected]> 1.1-9
169+
- Added support to new Amcrest firmware V2.400.AC01.15.R.20170328 <[email protected]>
170+
- Added support to new Amcrest firmware V2.420.AC00.17.R.20170322 <[email protected]>
171+
168172
* Sat Apr 08 2017 Marcelo Moreira de Mello <[email protected]> 1.1-8
169-
* Added storage_used_percent function
173+
- Added storage_used_percent function
170174

171175
* Tue Mar 28 2017 Marcelo Moreira de Mello <[email protected]> 1.1-5
172176
- Introduced unittests

Diff for: src/amcrest/event.py

+1-2
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,7 @@ def is_motion_detected(self):
142142
event = self.event_channels_happened('VideoMotion')
143143
if 'channels' not in event:
144144
return False
145-
else:
146-
return True
145+
return True
147146

148147
@property
149148
def event_management(self):

Diff for: src/amcrest/http.py

+11-1
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,17 @@ def __init__(self, host, port, user,
6262
else:
6363
self._retries_conn = retries_connection
6464

65-
self._set_name()
65+
try:
66+
self._set_name()
67+
except requests.exceptions.HTTPError as error:
68+
# newer firmware requires digest auth
69+
# let's try that if we are still unauthorized
70+
if error.response.status_code == 401:
71+
self._token = requests.auth.HTTPDigestAuth(self._user,
72+
self._password)
73+
self._set_name()
74+
else:
75+
raise
6676

6777
def _set_name(self):
6878
"""Set device name."""

Diff for: src/amcrest/storage.py

+4
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ def storage_device_names(self):
3232
@property
3333
def storage_used(self, dev='/dev/mmc0', unit='GB'):
3434
ret = self.storage_device_info
35+
36+
# pylint: disable=fixme
3537
# TODO
3638
# Use regex to enhance the filter
3739
status = [s for s in ret.split() if '.UsedBytes=' in s][0]
@@ -40,6 +42,8 @@ def storage_used(self, dev='/dev/mmc0', unit='GB'):
4042
@property
4143
def storage_total(self, dev='/dev/mmc0', unit='GB'):
4244
ret = self.storage_device_info
45+
46+
# pylint: disable=fixme
4347
# TODO
4448
# Use regex to enhance the filter
4549
status = [s for s in ret.split() if '.TotalBytes=' in s][0]

Diff for: src/amcrest/system.py

+5-1
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,11 @@ def software_information(self):
6666
ret = self.command(
6767
'magicBox.cgi?action=getSoftwareVersion'
6868
)
69-
version, build_date = ret.content.decode('utf-8').split()
69+
swinfo = ret.content.decode('utf-8')
70+
if ',' in swinfo:
71+
version, build_date = swinfo.split(',')
72+
else:
73+
version, build_date = swinfo.split()
7074
return (version, build_date)
7175

7276
@property

0 commit comments

Comments
 (0)