mirror of
https://github.com/Dispatcharr/Dispatcharr.git
synced 2026-07-18 00:55:50 +00:00
Add end-to-end catch-up support for XC clients and native apps: provider proxy with failover and per-viewer session pooling, REST session minting for tokenless playback URLs, catch-up admin stats, combined connection stats, and Stats UI with dedicated cards plus websocket updates. Includes Redis namespace consolidation under timeshift:* (dropping legacy timeshift_ id prefixes), dedicated catch-up stop by session_id, and cleaner channel/client metadata split for stats keys. Closes #133
31 lines
1 KiB
Python
31 lines
1 KiB
Python
"""Combined connection stats for live, VOD, and catch-up."""
|
|
|
|
import logging
|
|
import time
|
|
|
|
from django.http import JsonResponse
|
|
from rest_framework.decorators import api_view, permission_classes
|
|
|
|
from apps.accounts.permissions import IsAdmin
|
|
from apps.proxy.live_proxy.channel_status import build_live_channel_stats_data
|
|
from apps.proxy.vod_proxy.views import build_vod_stats_data
|
|
from apps.timeshift.stats import build_timeshift_stats_data
|
|
from core.utils import RedisClient
|
|
|
|
logger = logging.getLogger(__name__)
|
|
|
|
|
|
@api_view(["GET"])
|
|
@permission_classes([IsAdmin])
|
|
def combined_stats(request):
|
|
"""Return live, VOD, and catch-up stats in one response."""
|
|
redis_client = RedisClient.get_client()
|
|
if not redis_client:
|
|
return JsonResponse({"error": "Redis not available"}, status=500)
|
|
|
|
return JsonResponse({
|
|
"live": build_live_channel_stats_data(redis_client),
|
|
"vod": build_vod_stats_data(redis_client),
|
|
"catchup": build_timeshift_stats_data(redis_client),
|
|
"timestamp": time.time(),
|
|
})
|