diff --git a/README.md b/README.md index 1b2141a..bc2b78c 100644 --- a/README.md +++ b/README.md @@ -205,6 +205,7 @@ can use the following substitutions: - `SN`; the device serial number - `N`; the device name +- `NN`; the device name, lower case with _ replacing spaces - `Y`; the year of the recording, include century - `m`; the month of the year as a number (range 01 to 12) - `d`; the day of the month as a number (range 01 to 31) diff --git a/changelog b/changelog index d313bbb..22a9cbd 100644 --- a/changelog +++ b/changelog @@ -1,5 +1,6 @@ 0.8.0.8 Better login error handling and reporting. + Added slugified naming option 0.8.0.7 Add Essential Indoor Gen 2 support. 0.8.0.6 diff --git a/pyaarlo/media.py b/pyaarlo/media.py index a681f95..e4918f8 100644 --- a/pyaarlo/media.py +++ b/pyaarlo/media.py @@ -2,6 +2,7 @@ import threading from datetime import datetime, timedelta from string import Template +from slugify import slugify from .constant import ( LIBRARY_PATH, @@ -47,6 +48,7 @@ def _output_name(self, media): Template(self._save_format).substitute( SN=media.camera.device_id, N=media.camera.name, + NN=slugify(media.camera.name, separator='_'), Y=Y, m=m, d=d, diff --git a/requirements.txt b/requirements.txt index 910992f..d4a6ffa 100644 --- a/requirements.txt +++ b/requirements.txt @@ -5,3 +5,4 @@ unidecode cloudscraper>=1.2.71 paho-mqtt cryptography +slugify