mirror of
https://github.com/jellyfin/jellyfin.git
synced 2025-12-28 11:44:48 +03:00
update m3u channel mapping
This commit is contained in:
@@ -136,11 +136,26 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
|
||||
channel.Name = GetChannelName(extInf, attributes);
|
||||
channel.Number = GetChannelNumber(extInf, attributes, mediaUrl);
|
||||
|
||||
var channelId = GetTunerChannelId(attributes);
|
||||
string tvgId;
|
||||
attributes.TryGetValue("tvg-id", out tvgId);
|
||||
|
||||
string channelId;
|
||||
attributes.TryGetValue("channel-id", out channelId);
|
||||
|
||||
channel.TunerChannelId = string.IsNullOrWhiteSpace(tvgId) ? channelId : tvgId;
|
||||
|
||||
var channelIdValues = new List<string>();
|
||||
if (!string.IsNullOrWhiteSpace(channelId))
|
||||
{
|
||||
channel.Id = channelId;
|
||||
channel.TunerChannelId = channelId;
|
||||
channelIdValues.Add(channelId);
|
||||
}
|
||||
if (!string.IsNullOrWhiteSpace(tvgId))
|
||||
{
|
||||
channelIdValues.Add(tvgId);
|
||||
}
|
||||
if (channelIdValues.Count > 0)
|
||||
{
|
||||
channel.Id = string.Join("_", channelIdValues.ToArray());
|
||||
}
|
||||
|
||||
return channel;
|
||||
@@ -296,24 +311,6 @@ namespace Emby.Server.Implementations.LiveTv.TunerHosts
|
||||
return name;
|
||||
}
|
||||
|
||||
private string GetTunerChannelId(Dictionary<string, string> attributes)
|
||||
{
|
||||
var values = new List<string>();
|
||||
|
||||
string result;
|
||||
if (attributes.TryGetValue("tvg-id", out result))
|
||||
{
|
||||
values.Add(result);
|
||||
}
|
||||
|
||||
if (attributes.TryGetValue("channel-id", out result))
|
||||
{
|
||||
values.Add(result);
|
||||
}
|
||||
|
||||
return values.Count == 0 ? null : string.Join("-", values.ToArray());
|
||||
}
|
||||
|
||||
private Dictionary<string, string> ParseExtInf(string line, out string remaining)
|
||||
{
|
||||
var dict = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase);
|
||||
|
||||
Reference in New Issue
Block a user