public async Task <IEnumerable <LineupItem> > GetLineup() { await Task.Yield(); var localIp = HttpContextAccessor.HttpContext.Connection.LocalIpAddress; if (localIp.IsIPv4MappedToIPv6) { localIp = localIp.MapToIPv4(); } var localIpStr = localIp.ToString(); var proxy = Configuration.Proxies.FirstOrDefault(p => p.ProxyHost == localIpStr); if (proxy == null) { return(Enumerable.Empty <LineupItem>()); } var filePath = Path.Join(Configuration.DataDir, proxy.GetChannelFilename()); if (!File.Exists(filePath)) { return(Enumerable.Empty <LineupItem>()); } var deviceId = proxy.FauxDeviceId; if (deviceId == null) { var discoverInfo = await new HttpClient(proxy.Host, proxy.HttpPort).Discover(); deviceId = discoverInfo.DeviceId; } await using var stream = File.OpenRead(filePath); using var streamReader = new StreamReader(stream); var json = await streamReader.ReadToEndAsync(); var data = JsonConvert.DeserializeObject <IEnumerable <Channel> >(json); return(await ConversionUtilities.ChannelsToHdhrLineup(deviceId, data)); }