mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-03 17:55:21 +03:00
cleanup
This commit is contained in:
parent
fc172d67ab
commit
6a660b980c
@ -1164,16 +1164,11 @@ def vod_hour_no_timezone(year_month, day, hour, camera_name):
|
|||||||
# TODO make this nicer when vod module is removed
|
# TODO make this nicer when vod module is removed
|
||||||
@bp.route("/vod/<year_month>/<day>/<hour>/<camera_name>/<tz_name>")
|
@bp.route("/vod/<year_month>/<day>/<hour>/<camera_name>/<tz_name>")
|
||||||
def vod_hour(year_month, day, hour, camera_name, tz_name):
|
def vod_hour(year_month, day, hour, camera_name, tz_name):
|
||||||
tz_offset_minutes = int(
|
|
||||||
datetime.now(pytz.timezone(tz_name.replace(",", "/")))
|
|
||||||
.utcoffset()
|
|
||||||
.total_seconds()
|
|
||||||
/ 60
|
|
||||||
)
|
|
||||||
parts = year_month.split("-")
|
parts = year_month.split("-")
|
||||||
start_date = datetime(
|
start_date = (
|
||||||
int(parts[0]), int(parts[1]), int(day), int(hour), tzinfo=timezone.utc
|
datetime(int(parts[0]), int(parts[1]), int(day), int(hour), tzinfo=timezone.utc)
|
||||||
) - timedelta(minutes=tz_offset_minutes)
|
- datetime.now(pytz.timezone(tz_name.replace(",", "/"))).utcoffset()
|
||||||
|
)
|
||||||
end_date = start_date + timedelta(hours=1) - timedelta(milliseconds=1)
|
end_date = start_date + timedelta(hours=1) - timedelta(milliseconds=1)
|
||||||
start_ts = start_date.timestamp()
|
start_ts = start_date.timestamp()
|
||||||
end_ts = end_date.timestamp()
|
end_ts = end_date.timestamp()
|
||||||
|
|||||||
@ -1044,7 +1044,9 @@ class SharedMemoryFrameManager(FrameManager):
|
|||||||
|
|
||||||
|
|
||||||
def get_tz_modifiers(tz_name: str) -> Tuple[str, str]:
|
def get_tz_modifiers(tz_name: str) -> Tuple[str, str]:
|
||||||
seconds_offset = datetime.now(pytz.timezone(tz_name)).utcoffset().total_seconds()
|
seconds_offset = (
|
||||||
|
datetime.datetime.now(pytz.timezone(tz_name)).utcoffset().total_seconds()
|
||||||
|
)
|
||||||
hours_offset = int(seconds_offset / 60 / 60)
|
hours_offset = int(seconds_offset / 60 / 60)
|
||||||
minutes_offset = int(seconds_offset / 60 - hours_offset * 60)
|
minutes_offset = int(seconds_offset / 60 - hours_offset * 60)
|
||||||
hour_modifier = f"{hours_offset} hour"
|
hour_modifier = f"{hours_offset} hour"
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user