Пропуск повторной загрузки существующих архивов/скриншотов, иконка в 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
|
||||
|
||||
[](https://www.home-assistant.io/)
|
||||
|
||||
@@ -304,6 +304,10 @@ class RTKeyCamerasApi:
|
||||
filename = dt.strftime("%Y-%m-%d_%H-%M-%S.mp4")
|
||||
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
|
||||
|
||||
_LOGGER.info(f"Скачиваем архив для {intercom_id}: {duration} сек, файл: {filename}")
|
||||
@@ -360,6 +364,10 @@ class RTKeyCamerasApi:
|
||||
filename = dt.strftime("%Y-%m-%d_%H-%M-%S.jpg")
|
||||
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)
|
||||
|
||||
if screenshot_data:
|
||||
|
||||
Reference in New Issue
Block a user