From 0d9e8b4f000f29d1d69b1e972f24cfafe232b758 Mon Sep 17 00:00:00 2001 From: Claus Vium Date: Wed, 23 Dec 2020 11:08:18 +0100 Subject: [PATCH] Merge pull request #4852 from ryanpetris/fix-schedulesdirect-refresh SchedulesDirect no longer refreshes channels properly (cherry picked from commit e36881f4fd891176392b6eee8019deac038ade61) Signed-off-by: Joshua M. Boniface --- .../LiveTv/Listings/SchedulesDirect.cs | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs b/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs index 90e6cc9668..b19ccadd8f 100644 --- a/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs +++ b/Emby.Server.Implementations/LiveTv/Listings/SchedulesDirect.cs @@ -784,18 +784,17 @@ namespace Emby.Server.Implementations.LiveTv.Listings var allStations = root.stations ?? new List(); var map = root.map; - int len = map.Count; - var array = new List(len); - for (int i = 0; i < len; i++) + var list = new List(map.Count); + foreach (var channel in map) { - var channelNumber = GetChannelNumber(map[i]); + var channelNumber = GetChannelNumber(channel); - var station = allStations.Find(item => string.Equals(item.stationID, map[i].stationID, StringComparison.OrdinalIgnoreCase)); + var station = allStations.Find(item => string.Equals(item.stationID, channel.stationID, StringComparison.OrdinalIgnoreCase)); if (station == null) { station = new ScheduleDirect.Station { - stationID = map[i].stationID + stationID = channel.stationID }; } @@ -812,10 +811,10 @@ namespace Emby.Server.Implementations.LiveTv.Listings channelInfo.ImageUrl = station.logo.URL; } - array[i] = channelInfo; + list.Add(channelInfo); } - return array; + return list; } private static string NormalizeName(string value)