aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/LiveTv
diff options
context:
space:
mode:
Diffstat (limited to 'Emby.Server.Implementations/LiveTv')
-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)