Code refactoring. Added router and routes. Added static content.

This commit is contained in:
2025-05-04 14:15:37 -05:00
parent 939c6707e8
commit 9b8218b9f0
11 changed files with 380 additions and 202 deletions

22
run.py
View File

@@ -1,21 +1,19 @@
import logging
import os
import sys
# Add the src directory to Python path
sys.path.insert(0, os.path.join(os.path.dirname(__file__), "src"))
from fastapi import FastAPI
from src.stream_link_server import app as streamlink_server_app
logging.basicConfig(level=logging.INFO, format="%(asctime)s - %(name)s - %(levelname)s - %(message)s")
logger = logging.getLogger(__name__)
# Initialize the main FastAPI application
main_app = FastAPI()
# Manually add only non-static routes from streamlink_server_app
for route in streamlink_server_app.routes:
if route.path != "/": # Exclude the static file path
main_app.router.routes.append(route)
# Run the main app
if __name__ == "__main__":
import uvicorn
uvicorn.run(main_app, host="0.0.0.0", port=8080)
uvicorn.run(
"src.stream_link_server:app",
host="0.0.0.0",
port=8080,
reload=True,
workers=2
)