aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2016-02-28 16:31:54 -0500
committerLuke Pulverenti <luke.pulverenti@gmail.com>2016-02-28 16:31:54 -0500
commita9804ed2ef200d37aa999485aba4148386584e2f (patch)
tree1668c95b503f607ce547595434f49c66563b42ef
parentbd1578d60a0a7a454b60d7bfc0d2a4df023acff6 (diff)
use discover.json
-rw-r--r--MediaBrowser.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs31
1 files changed, 16 insertions, 15 deletions
diff --git a/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs b/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs
index 35988df9c..bdfbee521 100644
--- a/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs
+++ b/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/HdHomerun/HdHomerunHost.cs
@@ -96,30 +96,19 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.HdHomerun
private async Task<string> GetModelInfo(TunerHostInfo info, CancellationToken cancellationToken)
{
- string model = null;
-
using (var stream = await _httpClient.Get(new HttpRequestOptions()
{
- Url = string.Format("{0}/", GetApiUrl(info, false)),
+ Url = string.Format("{0}/discover.json", GetApiUrl(info, false)),
CancellationToken = cancellationToken,
CacheLength = TimeSpan.FromDays(1),
CacheMode = CacheMode.Unconditional,
TimeoutMs = Convert.ToInt32(TimeSpan.FromSeconds(5).TotalMilliseconds)
}))
{
- using (var sr = new StreamReader(stream, System.Text.Encoding.UTF8))
- {
- while (!sr.EndOfStream)
- {
- string line = StripXML(sr.ReadLine());
- if (line.StartsWith("Model:")) { model = line.Replace("Model: ", ""); }
- //if (line.StartsWith("Device ID:")) { deviceID = line.Replace("Device ID: ", ""); }
- //if (line.StartsWith("Firmware:")) { firmware = line.Replace("Firmware: ", ""); }
- }
- }
- }
+ var response = JsonSerializer.DeserializeFromStream<DiscoverResponse>(stream);
- return model;
+ return response.ModelNumber;
+ }
}
public async Task<List<LiveTvTunerInfo>> GetTunerInfos(TunerHostInfo info, CancellationToken cancellationToken)
@@ -438,5 +427,17 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts.HdHomerun
return info.Any(i => i.Status == LiveTvTunerStatus.Available);
}
+
+ public class DiscoverResponse
+ {
+ public string FriendlyName { get; set; }
+ public string ModelNumber { get; set; }
+ public string FirmwareName { get; set; }
+ public string FirmwareVersion { get; set; }
+ public string DeviceID { get; set; }
+ public string DeviceAuth { get; set; }
+ public string BaseURL { get; set; }
+ public string LineupURL { get; set; }
+ }
}
}