diff options
Diffstat (limited to 'Emby.Server.Implementations/LiveTv/LiveTvManager.cs')
| -rw-r--r-- | Emby.Server.Implementations/LiveTv/LiveTvManager.cs | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/Emby.Server.Implementations/LiveTv/LiveTvManager.cs b/Emby.Server.Implementations/LiveTv/LiveTvManager.cs index 718620ab5..7e72d1b1a 100644 --- a/Emby.Server.Implementations/LiveTv/LiveTvManager.cs +++ b/Emby.Server.Implementations/LiveTv/LiveTvManager.cs @@ -1232,6 +1232,8 @@ namespace Emby.Server.Implementations.LiveTv var newChannelIdList = new List<Guid>(); var newProgramIdList = new List<Guid>(); + var cleanDatabase = true; + foreach (var service in _services) { cancellationToken.ThrowIfCancellationRequested(); @@ -1254,6 +1256,7 @@ namespace Emby.Server.Implementations.LiveTv } catch (Exception ex) { + cleanDatabase = false; _logger.ErrorException("Error refreshing channels for service", ex); } @@ -1264,8 +1267,11 @@ namespace Emby.Server.Implementations.LiveTv progress.Report(100 * percent); } - await CleanDatabaseInternal(newChannelIdList.ToArray(), new[] { typeof(LiveTvChannel).Name }, progress, cancellationToken).ConfigureAwait(false); - await CleanDatabaseInternal(newProgramIdList.ToArray(), new[] { typeof(LiveTvProgram).Name }, progress, cancellationToken).ConfigureAwait(false); + if (cleanDatabase) + { + await CleanDatabaseInternal(newChannelIdList.ToArray(), new[] { typeof(LiveTvChannel).Name }, progress, cancellationToken).ConfigureAwait(false); + await CleanDatabaseInternal(newProgramIdList.ToArray(), new[] { typeof(LiveTvProgram).Name }, progress, cancellationToken).ConfigureAwait(false); + } var coreService = _services.OfType<EmbyTV.EmbyTV>().FirstOrDefault(); @@ -1291,8 +1297,9 @@ namespace Emby.Server.Implementations.LiveTv { progress.Report(10); - var allChannels = await GetChannels(service, cancellationToken).ConfigureAwait(false); - var allChannelsList = allChannels.ToList(); + var allChannelsList = (await service.GetChannelsAsync(cancellationToken).ConfigureAwait(false)) + .Select(i => new Tuple<string, ChannelInfo>(service.Name, i)) + .ToList(); var list = new List<LiveTvChannel>(); @@ -1507,13 +1514,6 @@ namespace Emby.Server.Implementations.LiveTv return 7; } - private async Task<IEnumerable<Tuple<string, ChannelInfo>>> GetChannels(ILiveTvService service, CancellationToken cancellationToken) - { - var channels = await service.GetChannelsAsync(cancellationToken).ConfigureAwait(false); - - return channels.Select(i => new Tuple<string, ChannelInfo>(service.Name, i)); - } - private DateTime _lastRecordingRefreshTime; private async Task RefreshRecordings(Guid internalLiveTvFolderId, CancellationToken cancellationToken) { |
