mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-05 10:45:21 +03:00
Add support for archiving recordings to S3 storage if enabled
This commit is contained in:
parent
07cdec0718
commit
361e8604c8
@ -1323,7 +1323,7 @@ def recordings(camera_name):
|
|||||||
def recording_clip(camera_name, start_ts, end_ts):
|
def recording_clip(camera_name, start_ts, end_ts):
|
||||||
download = request.args.get("download", type=bool)
|
download = request.args.get("download", type=bool)
|
||||||
|
|
||||||
if current_app.frigate_config.storage.s3.enabled:
|
if current_app.frigate_config.storage.s3.enabled or current_app.frigate_config.storage.s3.archive:
|
||||||
s3 = StorageS3(current_app.frigate_config)
|
s3 = StorageS3(current_app.frigate_config)
|
||||||
|
|
||||||
recordings = (
|
recordings = (
|
||||||
|
|||||||
@ -26,7 +26,7 @@ bandwidth_equation = Recordings.segment_size / (
|
|||||||
class StorageS3:
|
class StorageS3:
|
||||||
def __init__(self, config: FrigateConfig) -> None:
|
def __init__(self, config: FrigateConfig) -> None:
|
||||||
self.config = config
|
self.config = config
|
||||||
if self.config.storage.s3.enabled:
|
if self.config.storage.s3.enabled or self.config.storage.s3.archive:
|
||||||
if self.config.storage.s3.endpoint_url.startswith('http://'):
|
if self.config.storage.s3.endpoint_url.startswith('http://'):
|
||||||
session = boto_session()
|
session = boto_session()
|
||||||
session.set_config_variable('s3',
|
session.set_config_variable('s3',
|
||||||
@ -65,7 +65,7 @@ class StorageS3:
|
|||||||
return s3_filename
|
return s3_filename
|
||||||
|
|
||||||
def download_file_from_s3(self, s3_file_name) -> str:
|
def download_file_from_s3(self, s3_file_name) -> str:
|
||||||
if self.config.storage.s3.enabled:
|
if self.config.storage.s3.enabled or self.config.storage.s3.archive:
|
||||||
# Create a temporary directory
|
# Create a temporary directory
|
||||||
temp_dir = tempfile.gettempdir()
|
temp_dir = tempfile.gettempdir()
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user