mirror of
https://github.com/blakeblackshear/frigate.git
synced 2026-02-02 17:25:22 +03:00
Don't use preprocessor
This commit is contained in:
parent
0bcfbc941b
commit
466f8b69bc
@ -18,7 +18,6 @@ from flask import (
|
|||||||
Flask,
|
Flask,
|
||||||
Response,
|
Response,
|
||||||
current_app,
|
current_app,
|
||||||
g,
|
|
||||||
jsonify,
|
jsonify,
|
||||||
make_response,
|
make_response,
|
||||||
request,
|
request,
|
||||||
@ -37,11 +36,6 @@ logger = logging.getLogger(__name__)
|
|||||||
bp = Blueprint("frigate", __name__)
|
bp = Blueprint("frigate", __name__)
|
||||||
|
|
||||||
|
|
||||||
@bp.url_value_preprocessor
|
|
||||||
def unquote_label(endpoint, values):
|
|
||||||
g.label = unquote(values.pop("label", ""))
|
|
||||||
|
|
||||||
|
|
||||||
def create_app(
|
def create_app(
|
||||||
frigate_config,
|
frigate_config,
|
||||||
database: SqliteDatabase,
|
database: SqliteDatabase,
|
||||||
@ -347,8 +341,9 @@ def event_thumbnail(id, max_cache_age=2592000):
|
|||||||
|
|
||||||
@bp.route("/<camera_name>/<label>/best.jpg")
|
@bp.route("/<camera_name>/<label>/best.jpg")
|
||||||
@bp.route("/<camera_name>/<label>/thumbnail.jpg")
|
@bp.route("/<camera_name>/<label>/thumbnail.jpg")
|
||||||
def label_thumbnail(camera_name):
|
def label_thumbnail(camera_name, label):
|
||||||
if g.label == "any":
|
label = unquote(label)
|
||||||
|
if label == "any":
|
||||||
event_query = (
|
event_query = (
|
||||||
Event.select()
|
Event.select()
|
||||||
.where(Event.camera == camera_name)
|
.where(Event.camera == camera_name)
|
||||||
@ -359,7 +354,7 @@ def label_thumbnail(camera_name):
|
|||||||
event_query = (
|
event_query = (
|
||||||
Event.select()
|
Event.select()
|
||||||
.where(Event.camera == camera_name)
|
.where(Event.camera == camera_name)
|
||||||
.where(Event.label == g.label)
|
.where(Event.label == label)
|
||||||
.where(Event.has_snapshot == True)
|
.where(Event.has_snapshot == True)
|
||||||
.order_by(Event.start_time.desc())
|
.order_by(Event.start_time.desc())
|
||||||
)
|
)
|
||||||
@ -430,8 +425,9 @@ def event_snapshot(id):
|
|||||||
|
|
||||||
|
|
||||||
@bp.route("/<camera_name>/<label>/snapshot.jpg")
|
@bp.route("/<camera_name>/<label>/snapshot.jpg")
|
||||||
def label_snapshot(camera_name):
|
def label_snapshot(camera_name, label):
|
||||||
if g.label == "any":
|
label = unquote(label)
|
||||||
|
if label == "any":
|
||||||
event_query = (
|
event_query = (
|
||||||
Event.select()
|
Event.select()
|
||||||
.where(Event.camera == camera_name)
|
.where(Event.camera == camera_name)
|
||||||
@ -442,7 +438,7 @@ def label_snapshot(camera_name):
|
|||||||
event_query = (
|
event_query = (
|
||||||
Event.select()
|
Event.select()
|
||||||
.where(Event.camera == camera_name)
|
.where(Event.camera == camera_name)
|
||||||
.where(Event.label == g.label)
|
.where(Event.label == label)
|
||||||
.where(Event.has_snapshot == True)
|
.where(Event.has_snapshot == True)
|
||||||
.order_by(Event.start_time.desc())
|
.order_by(Event.start_time.desc())
|
||||||
)
|
)
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user