Use TV guide for livestreams
This commit is contained in:
@@ -5,6 +5,7 @@ using System.Net.Http.Headers;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Jellyfin.Plugin.SRFPlay.Services.Interfaces;
|
||||
using Jellyfin.Plugin.SRFPlay.Utilities;
|
||||
using MediaBrowser.Common.Net;
|
||||
using MediaBrowser.Controller.Entities;
|
||||
using MediaBrowser.Controller.Providers;
|
||||
@@ -186,7 +187,7 @@ public class SRFImageProvider : IRemoteImageProvider, IHasOrder
|
||||
if (needsContentTypeFix)
|
||||
{
|
||||
// Determine correct content type from URL extension or default to JPEG
|
||||
var contentType = GetContentTypeFromUrl(url);
|
||||
var contentType = MimeTypeHelper.GetImageContentType(url);
|
||||
if (!string.IsNullOrEmpty(contentType))
|
||||
{
|
||||
_logger.LogInformation(
|
||||
@@ -201,42 +202,4 @@ public class SRFImageProvider : IRemoteImageProvider, IHasOrder
|
||||
|
||||
return response;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Determines the correct content type based on URL file extension.
|
||||
/// </summary>
|
||||
private static string? GetContentTypeFromUrl(string url)
|
||||
{
|
||||
if (string.IsNullOrEmpty(url))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
// Get the file extension from the URL (ignore query string)
|
||||
var uri = new Uri(url);
|
||||
var path = uri.AbsolutePath.ToLowerInvariant();
|
||||
|
||||
if (path.EndsWith(".jpg", StringComparison.Ordinal) || path.EndsWith(".jpeg", StringComparison.Ordinal))
|
||||
{
|
||||
return "image/jpeg";
|
||||
}
|
||||
|
||||
if (path.EndsWith(".png", StringComparison.Ordinal))
|
||||
{
|
||||
return "image/png";
|
||||
}
|
||||
|
||||
if (path.EndsWith(".gif", StringComparison.Ordinal))
|
||||
{
|
||||
return "image/gif";
|
||||
}
|
||||
|
||||
if (path.EndsWith(".webp", StringComparison.Ordinal))
|
||||
{
|
||||
return "image/webp";
|
||||
}
|
||||
|
||||
// Default to JPEG for SRF images (most common)
|
||||
return "image/jpeg";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user