diff options
Diffstat (limited to 'MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs')
| -rw-r--r-- | MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs b/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs index 94b6cdd9e..f25cf541b 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/LiveTvManager.cs @@ -701,7 +701,6 @@ namespace MediaBrowser.Server.Implementations.LiveTv } } } - } internal async Task RefreshChannels(IProgress<double> progress, CancellationToken cancellationToken) @@ -726,6 +725,8 @@ namespace MediaBrowser.Server.Implementations.LiveTv foreach (var channelInfo in allChannelsList) { + cancellationToken.ThrowIfCancellationRequested(); + try { var item = await GetChannel(channelInfo.Item2, channelInfo.Item1, cancellationToken).ConfigureAwait(false); @@ -758,8 +759,12 @@ namespace MediaBrowser.Server.Implementations.LiveTv var guideDays = GetGuideDays(list.Count); + cancellationToken.ThrowIfCancellationRequested(); + foreach (var item in list) { + cancellationToken.ThrowIfCancellationRequested(); + // Avoid implicitly captured closure var currentChannel = item; @@ -788,10 +793,15 @@ namespace MediaBrowser.Server.Implementations.LiveTv double percent = numComplete; percent /= allChannelsList.Count; - progress.Report(90 * percent + 10); + progress.Report(80 * percent + 10); } _programs = programs.ToDictionary(i => i.Id); + + // Load these now which will prefetch metadata + await GetRecordings(new RecordingQuery(), cancellationToken).ConfigureAwait(false); + + progress.Report(100); } private double GetGuideDays(int channelCount) |
