mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-03 01:35:22 +03:00
Use datetime.datetime and remove unused imports
This commit is contained in:
parent
27618d6f81
commit
ab575cd090
@ -1,29 +1,24 @@
|
|||||||
import base64
|
import base64
|
||||||
import copy
|
|
||||||
import datetime
|
import datetime
|
||||||
import hashlib
|
|
||||||
import itertools
|
|
||||||
import json
|
import json
|
||||||
import logging
|
import logging
|
||||||
import os
|
import os
|
||||||
import queue
|
import queue
|
||||||
import threading
|
import threading
|
||||||
import time
|
|
||||||
from collections import Counter, defaultdict
|
from collections import Counter, defaultdict
|
||||||
from statistics import mean, median
|
from statistics import median
|
||||||
from typing import Callable
|
from typing import Callable
|
||||||
|
|
||||||
import cv2
|
import cv2
|
||||||
import numpy as np
|
import numpy as np
|
||||||
|
|
||||||
from frigate.config import CameraConfig, SnapshotsConfig, RecordConfig, FrigateConfig
|
from frigate.config import CameraConfig, SnapshotsConfig, RecordConfig, FrigateConfig
|
||||||
from frigate.const import CACHE_DIR, CLIPS_DIR, RECORD_DIR
|
from frigate.const import CLIPS_DIR
|
||||||
from frigate.util import (
|
from frigate.util import (
|
||||||
SharedMemoryFrameManager,
|
SharedMemoryFrameManager,
|
||||||
calculate_region,
|
calculate_region,
|
||||||
draw_box_with_label,
|
draw_box_with_label,
|
||||||
draw_timestamp,
|
draw_timestamp,
|
||||||
load_labels,
|
|
||||||
)
|
)
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
@ -857,10 +852,10 @@ class TrackedObjectProcessor(threading.Thread):
|
|||||||
)
|
)
|
||||||
|
|
||||||
# always updated latest motion
|
# always updated latest motion
|
||||||
self.last_motion_updates[camera] = int(time.time())
|
self.last_motion_updates[camera] = datetime.datetime.now().timestamp
|
||||||
elif not motion_boxes and self.last_motion_updates.get(camera, 0) != 0:
|
elif not motion_boxes and self.last_motion_updates.get(camera, 0) != 0:
|
||||||
mqtt_delay = self.config.cameras[camera].motion.mqtt_off_delay
|
mqtt_delay = self.config.cameras[camera].motion.mqtt_off_delay
|
||||||
now = int(time.time())
|
now = datetime.datetime.now().timestamp
|
||||||
|
|
||||||
# If no motion, make sure the off_delay has passed
|
# If no motion, make sure the off_delay has passed
|
||||||
if now - self.last_motion_updates.get(camera, 0) >= mqtt_delay:
|
if now - self.last_motion_updates.get(camera, 0) >= mqtt_delay:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user