diff --git a/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs b/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs index 0e93287363..b529e91347 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/EmbyTV.cs @@ -694,7 +694,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV TimerId = timer.Id, ShowId = info.ShowId }; - _recordingProvider.Add(recording); + _recordingProvider.AddOrUpdate(recording); } try @@ -719,7 +719,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV recording.Path = recordPath; recording.Status = RecordingStatus.InProgress; recording.DateLastUpdated = DateTime.UtcNow; - _recordingProvider.Update(recording); + _recordingProvider.AddOrUpdate(recording); _logger.Info("Beginning recording."); @@ -767,7 +767,7 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV } recording.DateLastUpdated = DateTime.UtcNow; - _recordingProvider.Update(recording); + _recordingProvider.AddOrUpdate(recording); if (recording.Status == RecordingStatus.Completed) { diff --git a/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/ItemDataProvider.cs b/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/ItemDataProvider.cs index d89c1c0cb6..7003c282eb 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/ItemDataProvider.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/ItemDataProvider.cs @@ -112,6 +112,20 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV UpdateList(list); } + public void AddOrUpdate(T item) + { + var list = GetAll().ToList(); + + if (!list.Any(i => EqualityComparer(i, item))) + { + Add(item); + } + else + { + Update(item); + } + } + public virtual void Delete(T item) { var list = GetAll().Where(i => !EqualityComparer(i, item)).ToList(); diff --git a/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/TimerManager.cs b/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/TimerManager.cs index 94ad5e5cec..5e5beed9fb 100644 --- a/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/TimerManager.cs +++ b/MediaBrowser.Server.Implementations/LiveTv/EmbyTV/TimerManager.cs @@ -76,20 +76,6 @@ namespace MediaBrowser.Server.Implementations.LiveTv.EmbyTV AddTimer(item); } - public void AddOrUpdate(TimerInfo item) - { - var list = GetAll().ToList(); - - if (!list.Any(i => EqualityComparer(i, item))) - { - Add(item); - } - else - { - Update(item); - } - } - private void AddTimer(TimerInfo item) { var startDate = RecordingHelper.GetStartTime(item);