mirror of
https://github.com/Dispatcharr/Dispatcharr.git
synced 2026-07-28 20:41:19 +00:00
cache url for logos in m3u and epg
This commit is contained in:
parent
c4f470e8f7
commit
3fc37f8f4f
1 changed files with 6 additions and 10 deletions
|
|
@ -26,7 +26,11 @@ def generate_m3u(request, profile_name=None):
|
|||
group_title = channel.channel_group.name if channel.channel_group else "Default"
|
||||
tvg_id = channel.channel_number or channel.id
|
||||
tvg_name = channel.name
|
||||
tvg_logo = channel.logo.url if channel.logo else ""
|
||||
|
||||
tvg_logo = ""
|
||||
if channel.logo:
|
||||
tvg_logo = request.build_absolute_uri(reverse('api:channels:logo-cache', args=[channel.logo.id]))
|
||||
|
||||
channel_number = channel.channel_number
|
||||
|
||||
extinf_line = (
|
||||
|
|
@ -96,15 +100,7 @@ def generate_epg(request, profile_name=None):
|
|||
|
||||
# Add channel logo if available
|
||||
if channel.logo:
|
||||
logo_url = channel.logo.url
|
||||
|
||||
# Convert to absolute URL if it's relative
|
||||
if logo_url.startswith('/data'):
|
||||
# Use the full URL for the logo
|
||||
logo_uri = re.sub(r"^\/data", '', logo_url)
|
||||
base_url = request.build_absolute_uri('/')[:-1]
|
||||
logo_url = f"{base_url}{logo_uri}"
|
||||
|
||||
logo_url = request.build_absolute_uri(reverse('api:channels:logo-cache', args=[channel.logo.id]))
|
||||
xml_lines.append(f' <icon src="{html.escape(logo_url)}" />')
|
||||
|
||||
xml_lines.append(' </channel>')
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue