Skip to content

Commit

Permalink
Merge pull request #112 from tchellomello/1.2.7
Browse files Browse the repository at this point in the history
1.2.7
  • Loading branch information
tchellomello authored Mar 15, 2019
2 parents fbf9811 + 13e153f commit 39d859c
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 4 deletions.
2 changes: 1 addition & 1 deletion configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
# GNU General Public License for more details.
define([VERSION_MAJOR], [1])
define([VERSION_MINOR], [2])
define([VERSION_FIX], [6])
define([VERSION_FIX], [7])
define([VERSION_NUMBER], VERSION_MAJOR[.]VERSION_MINOR[.]VERSION_FIX)
define([VERSION_SUFFIX], [_master])

Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def readme():


setup(name='amcrest',
version='1.2.6',
version='1.2.7',
description='Python wrapper implementation for Amcrest cameras.',
long_description=readme(),
author='Douglas Schilling Landgraf, Marcelo Moreira de Mello',
Expand Down
8 changes: 8 additions & 0 deletions src/amcrest/network.py
Original file line number Diff line number Diff line change
Expand Up @@ -233,3 +233,11 @@ def ntp_config(self, ntp_opt):
'configManager.cgi?action=setConfig&{0}'.format(ntp_opt)
)
return ret.content.decode('utf-8')

@property
def rtsp_config(self):
"""Get RTSP configuration."""
ret = self.command(
'configManager.cgi?action=getConfig&name=RTSP'
)
return ret.content.decode('utf-8')
11 changes: 9 additions & 2 deletions src/amcrest/special.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@
# vim:sw=4:ts=4:et
import shutil

from . import AmcrestError


class Special(object):

Expand Down Expand Up @@ -58,8 +60,13 @@ def rtsp_url(self, channelno=None, typeno=None):
cmd = 'cam/realmonitor?channel={0}&subtype={1}'.format(
channelno, typeno)

return 'rtsp://{0}:{1}@{2}/{3}'.format(
self._user, self._password, self._host, cmd)
try:
port = ':' + [x.split('=')[1] for x in self.rtsp_config.split()
if x.startswith('table.RTSP.Port=')][0]
except (AmcrestError, IndexError):
port = ''
return 'rtsp://{}:{}@{}{}/{}'.format(
self._user, self._password, self._host, port, cmd)

# pylint: disable=pointless-string-statement
"""
Expand Down

0 comments on commit 39d859c

Please sign in to comment.