Fix warning and improve performance

This commit is contained in:
Bond_009 2018-12-31 00:51:15 +01:00 committed by Vasily
parent c99b45dbe0
commit a445233192

View File

@ -117,10 +117,8 @@ namespace Emby.Server.Implementations.LiveTv.Listings
httpOptions.RequestContent = requestString; httpOptions.RequestContent = requestString;
using (var response = await Post(httpOptions, true, info).ConfigureAwait(false)) using (var response = await Post(httpOptions, true, info).ConfigureAwait(false))
{ {
StreamReader reader = new StreamReader(response.Content); var dailySchedules = await _jsonSerializer.DeserializeFromStreamAsync<List<ScheduleDirect.Day>>(response.Content).ConfigureAwait(false);
string responseString = reader.ReadToEnd(); _logger.LogDebug("Found {ScheduleCount} programs on {StationID} ScheduleDirect", dailySchedules.Count, stationID);
var dailySchedules = _jsonSerializer.DeserializeFromString<List<ScheduleDirect.Day>>(responseString);
_logger.LogDebug("Found " + dailySchedules.Count + " programs on " + stationID + " ScheduleDirect");
httpOptions = new HttpRequestOptions() httpOptions = new HttpRequestOptions()
{ {
@ -140,16 +138,10 @@ namespace Emby.Server.Implementations.LiveTv.Listings
httpOptions.RequestContent = requestBody; httpOptions.RequestContent = requestBody;
double wideAspect = 1.77777778; double wideAspect = 1.77777778;
var primaryImageCategory = "Logo";
using (var innerResponse = await Post(httpOptions, true, info).ConfigureAwait(false)) using (var innerResponse = await Post(httpOptions, true, info).ConfigureAwait(false))
{ {
StreamReader innerReader = new StreamReader(innerResponse.Content); var programDetails = await _jsonSerializer.DeserializeFromStreamAsync<List<ScheduleDirect.ProgramDetails>>(innerResponse.Content).ConfigureAwait(false);
responseString = innerReader.ReadToEnd();
var programDetails =
_jsonSerializer.DeserializeFromString<List<ScheduleDirect.ProgramDetails>>(
responseString);
var programDict = programDetails.ToDictionary(p => p.programID, y => y); var programDict = programDetails.ToDictionary(p => p.programID, y => y);
var programIdsWithImages = var programIdsWithImages =