mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-05 10:45:21 +03:00
treewide: make regex patterns raw strings
This is necessary for escape sequences to be properly recognized.
This commit is contained in:
parent
bc4071dde8
commit
b50868bf30
@ -13,9 +13,9 @@ BTBN_PATH = "/usr/lib/btbn-ffmpeg"
|
|||||||
|
|
||||||
# Regex Consts
|
# Regex Consts
|
||||||
|
|
||||||
REGEX_CAMERA_NAME = "^[a-zA-Z0-9_-]+$"
|
REGEX_CAMERA_NAME = r"^[a-zA-Z0-9_-]+$"
|
||||||
REGEX_RTSP_CAMERA_USER_PASS = ":\/\/[a-zA-Z0-9_-]+:[\S]+@"
|
REGEX_RTSP_CAMERA_USER_PASS = r":\/\/[a-zA-Z0-9_-]+:[\S]+@"
|
||||||
REGEX_HTTP_CAMERA_USER_PASS = "user=[a-zA-Z0-9_-]+&password=[\S]+"
|
REGEX_HTTP_CAMERA_USER_PASS = r"user=[a-zA-Z0-9_-]+&password=[\S]+"
|
||||||
|
|
||||||
# Known Driver Names
|
# Known Driver Names
|
||||||
|
|
||||||
|
|||||||
@ -863,7 +863,7 @@ def get_bandwidth_stats() -> dict[str, dict]:
|
|||||||
stats = list(filter(lambda a: a != "", line.strip().split("\t")))
|
stats = list(filter(lambda a: a != "", line.strip().split("\t")))
|
||||||
try:
|
try:
|
||||||
if re.search(
|
if re.search(
|
||||||
"(^ffmpeg|\/go2rtc|frigate\.detector\.[a-z]+)/([0-9]+)/", stats[0]
|
r"(^ffmpeg|\/go2rtc|frigate\.detector\.[a-z]+)/([0-9]+)/", stats[0]
|
||||||
):
|
):
|
||||||
process = stats[0].split("/")
|
process = stats[0].split("/")
|
||||||
usages[process[len(process) - 2]] = {
|
usages[process[len(process) - 2]] = {
|
||||||
@ -930,7 +930,7 @@ def get_intel_gpu_stats() -> dict[str, str]:
|
|||||||
|
|
||||||
# render is used for qsv
|
# render is used for qsv
|
||||||
render = []
|
render = []
|
||||||
for result in re.findall('"Render/3D/0":{[a-z":\d.,%]+}', reading):
|
for result in re.findall(r'"Render/3D/0":{[a-z":\d.,%]+}', reading):
|
||||||
packet = json.loads(result[14:])
|
packet = json.loads(result[14:])
|
||||||
single = packet.get("busy", 0.0)
|
single = packet.get("busy", 0.0)
|
||||||
render.append(float(single))
|
render.append(float(single))
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user