Browse Source

Fixing URL Encoding for logo generation (#1818)

pull/1821/head
Sylvain 2 years ago committed by GitHub
parent
commit
01090f62e6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 8
      ErsatzTV.Application/Channels/ChannelViewModel.cs
  2. 4
      ErsatzTV.Core/Domain/Channel.cs
  3. 2
      ErsatzTV.Core/Iptv/ChannelPlaylist.cs
  4. 3
      ErsatzTV/Pages/Channels.razor

8
ErsatzTV.Application/Channels/ChannelViewModel.cs

@ -1,4 +1,5 @@ @@ -1,4 +1,5 @@
using ErsatzTV.Core.Domain;
using ErsatzTV.Core.Domain;
using System.Net;
namespace ErsatzTV.Application.Channels;
@ -20,4 +21,7 @@ public record ChannelViewModel( @@ -20,4 +21,7 @@ public record ChannelViewModel(
string PreferredSubtitleLanguageCode,
ChannelSubtitleMode SubtitleMode,
ChannelMusicVideoCreditsMode MusicVideoCreditsMode,
string MusicVideoCreditsTemplate);
string MusicVideoCreditsTemplate)
{
public string WebEncodedName => WebUtility.UrlEncode(Name);
}

4
ErsatzTV.Core/Domain/Channel.cs

@ -1,4 +1,5 @@ @@ -1,4 +1,5 @@
using ErsatzTV.Core.Domain.Filler;
using ErsatzTV.Core.Domain.Filler;
using System.Net;
namespace ErsatzTV.Core.Domain;
@ -29,4 +30,5 @@ public class Channel @@ -29,4 +30,5 @@ public class Channel
public ChannelMusicVideoCreditsMode MusicVideoCreditsMode { get; set; }
public string MusicVideoCreditsTemplate { get; set; }
public ChannelProgressMode ProgressMode { get; set; }
public string WebEncodedName => WebUtility.UrlEncode(Name);
}

2
ErsatzTV.Core/Iptv/ChannelPlaylist.cs

@ -65,7 +65,7 @@ public class ChannelPlaylist @@ -65,7 +65,7 @@ public class ChannelPlaylist
.HeadOrNone()
.Match(
artwork => $"{_scheme}://{_host}{_baseUrl}/iptv/logos/{artwork.Path}.jpg{accessTokenUri}",
() => $"{_scheme}://{_host}{_baseUrl}/iptv/logos/gen?text={WebUtility.UrlEncode(channel.Name)}{accessTokenUriAmp}");
() => $"{_scheme}://{_host}{_baseUrl}/iptv/logos/gen?text={channel.WebEncodedName}{accessTokenUriAmp}");
string shortUniqueId = Convert.ToBase64String(channel.UniqueId.ToByteArray())
.TrimEnd('=')

3
ErsatzTV/Pages/Channels.razor

@ -49,7 +49,7 @@ @@ -49,7 +49,7 @@
}
else
{
<MudElement HtmlTag="img" src="@($"iptv/logos/gen?text={context.Name}")" Style="max-height: 50px" />
<MudElement HtmlTag="img" src="@($"iptv/logos/gen?text={context.WebEncodedName}")" Style="max-height: 50px" />
}
</MudTd>
<MudTd DataLabel="Name">@context.Name</MudTd>
@ -252,5 +252,4 @@ @@ -252,5 +252,4 @@
StreamingMode.TransportStreamHybrid => "MPEG-TS",
_ => "MPEG-TS (Legacy)"
};
}
Loading…
Cancel
Save