private M3UChannel GetChannelnfo(string extInf, string tunerHostId, string mediaUrl) { var channel = new M3UChannel(); channel.TunerHostId = tunerHostId; extInf = extInf.Trim(); string remaining; var attributes = ParseExtInf(extInf, out remaining); extInf = remaining; string value; if (attributes.TryGetValue("tvg-logo", out value)) { channel.ImageUrl = value; } channel.Name = GetChannelName(extInf, attributes); channel.Number = GetChannelNumber(extInf, attributes, mediaUrl); return(channel); }
private M3UChannel GetChannelnfo(string extInf, string tunerHostId, string mediaUrl) { var channel = new M3UChannel(); channel.TunerHostId = tunerHostId; extInf = extInf.Trim(); string remaining; var attributes = ParseExtInf(extInf, out remaining); extInf = remaining; string value; if (attributes.TryGetValue("tvg-logo", out value)) { channel.ImageUrl = value; } channel.Name = GetChannelName(extInf, attributes); channel.Number = GetChannelNumber(extInf, attributes, mediaUrl); 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)) { channelIdValues.Add(channelId); } if (!string.IsNullOrWhiteSpace(tvgId)) { channelIdValues.Add(tvgId); } if (channelIdValues.Count > 0) { channel.Id = string.Join("_", channelIdValues.ToArray()); } return(channel); }