FEATURE: all versions use single source of truth for codec/container/file_extension info
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
# web/backend/api/formats.py
|
||||
"""Endpoint to expose format information to the frontend."""
|
||||
|
||||
from fastapi import APIRouter
|
||||
|
||||
from backend.constants import FORMAT_INFO
|
||||
from audio_splitter.constants import CONTAINER_INFO, CODEC_INFO
|
||||
|
||||
router = APIRouter(prefix="/api", tags=["formats"])
|
||||
|
||||
@@ -10,16 +11,9 @@ router = APIRouter(prefix="/api", tags=["formats"])
|
||||
@router.get("/formats")
|
||||
async def get_formats():
|
||||
"""
|
||||
Return the list of supported container formats with their properties.
|
||||
Return the list of supported containers and codecs.
|
||||
"""
|
||||
return {
|
||||
"formats": [
|
||||
{
|
||||
"name": name,
|
||||
"ffmpeg": info["ffmpeg"],
|
||||
"extension": info["ext"],
|
||||
"audio_only": info["audio_only"],
|
||||
}
|
||||
for name, info in FORMAT_INFO.items()
|
||||
]
|
||||
"containers": CONTAINER_INFO,
|
||||
"codecs": CODEC_INFO,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user