mirror of
https://github.com/MichaByte/OnBoard-Live.git
synced 2025-12-06 17:13:40 -05:00
use mediamtx api instead of fs to get recordings
This commit is contained in:
parent
aa385fd648
commit
3d08445e0f
1 changed files with 2 additions and 10 deletions
|
|
@ -7,7 +7,6 @@ from random import choice
|
||||||
from secrets import token_hex
|
from secrets import token_hex
|
||||||
from typing import Dict, List
|
from typing import Dict, List
|
||||||
|
|
||||||
from aiofiles.os import listdir as async_listdir
|
|
||||||
import httpx
|
import httpx
|
||||||
import uvicorn
|
import uvicorn
|
||||||
from apscheduler.schedulers.asyncio import AsyncIOScheduler
|
from apscheduler.schedulers.asyncio import AsyncIOScheduler
|
||||||
|
|
@ -54,15 +53,8 @@ def verify_gh_signature(payload_body, secret_token, signature_header):
|
||||||
|
|
||||||
|
|
||||||
async def get_recording_list(stream_key: str) -> List[str]:
|
async def get_recording_list(stream_key: str) -> List[str]:
|
||||||
try:
|
async with httpx.AsyncClient() as client:
|
||||||
files = await async_listdir(f"/home/onboard/recordings/{stream_key}")
|
return [recording["start"] for recording in (await client.get(f"http://localhost:9997/v3/recordings/get/{stream_key}")).json()["segments"]]
|
||||||
except FileNotFoundError:
|
|
||||||
return []
|
|
||||||
for file in files:
|
|
||||||
split_file = file.split("/")
|
|
||||||
filename_without_ext = split_file[len(split_file) - 1].split(".")[0]
|
|
||||||
files[files.index(file)] = filename_without_ext
|
|
||||||
return files
|
|
||||||
|
|
||||||
|
|
||||||
async def update_active():
|
async def update_active():
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue