mirror of
https://github.com/jellyfin/jellyfin.git
synced 2024-09-06 03:26:07 +02:00
use discover.json
This commit is contained in:
parent
bd1578d60a
commit
a9804ed2ef
1 changed files with 16 additions and 15 deletions
|
@ -96,30 +96,19 @@ 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)
|
||||||
{
|
{
|
||||||
string model = null;
|
|
||||||
|
|
||||||
using (var stream = await _httpClient.Get(new HttpRequestOptions()
|
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,
|
CancellationToken = cancellationToken,
|
||||||
CacheLength = TimeSpan.FromDays(1),
|
CacheLength = TimeSpan.FromDays(1),
|
||||||
CacheMode = CacheMode.Unconditional,
|
CacheMode = CacheMode.Unconditional,
|
||||||
TimeoutMs = Convert.ToInt32(TimeSpan.FromSeconds(5).TotalMilliseconds)
|
TimeoutMs = Convert.ToInt32(TimeSpan.FromSeconds(5).TotalMilliseconds)
|
||||||
}))
|
}))
|
||||||
{
|
{
|
||||||
using (var sr = new StreamReader(stream, System.Text.Encoding.UTF8))
|
var response = JsonSerializer.DeserializeFromStream<DiscoverResponse>(stream);
|
||||||
{
|
|
||||||
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: ", ""); }
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return model;
|
return response.ModelNumber;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<List<LiveTvTunerInfo>> GetTunerInfos(TunerHostInfo info, CancellationToken cancellationToken)
|
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);
|
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; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue