update channel ids

pull/702/head
Luke Pulverenti 9 years ago
parent 631bfb8ed2
commit 1b4dbe8894

@ -31,7 +31,6 @@ namespace MediaBrowser.Model.LiveTv
public string Type { get; set; } public string Type { get; set; }
public bool ImportFavoritesOnly { get; set; } public bool ImportFavoritesOnly { get; set; }
public bool IsEnabled { get; set; } public bool IsEnabled { get; set; }
public string GuideGroup { get; set; }
public TunerHostInfo() public TunerHostInfo()
{ {
@ -49,6 +48,5 @@ namespace MediaBrowser.Model.LiveTv
public string ZipCode { get; set; } public string ZipCode { get; set; }
public string Country { get; set; } public string Country { get; set; }
public string Path { get; set; } public string Path { get; set; }
public string GuideGroup { get; set; }
} }
} }

@ -14,6 +14,7 @@ using System.IO;
using System.Linq; using System.Linq;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using MediaBrowser.Common.Extensions;
using MediaBrowser.Controller.MediaEncoding; using MediaBrowser.Controller.MediaEncoding;
using MediaBrowser.Model.Configuration; using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Dlna; using MediaBrowser.Model.Dlna;
@ -64,7 +65,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.HdHomerun
{ {
Name = i.GuideName, Name = i.GuideName,
Number = i.GuideNumber.ToString(CultureInfo.InvariantCulture), Number = i.GuideNumber.ToString(CultureInfo.InvariantCulture),
Id = ChannelIdPrefix + i.GuideNumber.ToString(CultureInfo.InvariantCulture), Id = ChannelIdPrefix + i.GuideNumber.ToString(CultureInfo.InvariantCulture) + '_' + (i.GuideName ?? string.Empty).GetMD5().ToString("N"),
IsFavorite = i.Favorite IsFavorite = i.Favorite
}); });
@ -347,6 +348,11 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.HdHomerun
return Config.GetConfiguration<EncodingOptions>("encoding"); return Config.GetConfiguration<EncodingOptions>("encoding");
} }
private string GetHdHrIdFromChannelId(string channelId)
{
return channelId.Split('_')[1];
}
protected override async Task<List<MediaSourceInfo>> GetChannelStreamMediaSources(TunerHostInfo info, string channelId, CancellationToken cancellationToken) protected override async Task<List<MediaSourceInfo>> GetChannelStreamMediaSources(TunerHostInfo info, string channelId, CancellationToken cancellationToken)
{ {
var list = new List<MediaSourceInfo>(); var list = new List<MediaSourceInfo>();
@ -355,9 +361,9 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.HdHomerun
{ {
return list; return list;
} }
channelId = channelId.Substring(ChannelIdPrefix.Length); var hdhrId = GetHdHrIdFromChannelId(channelId);
list.Add(GetMediaSource(info, channelId, "native")); list.Add(GetMediaSource(info, hdhrId, "native"));
try try
{ {
@ -366,12 +372,12 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.HdHomerun
if (model.IndexOf("hdtc", StringComparison.OrdinalIgnoreCase) != -1) if (model.IndexOf("hdtc", StringComparison.OrdinalIgnoreCase) != -1)
{ {
list.Insert(0, GetMediaSource(info, channelId, "heavy")); list.Insert(0, GetMediaSource(info, hdhrId, "heavy"));
list.Add(GetMediaSource(info, channelId, "internet480")); list.Add(GetMediaSource(info, hdhrId, "internet480"));
list.Add(GetMediaSource(info, channelId, "internet360")); list.Add(GetMediaSource(info, hdhrId, "internet360"));
list.Add(GetMediaSource(info, channelId, "internet240")); list.Add(GetMediaSource(info, hdhrId, "internet240"));
list.Add(GetMediaSource(info, channelId, "mobile")); list.Add(GetMediaSource(info, hdhrId, "mobile"));
} }
} }
catch (Exception ex) catch (Exception ex)
@ -400,9 +406,9 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.HdHomerun
{ {
throw new ArgumentException("Channel not found"); throw new ArgumentException("Channel not found");
} }
channelId = channelId.Substring(ChannelIdPrefix.Length); var hdhrId = GetHdHrIdFromChannelId(channelId);
return GetMediaSource(info, channelId, streamId); return GetMediaSource(info, hdhrId, streamId);
} }
public async Task Validate(TunerHostInfo info) public async Task Validate(TunerHostInfo info)

Loading…
Cancel
Save