diff --git a/ErsatzTV.Application/MediaCards/Mapper.cs b/ErsatzTV.Application/MediaCards/Mapper.cs index 082d038ba..1d766843c 100644 --- a/ErsatzTV.Application/MediaCards/Mapper.cs +++ b/ErsatzTV.Application/MediaCards/Mapper.cs @@ -123,12 +123,12 @@ namespace ErsatzTV.Application.MediaCards if (maybeJellyfin.IsSome && artwork.StartsWith("jellyfin://")) { - artwork = JellyfinUrl.ForArtwork(maybeJellyfin, artwork) + artwork = JellyfinUrl.RelativeProxyForArtwork(artwork) .SetQueryParam("fillHeight", 440); } else if (maybeEmby.IsSome && artwork.StartsWith("emby://")) { - artwork = EmbyUrl.ForArtwork(maybeEmby, artwork) + artwork = EmbyUrl.RelativeProxyForArtwork(artwork) .SetQueryParam("maxHeight", 440); } @@ -171,12 +171,12 @@ namespace ErsatzTV.Application.MediaCards if (maybeJellyfin.IsSome && poster.StartsWith("jellyfin://")) { - poster = JellyfinUrl.ForArtwork(maybeJellyfin, poster) + poster = JellyfinUrl.RelativeProxyForArtwork(poster) .SetQueryParam("fillHeight", 440); } else if (maybeEmby.IsSome && poster.StartsWith("emby://")) { - poster = EmbyUrl.ForArtwork(maybeEmby, poster) + poster = EmbyUrl.RelativeProxyForArtwork(poster) .SetQueryParam("maxHeight", 440); } @@ -193,12 +193,12 @@ namespace ErsatzTV.Application.MediaCards if (maybeJellyfin.IsSome && thumb.StartsWith("jellyfin://")) { - thumb = JellyfinUrl.ForArtwork(maybeJellyfin, thumb) + thumb = JellyfinUrl.RelativeProxyForArtwork(thumb) .SetQueryParam("fillHeight", 220); } else if (maybeEmby.IsSome && thumb.StartsWith("emby://")) { - thumb = EmbyUrl.ForArtwork(maybeEmby, thumb) + thumb = EmbyUrl.RelativeProxyForArtwork(thumb) .SetQueryParam("maxHeight", 220); } diff --git a/ErsatzTV.Application/Movies/Mapper.cs b/ErsatzTV.Application/Movies/Mapper.cs index 024a8c1ba..cdbfb7672 100644 --- a/ErsatzTV.Application/Movies/Mapper.cs +++ b/ErsatzTV.Application/Movies/Mapper.cs @@ -66,7 +66,7 @@ namespace ErsatzTV.Application.Movies if (maybeJellyfin.IsSome && artwork.StartsWith("jellyfin://")) { - Url url = JellyfinUrl.ForArtwork(maybeJellyfin, artwork); + Url url = JellyfinUrl.RelativeProxyForArtwork(artwork); if (artworkKind is ArtworkKind.Poster or ArtworkKind.Thumbnail) { url.SetQueryParam("fillHeight", 440); @@ -76,7 +76,7 @@ namespace ErsatzTV.Application.Movies } else if (maybeEmby.IsSome && artwork.StartsWith("emby://")) { - Url url = EmbyUrl.ForArtwork(maybeEmby, artwork); + Url url = EmbyUrl.RelativeProxyForArtwork(artwork); if (artworkKind is ArtworkKind.Poster or ArtworkKind.Thumbnail) { url.SetQueryParam("maxHeight", 440); diff --git a/ErsatzTV.Application/Television/Mapper.cs b/ErsatzTV.Application/Television/Mapper.cs index 053e2e0a7..d712ceb71 100644 --- a/ErsatzTV.Application/Television/Mapper.cs +++ b/ErsatzTV.Application/Television/Mapper.cs @@ -80,7 +80,7 @@ namespace ErsatzTV.Application.Television if (maybeJellyfin.IsSome && artwork.StartsWith("jellyfin://")) { - Url url = JellyfinUrl.ForArtwork(maybeJellyfin, artwork); + Url url = JellyfinUrl.RelativeProxyForArtwork(artwork); if (artworkKind == ArtworkKind.Poster) { url.SetQueryParam("fillHeight", 440); @@ -90,7 +90,7 @@ namespace ErsatzTV.Application.Television } else if (maybeEmby.IsSome && artwork.StartsWith("emby://")) { - Url url = EmbyUrl.ForArtwork(maybeEmby, artwork); + Url url = EmbyUrl.RelativeProxyForArtwork(artwork); if (artworkKind == ArtworkKind.Poster) { url.SetQueryParam("maxHeight", 440); diff --git a/ErsatzTV.Core/Emby/EmbyUrl.cs b/ErsatzTV.Core/Emby/EmbyUrl.cs index c21c86b62..e72e8b8b4 100644 --- a/ErsatzTV.Core/Emby/EmbyUrl.cs +++ b/ErsatzTV.Core/Emby/EmbyUrl.cs @@ -63,5 +63,21 @@ namespace ErsatzTV.Core.Emby .AppendPathSegment(pathSegment) .SetQueryParams(query); } + + public static Url RelativeProxyForArtwork(string artwork) + { + string[] split = artwork.Replace("emby://", string.Empty).Split('?'); + if (split.Length != 2) + { + return artwork; + } + + string pathSegment = split[0]; + QueryParamCollection query = Url.ParseQueryParams(split[1]); + + return Url.Parse("emby") + .AppendPathSegment(pathSegment) + .SetQueryParams(query); + } } } diff --git a/ErsatzTV.Core/Jellyfin/JellyfinUrl.cs b/ErsatzTV.Core/Jellyfin/JellyfinUrl.cs index c8e3a1f8a..dca72ec69 100644 --- a/ErsatzTV.Core/Jellyfin/JellyfinUrl.cs +++ b/ErsatzTV.Core/Jellyfin/JellyfinUrl.cs @@ -63,5 +63,22 @@ namespace ErsatzTV.Core.Jellyfin .AppendPathSegment(pathSegment) .SetQueryParams(query); } + + public static Url RelativeProxyForArtwork(string artwork) + { + string[] split = artwork.Replace("jellyfin://", string.Empty).Split('?'); + if (split.Length != 2) + { + return artwork; + } + + string pathSegment = split[0]; + QueryParamCollection query = Url.ParseQueryParams(split[1]); + + return Url.Parse("jellyfin") + .AppendPathSegment(pathSegment) + .SetQueryParams(query); + } + } } diff --git a/ErsatzTV/Controllers/ArtworkController.cs b/ErsatzTV/Controllers/ArtworkController.cs index c3d0621f0..2d226d022 100644 --- a/ErsatzTV/Controllers/ArtworkController.cs +++ b/ErsatzTV/Controllers/ArtworkController.cs @@ -71,6 +71,7 @@ namespace ErsatzTV.Controllers [HttpGet("/artwork/posters/jellyfin/{*path}")] [HttpGet("/iptv/artwork/thumbnails/jellyfin/{*path}")] [HttpGet("/artwork/thumbnails/jellyfin/{*path}")] + [HttpGet("/artwork/fanart/jellyfin/{*path}")] public Task GetJellyfin(string path) { if (Request.QueryString.HasValue) @@ -85,6 +86,7 @@ namespace ErsatzTV.Controllers [HttpGet("/artwork/posters/emby/{*path}")] [HttpGet("/iptv/artwork/thumbnails/emby/{*path}")] [HttpGet("/artwork/thumbnails/emby/{*path}")] + [HttpGet("/artwork/fanart/emby/{*path}")] public Task GetEmby(string path) { if (Request.QueryString.HasValue) diff --git a/ErsatzTV/Pages/Movie.razor b/ErsatzTV/Pages/Movie.razor index d7c38b3f7..47a9d6dd0 100644 --- a/ErsatzTV/Pages/Movie.razor +++ b/ErsatzTV/Pages/Movie.razor @@ -161,7 +161,6 @@ { } diff --git a/ErsatzTV/Pages/TelevisionSeasonList.razor b/ErsatzTV/Pages/TelevisionSeasonList.razor index d65d2a0ad..9e4e6d964 100644 --- a/ErsatzTV/Pages/TelevisionSeasonList.razor +++ b/ErsatzTV/Pages/TelevisionSeasonList.razor @@ -162,7 +162,6 @@ { }