diff --git a/configure.ac b/configure.ac index f2f98aa..5ec74b5 100644 --- a/configure.ac +++ b/configure.ac @@ -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]) diff --git a/setup.py b/setup.py index 3b2c954..e49b4c8 100644 --- a/setup.py +++ b/setup.py @@ -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', diff --git a/src/amcrest/network.py b/src/amcrest/network.py index 876e1e9..373ac7f 100644 --- a/src/amcrest/network.py +++ b/src/amcrest/network.py @@ -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') diff --git a/src/amcrest/special.py b/src/amcrest/special.py index 4299835..c52e475 100644 --- a/src/amcrest/special.py +++ b/src/amcrest/special.py @@ -12,6 +12,8 @@ # vim:sw=4:ts=4:et import shutil +from . import AmcrestError + class Special(object): @@ -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 """