ONVIF: Add check around media capabilities (#35667)

pull/35828/head
Jason Hunter 2020-05-15 14:05:32 -04:00 committed by Franck Nijhof
parent dbd30d571d
commit 316d44cf33
No known key found for this signature in database
GPG Key ID: D62583BA8AB11CA3
1 changed files with 8 additions and 3 deletions

View File

@ -207,8 +207,13 @@ class ONVIFDevice:
async def async_get_capabilities(self):
"""Obtain information about the available services on the device."""
media_service = self.device.create_media_service()
media_capabilities = await media_service.GetServiceCapabilities()
snapshot = False
try:
media_service = self.device.create_media_service()
media_capabilities = await media_service.GetServiceCapabilities()
snapshot = media_capabilities.SnapshotUri
except (ONVIFError, Fault):
pass
pullpoint = False
try:
@ -225,7 +230,7 @@ class ONVIFDevice:
except ONVIFError:
pass
return Capabilities(media_capabilities.SnapshotUri, pullpoint, ptz)
return Capabilities(snapshot, pullpoint, ptz)
async def async_get_profiles(self) -> List[Profile]:
"""Obtain media profiles for this device."""