From 3aef6b4ea0bf49895e04288202cfb9ed7e852eeb Mon Sep 17 00:00:00 2001 From: dekzter Date: Thu, 3 Apr 2025 16:12:55 -0400 Subject: [PATCH] logo with bulk too --- apps/channels/api_views.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/apps/channels/api_views.py b/apps/channels/api_views.py index 842056e4..c91928d8 100644 --- a/apps/channels/api_views.py +++ b/apps/channels/api_views.py @@ -337,10 +337,15 @@ class ChannelViewSet(viewsets.ModelViewSet): "name": name, "tvg_id": stream.tvg_id, "channel_group_id": channel_group.id, - "logo_url": stream.logo_url, "streams": [stream_id], } + if stream.logo_url: + logo, _ = Logo.objects.get_or_create(url=stream.logo_url, defaults={ + "name": stream.name or stream.tvg_id + }) + channel_data["logo_id"] = logo.id + # Attempt to find existing EPGs with the same tvg-id epgs = EPGData.objects.filter(tvg_id=stream.tvg_id) if epgs: