handle HDHR's with older firmware

This commit is contained in:
Luke Pulverenti 2016-07-07 23:22:16 -04:00
parent f952ac0f1f
commit 9fdc9faba2

View File

@ -17,6 +17,7 @@ using System.Threading.Tasks;
using MediaBrowser.Common.Extensions; using MediaBrowser.Common.Extensions;
using MediaBrowser.Controller.MediaEncoding; using MediaBrowser.Controller.MediaEncoding;
using MediaBrowser.Model.Configuration; using MediaBrowser.Model.Configuration;
using MediaBrowser.Model.Net;
namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.HdHomerun namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.HdHomerun
{ {
@ -105,6 +106,8 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.HdHomerun
} }
private async Task<string> GetModelInfo(TunerHostInfo info, CancellationToken cancellationToken) private async Task<string> GetModelInfo(TunerHostInfo info, CancellationToken cancellationToken)
{
try
{ {
using (var stream = await _httpClient.Get(new HttpRequestOptions() using (var stream = await _httpClient.Get(new HttpRequestOptions()
{ {
@ -120,6 +123,17 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.HdHomerun
return response.ModelNumber; return response.ModelNumber;
} }
} }
catch (HttpException ex)
{
if (ex.StatusCode.HasValue && ex.StatusCode.Value == System.Net.HttpStatusCode.NotFound)
{
// HDHR4 doesn't have this api
return "HDHR";
}
throw;
}
}
public async Task<List<LiveTvTunerInfo>> GetTunerInfos(TunerHostInfo info, CancellationToken cancellationToken) public async Task<List<LiveTvTunerInfo>> GetTunerInfos(TunerHostInfo info, CancellationToken cancellationToken)
{ {
@ -455,6 +469,8 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.HdHomerun
return; return;
} }
try
{
// Test it by pulling down the lineup // Test it by pulling down the lineup
using (var stream = await _httpClient.Get(new HttpRequestOptions using (var stream = await _httpClient.Get(new HttpRequestOptions
{ {
@ -467,6 +483,17 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.HdHomerun
info.DeviceId = response.DeviceID; info.DeviceId = response.DeviceID;
} }
} }
catch (HttpException ex)
{
if (ex.StatusCode.HasValue && ex.StatusCode.Value == System.Net.HttpStatusCode.NotFound)
{
// HDHR4 doesn't have this api
return;
}
throw;
}
}
protected override async Task<bool> IsAvailableInternal(TunerHostInfo tuner, string channelId, CancellationToken cancellationToken) protected override async Task<bool> IsAvailableInternal(TunerHostInfo tuner, string channelId, CancellationToken cancellationToken)
{ {