add tuner data version

This commit is contained in:
Luke Pulverenti 2016-02-25 15:29:38 -05:00
parent cd144bc6f5
commit ea374c01b1
4 changed files with 16 additions and 3 deletions

View file

@ -64,7 +64,7 @@ namespace MediaBrowser.Controller.LiveTv
/// </summary> /// </summary>
/// <value><c>true</c> if this instance can reset; otherwise, <c>false</c>.</value> /// <value><c>true</c> if this instance can reset; otherwise, <c>false</c>.</value>
public bool CanReset { get; set; } public bool CanReset { get; set; }
public LiveTvTunerInfo() public LiveTvTunerInfo()
{ {
Clients = new List<string>(); Clients = new List<string>();

View file

@ -32,6 +32,8 @@ namespace MediaBrowser.Model.LiveTv
public bool ImportFavoritesOnly { get; set; } public bool ImportFavoritesOnly { get; set; }
public bool IsEnabled { get; set; } public bool IsEnabled { get; set; }
public int DataVersion { get; set; }
public TunerHostInfo() public TunerHostInfo()
{ {
IsEnabled = true; IsEnabled = true;

View file

@ -87,7 +87,6 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV
_timerProvider.RestartTimers(); _timerProvider.RestartTimers();
SystemEvents.PowerModeChanged += SystemEvents_PowerModeChanged; SystemEvents.PowerModeChanged += SystemEvents_PowerModeChanged;
} }
void SystemEvents_PowerModeChanged(object sender, PowerModeChangedEventArgs e) void SystemEvents_PowerModeChanged(object sender, PowerModeChangedEventArgs e)

View file

@ -48,6 +48,18 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.HdHomerun
private const string ChannelIdPrefix = "hdhr_"; private const string ChannelIdPrefix = "hdhr_";
private string GetChannelId(TunerHostInfo info, Channels i)
{
var id = ChannelIdPrefix + i.GuideNumber.ToString(CultureInfo.InvariantCulture);
if (info.DataVersion >= 1)
{
id += '_' + (i.GuideName ?? string.Empty).GetMD5().ToString("N");
}
return id;
}
protected override async Task<IEnumerable<ChannelInfo>> GetChannelsInternal(TunerHostInfo info, CancellationToken cancellationToken) protected override async Task<IEnumerable<ChannelInfo>> GetChannelsInternal(TunerHostInfo info, CancellationToken cancellationToken)
{ {
var options = new HttpRequestOptions var options = new HttpRequestOptions
@ -65,7 +77,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) + '_' + (i.GuideName ?? string.Empty).GetMD5().ToString("N"), Id = GetChannelId(info, i),
IsFavorite = i.Favorite, IsFavorite = i.Favorite,
TunerHostId = info.Id TunerHostId = info.Id