From bc41dcbc7e28c20b7090c413d7960f6744b085a0 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Thu, 20 Aug 2015 13:40:11 -0400 Subject: [PATCH] update tuner saving --- .../LiveTv/TunerHosts/BaseTunerHost.cs | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/BaseTunerHost.cs b/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/BaseTunerHost.cs index 87d750783..909e2bba5 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/BaseTunerHost.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/TunerHosts/BaseTunerHost.cs @@ -43,15 +43,17 @@ namespace MediaBrowser.Server.Implementations.LiveTv.TunerHosts } var result = await GetChannelsInternal(tuner, cancellationToken).ConfigureAwait(false); + var list = result.ToList(); - cache = cache ?? new ChannelCache(); + if (!string.IsNullOrWhiteSpace(key)) + { + cache = cache ?? new ChannelCache(); + cache.Date = DateTime.UtcNow; + cache.Channels = list; + _channelCache.AddOrUpdate(key, cache, (k, v) => cache); + } - cache.Date = DateTime.UtcNow; - cache.Channels = result.ToList(); - - _channelCache.AddOrUpdate(key, cache, (k, v) => cache); - - return cache.Channels.ToList(); + return list; } private List GetTunerHosts()