From fb8e3f0843b4a2fac3c986815e8ef539cc79a0f7 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sun, 18 Dec 2016 00:25:06 -0500 Subject: speed up timer query by id --- Emby.Server.Implementations/LiveTv/LiveTvManager.cs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'Emby.Server.Implementations') diff --git a/Emby.Server.Implementations/LiveTv/LiveTvManager.cs b/Emby.Server.Implementations/LiveTv/LiveTvManager.cs index 5e12fc9b9..265817cbe 100644 --- a/Emby.Server.Implementations/LiveTv/LiveTvManager.cs +++ b/Emby.Server.Implementations/LiveTv/LiveTvManager.cs @@ -2009,6 +2009,14 @@ namespace Emby.Server.Implementations.LiveTv .Where(i => _tvDtoService.GetInternalSeriesTimerId(i.Item2.Name, i.Item1.SeriesTimerId) == guid); } + if (!string.IsNullOrEmpty(query.Id)) + { + var guid = new Guid(query.Id); + + timers = timers + .Where(i => _tvDtoService.GetInternalTimerId(i.Item2.Name, i.Item1.Id) == guid); + } + var returnList = new List(); foreach (var i in timers) @@ -2143,7 +2151,11 @@ namespace Emby.Server.Implementations.LiveTv public async Task GetTimer(string id, CancellationToken cancellationToken) { - var results = await GetTimers(new TimerQuery(), cancellationToken).ConfigureAwait(false); + var results = await GetTimers(new TimerQuery + { + Id = id + + }, cancellationToken).ConfigureAwait(false); return results.Items.FirstOrDefault(i => string.Equals(i.Id, id, StringComparison.OrdinalIgnoreCase)); } -- cgit v1.2.3