diff options
Diffstat (limited to 'Emby.Server.Implementations/LiveTv/TunerHosts/M3uParser.cs')
| -rw-r--r-- | Emby.Server.Implementations/LiveTv/TunerHosts/M3uParser.cs | 39 |
1 files changed, 18 insertions, 21 deletions
diff --git a/Emby.Server.Implementations/LiveTv/TunerHosts/M3uParser.cs b/Emby.Server.Implementations/LiveTv/TunerHosts/M3uParser.cs index 073da48a0..8c4b9bf60 100644 --- a/Emby.Server.Implementations/LiveTv/TunerHosts/M3uParser.cs +++ b/Emby.Server.Implementations/LiveTv/TunerHosts/M3uParser.cs @@ -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); |
