diff --git a/blinkpy/blinkpy.py b/blinkpy/blinkpy.py index 0e4569f0..279c513c 100644 --- a/blinkpy/blinkpy.py +++ b/blinkpy/blinkpy.py @@ -21,6 +21,7 @@ from requests.structures import CaseInsensitiveDict from dateutil.parser import parse +from slugify import slugify from blinkpy import api from blinkpy.sync_module import BlinkSyncModule @@ -310,7 +311,8 @@ def _parse_downloaded_items(self, result, camera, path, debug): continue clip_address = "{}{}".format(self.urls.base_url, address) - filename = "{}_{}.mp4".format(camera_name, created_at) + filename = "{}-{}".format(camera_name, created_at) + filename = "{}.mp4".format(slugify(filename)) filename = os.path.join(path, filename) if not debug: @@ -325,5 +327,6 @@ def _parse_downloaded_items(self, result, camera, path, debug): _LOGGER.info("Downloaded video to %s", filename) else: - print("Camera: {}, Timestamp: {}, Address: {}".format( - camera_name, created_at, address)) + print(("Camera: {}, Timestamp: {}, " + "Address: {}, Filename: {}").format( + camera_name, created_at, address, filename)) diff --git a/requirements.txt b/requirements.txt index 2b7eda54..6d7405d8 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,4 @@ python-dateutil==2.7.5 requests>=2.20.0 +python-slugify==3.0.2 testtools==2.3.0