update channel ids

This commit is contained in:
Luke Pulverenti 2016-02-24 13:45:11 -05:00
parent 631bfb8ed2
commit 1b4dbe8894
2 changed files with 16 additions and 12 deletions

View File

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

View File

@ -14,6 +14,7 @@ using System.IO;
using System.Linq;
using System.Threading;
using System.Threading.Tasks;
using MediaBrowser.Common.Extensions;
using MediaBrowser.Controller.MediaEncoding;
using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Dlna;
@ -64,7 +65,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.HdHomerun
{
Name = i.GuideName,
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
});
@ -347,6 +348,11 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.HdHomerun
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)
{
var list = new List<MediaSourceInfo>();
@ -355,9 +361,9 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.HdHomerun
{
return list;
}
channelId = channelId.Substring(ChannelIdPrefix.Length);
var hdhrId = GetHdHrIdFromChannelId(channelId);
list.Add(GetMediaSource(info, channelId, "native"));
list.Add(GetMediaSource(info, hdhrId, "native"));
try
{
@ -366,12 +372,12 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.HdHomerun
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, channelId, "internet360"));
list.Add(GetMediaSource(info, channelId, "internet240"));
list.Add(GetMediaSource(info, channelId, "mobile"));
list.Add(GetMediaSource(info, hdhrId, "internet480"));
list.Add(GetMediaSource(info, hdhrId, "internet360"));
list.Add(GetMediaSource(info, hdhrId, "internet240"));
list.Add(GetMediaSource(info, hdhrId, "mobile"));
}
}
catch (Exception ex)
@ -400,9 +406,9 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.HdHomerun
{
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)