aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations
diff options
context:
space:
mode:
authorLuke Pulverenti <luke.pulverenti@gmail.com>2017-02-08 22:58:04 -0500
committerLuke Pulverenti <luke.pulverenti@gmail.com>2017-02-08 22:58:04 -0500
commitf1cfd3cffb6ba6af91badb717ee204dce682d793 (patch)
treeebf87f87cf6370e3bd8faa40d0662bbc9741ad3f /Emby.Server.Implementations
parentd6b4b5eeb080d67c1b10e4572af59a5e292e9aa0 (diff)
add schedules direct error handling
Diffstat (limited to 'Emby.Server.Implementations')
-rw-r--r--Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs34
1 files changed, 26 insertions, 8 deletions
diff --git a/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs b/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs
index 1b7a1c8c6..0d7a26553 100644
--- a/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs
+++ b/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs
@@ -152,7 +152,11 @@ namespace Emby.Server.Implementations.LiveTv.Listings
responseString);
var programDict = programDetails.ToDictionary(p => p.programID, y => y);
- var images = await GetImageForPrograms(info, programDetails.Where(p => p.hasImageArtwork).Select(p => p.programID).ToList(), cancellationToken);
+ var programIdsWithImages =
+ programDetails.Where(p => p.hasImageArtwork).Select(p => p.programID)
+ .ToList();
+
+ var images = await GetImageForPrograms(info, programIdsWithImages, cancellationToken);
var schedules = dailySchedules.SelectMany(d => d.programs);
foreach (ScheduleDirect.Program schedule in schedules)
@@ -439,13 +443,20 @@ namespace Emby.Server.Implementations.LiveTv.Listings
List<string> programIds,
CancellationToken cancellationToken)
{
+ if (programIds.Count == 0)
+ {
+ return new List<ScheduleDirect.ShowImages>();
+ }
+
var imageIdString = "[";
foreach (var i in programIds)
{
- if (!imageIdString.Contains(i.Substring(0, 10)))
+ var imageId = i.Substring(0, 10);
+
+ if (!imageIdString.Contains(imageId))
{
- imageIdString += "\"" + i.Substring(0, 10) + "\",";
+ imageIdString += "\"" + imageId + "\",";
}
}
@@ -461,14 +472,21 @@ namespace Emby.Server.Implementations.LiveTv.Listings
// The data can be large so give it some extra time
TimeoutMs = 60000
};
- List<ScheduleDirect.ShowImages> images;
- using (var innerResponse2 = await Post(httpOptions, true, info).ConfigureAwait(false))
+
+ try
{
- images = _jsonSerializer.DeserializeFromStream<List<ScheduleDirect.ShowImages>>(
- innerResponse2.Content);
+ using (var innerResponse2 = await Post(httpOptions, true, info).ConfigureAwait(false))
+ {
+ return _jsonSerializer.DeserializeFromStream<List<ScheduleDirect.ShowImages>>(
+ innerResponse2.Content);
+ }
}
+ catch (Exception ex)
+ {
+ _logger.ErrorException("Error getting image info from schedules direct", ex);
- return images;
+ return new List<ScheduleDirect.ShowImages>();
+ }
}
public async Task<List<NameIdPair>> GetHeadends(ListingsProviderInfo info, string country, string location, CancellationToken cancellationToken)