From 70f75f8adbdec92c43d0fbbfe713d162b38dcdf4 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Thu, 23 Jun 2016 01:26:34 -0400 Subject: [PATCH] fix recording timers --- .../LiveTv/EmbyTV/EmbyTV.cs | 6 +++--- .../LiveTv/EmbyTV/TimerManager.cs | 20 +++++++++++++++++++ 2 files changed, 23 insertions(+), 3 deletions(-) diff --git a/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs b/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs index 29c1d1c9a1..2d2d18524a 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs @@ -461,7 +461,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV return CreateTimer(info, cancellationToken); } - public Task CreateSeriesTimerAsync(SeriesTimerInfo info, CancellationToken cancellationToken) + public Task CreateSeriesTimerAsync(SeriesTimerInfo info, CancellationToken cancellationToken) { return CreateSeriesTimer(info, cancellationToken); } @@ -1011,7 +1011,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV Action onStarted = () => { timer.Status = RecordingStatus.InProgress; - _timerProvider.AddOrUpdate(timer); + _timerProvider.AddOrUpdate(timer, false); result.Item3.Release(); isResourceOpen = false; @@ -1060,7 +1060,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV if (recordingStatus == RecordingStatus.Completed) { timer.Status = RecordingStatus.Completed; - _timerProvider.AddOrUpdate(timer); + _timerProvider.AddOrUpdate(timer, false); OnSuccessfulRecording(info.IsSeries, recordPath); _timerProvider.Delete(timer); diff --git a/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/TimerManager.cs b/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/TimerManager.cs index bcad80447c..4233589068 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/TimerManager.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/TimerManager.cs @@ -72,6 +72,26 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV } } + public void AddOrUpdate(TimerInfo item, bool resetTimer) + { + if (resetTimer) + { + AddOrUpdate(item); + return; + } + + var list = GetAll().ToList(); + + if (!list.Any(i => EqualityComparer(i, item))) + { + base.Add(item); + } + else + { + base.Update(item); + } + } + public override void Add(TimerInfo item) { if (string.IsNullOrWhiteSpace(item.Id))