Integrate native decoder TV and internet EPG artwork with Jellyfin 12.2
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
@@ -39,7 +40,7 @@ namespace Jellyfin.Plugin.Enigma2
|
||||
|
||||
public static LiveTvService Instance { get; private set; }
|
||||
|
||||
public LiveTvService(ILogger<LiveTvService> logger, IHttpClientFactory httpClientFactory)
|
||||
public LiveTvService(ILogger<LiveTvService> logger, IHttpClientFactory httpClientFactory, InternetEpg internetEpg)
|
||||
{
|
||||
_logger = logger;
|
||||
_httpClientFactory = httpClientFactory;
|
||||
@@ -339,6 +340,9 @@ namespace Jellyfin.Plugin.Enigma2
|
||||
channelInfos.AddRange(channelInfosForBouquet);
|
||||
}
|
||||
|
||||
channelInfos = channelInfos.GroupBy(c => c.Id).Select(g => g.First()).ToList();
|
||||
for (var i = 0; i < channelInfos.Count; i++) channelInfos[i].Number = (i + 1).ToString(CultureInfo.InvariantCulture);
|
||||
tvChannelInfos = channelInfos;
|
||||
return channelInfos;
|
||||
}
|
||||
else
|
||||
@@ -812,7 +816,7 @@ namespace Jellyfin.Plugin.Enigma2
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Cancel pending scheduled Recording
|
||||
/// Cancel pending scheduled Recording
|
||||
/// </summary>
|
||||
/// <param name="timerId">The timerId</param>
|
||||
/// <param name="cancellationToken">The cancellationToken</param>
|
||||
@@ -1145,7 +1149,7 @@ namespace Jellyfin.Plugin.Enigma2
|
||||
}
|
||||
|
||||
var baseUrl = protocol + "://" + Plugin.Instance.Configuration.HostName + ":" + streamingPort;
|
||||
|
||||
|
||||
//check if we need to zap to channel - single tuner
|
||||
if (Plugin.Instance.Configuration.ZapToChannel)
|
||||
{
|
||||
@@ -1301,7 +1305,7 @@ namespace Jellyfin.Plugin.Enigma2
|
||||
_logger.LogInformation("[Enigma2] Start GetProgramsAsync");
|
||||
await EnsureConnectionAsync(cancellationToken).ConfigureAwait(false);
|
||||
|
||||
var rnd = new Random();
|
||||
|
||||
|
||||
var imagePath = "";
|
||||
var imageUrl = "";
|
||||
@@ -1395,7 +1399,7 @@ namespace Jellyfin.Plugin.Enigma2
|
||||
if (sdate > endDateUtc)
|
||||
{
|
||||
UtilsHelper.DebugInformation(_logger, string.Format("[Enigma2] GetProgramsAsync epc full ending without adding channel name : {0} program : {1}", e2eventservicename, e2eventtitle));
|
||||
return programInfos;
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -1427,7 +1431,7 @@ namespace Jellyfin.Plugin.Enigma2
|
||||
programInfo.ChannelId = e2eventservicereference;
|
||||
|
||||
// for some reason the Id appears to have to be unique so will make it so
|
||||
programInfo.Id = e2eventservicereference + "~" + e2eventid + "~" + count + "~" + rnd.Next();
|
||||
programInfo.Id = e2eventservicereference + "~" + e2eventid + "~" + e2eventstart;
|
||||
|
||||
programInfo.Overview = e2eventdescriptionextended;
|
||||
|
||||
@@ -1461,6 +1465,7 @@ namespace Jellyfin.Plugin.Enigma2
|
||||
count = count + 1;
|
||||
}
|
||||
}
|
||||
await InternetEpg.Instance.EnrichAsync(tvChannelInfos.FirstOrDefault(c => c.Id == channelId)?.Name, programInfos, cancellationToken).ConfigureAwait(false);
|
||||
return programInfos;
|
||||
}
|
||||
catch (Exception e)
|
||||
|
||||
Reference in New Issue
Block a user