From 0a4c7cae25f4de4c3f060b24c408f240d55bc87f Mon Sep 17 00:00:00 2001 From: SergeantPanda Date: Sat, 18 Oct 2025 12:38:43 -0500 Subject: [PATCH] Bug fix: Fix bug where channel logo would revert back to provider logo after a refresh (for auto channel sync channels) --- apps/m3u/tasks.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/apps/m3u/tasks.py b/apps/m3u/tasks.py index 6b1dbdcc..344bc1a3 100644 --- a/apps/m3u/tasks.py +++ b/apps/m3u/tasks.py @@ -1828,7 +1828,25 @@ def sync_auto_channels(account_id, scan_start_time=None): # Handle logo updates current_logo = None - if stream.logo_url: + if custom_logo_id: + # Use the custom logo specified in group settings + from apps.channels.models import Logo + try: + current_logo = Logo.objects.get(id=custom_logo_id) + except Logo.DoesNotExist: + logger.warning( + f"Custom logo with ID {custom_logo_id} not found for existing channel, falling back to stream logo" + ) + # Fall back to stream logo if custom logo not found + if stream.logo_url: + current_logo, _ = Logo.objects.get_or_create( + url=stream.logo_url, + defaults={ + "name": stream.name or stream.tvg_id or "Unknown" + }, + ) + elif stream.logo_url: + # No custom logo configured, use stream logo from apps.channels.models import Logo current_logo, _ = Logo.objects.get_or_create(