import os from django.shortcuts import render from django.utils import timezone from .models import RadioStream, Show def home(request): """Render the radio player landing page.""" now = timezone.now() current_weekday = now.weekday() current_time = now.time() active_stream = RadioStream.objects.filter(is_active=True).first() # Simple logic for current show: match weekday and time range current_show = Show.objects.filter( weekday=current_weekday, start_time__lte=current_time, end_time__gte=current_time ).first() context = { "project_name": "Lili Records Radio", "active_stream": active_stream, "current_show": current_show, "now": now, "project_description": os.getenv("PROJECT_DESCRIPTION", "Lili Records Radio - La mejor música en vivo."), } return render(request, "core/index.html", context)