Пропуск повторной загрузки существующих архивов/скриншотов, иконка в README
— archive/screenshot: проверка exists+st_size>0 перед скачиванием — README: добавлена иконка интеграции в заголовок
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
<img src="custom_components/rtkey/icon.png" width="128"> </img>
|
||||||
# RT Key Integration for Home Assistant
|
# RT Key Integration for Home Assistant
|
||||||
|
|
||||||
[](https://www.home-assistant.io/)
|
[](https://www.home-assistant.io/)
|
||||||
|
|||||||
@@ -304,6 +304,10 @@ class RTKeyCamerasApi:
|
|||||||
filename = dt.strftime("%Y-%m-%d_%H-%M-%S.mp4")
|
filename = dt.strftime("%Y-%m-%d_%H-%M-%S.mp4")
|
||||||
filepath = archive_dir / filename
|
filepath = archive_dir / filename
|
||||||
|
|
||||||
|
if await self.hass.async_add_executor_job(lambda p: p.exists() and p.stat().st_size > 0, filepath):
|
||||||
|
_LOGGER.info(f"Архив уже существует: {filepath}")
|
||||||
|
return str(filepath)
|
||||||
|
|
||||||
duration = self.archive_duration
|
duration = self.archive_duration
|
||||||
|
|
||||||
_LOGGER.info(f"Скачиваем архив для {intercom_id}: {duration} сек, файл: {filename}")
|
_LOGGER.info(f"Скачиваем архив для {intercom_id}: {duration} сек, файл: {filename}")
|
||||||
@@ -360,6 +364,10 @@ class RTKeyCamerasApi:
|
|||||||
filename = dt.strftime("%Y-%m-%d_%H-%M-%S.jpg")
|
filename = dt.strftime("%Y-%m-%d_%H-%M-%S.jpg")
|
||||||
filepath = screenshot_dir / filename
|
filepath = screenshot_dir / filename
|
||||||
|
|
||||||
|
if await self.hass.async_add_executor_job(lambda p: p.exists() and p.stat().st_size > 0, filepath):
|
||||||
|
_LOGGER.info(f"Скриншот уже существует: {filepath}")
|
||||||
|
return str(filepath)
|
||||||
|
|
||||||
screenshot_data = await self.get_event_screenshot(camera_id, event_timestamp)
|
screenshot_data = await self.get_event_screenshot(camera_id, event_timestamp)
|
||||||
|
|
||||||
if screenshot_data:
|
if screenshot_data:
|
||||||
|
|||||||
Reference in New Issue
Block a user