2021-11-01 16:42:52 -06:00
|
|
|
from http import HTTPStatus
|
|
|
|
|
|
2023-07-17 17:32:29 -06:00
|
|
|
from sanic import Blueprint
|
2021-11-01 16:42:52 -06:00
|
|
|
from sanic.request import Request
|
2022-01-13 09:29:58 -07:00
|
|
|
from sanic_ext.extensions.openapi import openapi
|
2021-11-01 16:42:52 -06:00
|
|
|
|
2024-04-17 11:25:26 -06:00
|
|
|
from wrolpi.api_utils import json_response
|
2021-11-01 16:42:52 -06:00
|
|
|
from wrolpi.common import logger
|
2022-02-16 21:57:27 -07:00
|
|
|
from . import lib, schema
|
2021-11-01 16:42:52 -06:00
|
|
|
from .channel.api import channel_bp
|
|
|
|
|
from .video.api import video_bp
|
|
|
|
|
|
2021-12-20 16:08:13 -07:00
|
|
|
content_bp = Blueprint('VideoContent', '/api/videos')
|
2024-04-17 11:25:26 -06:00
|
|
|
videos_bp = Blueprint('Videos', '/api/videos').group(
|
2021-11-01 16:42:52 -06:00
|
|
|
content_bp, # view and manage video content and settings
|
|
|
|
|
channel_bp, # view and manage channels
|
|
|
|
|
video_bp, # view videos
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
logger = logger.getChild(__name__)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@content_bp.get('/statistics')
|
2022-02-03 12:39:14 -07:00
|
|
|
@openapi.response(HTTPStatus.OK, schema.VideosStatisticsResponse)
|
2021-11-01 16:42:52 -06:00
|
|
|
async def statistics(_: Request):
|
2022-02-03 12:39:14 -07:00
|
|
|
ret = await lib.get_statistics()
|
2021-11-01 16:42:52 -06:00
|
|
|
return json_response(ret, HTTPStatus.OK)
|