From 56fb08eeed47102c0b0f8cf656036586e3e99bf2 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Thu, 8 Dec 2016 10:40:20 -0500 Subject: [PATCH] added delete helper --- Emby.Dlna/Didl/DidlBuilder.cs | 17 +++++++++-------- .../SqliteNotificationsRepository.cs | 14 +++++++------- .../TV/MissingEpisodeProvider.cs | 4 ++++ 3 files changed, 20 insertions(+), 15 deletions(-) diff --git a/Emby.Dlna/Didl/DidlBuilder.cs b/Emby.Dlna/Didl/DidlBuilder.cs index 3ad33f0fec..3dcdaf2efc 100644 --- a/Emby.Dlna/Didl/DidlBuilder.cs +++ b/Emby.Dlna/Didl/DidlBuilder.cs @@ -214,16 +214,17 @@ namespace Emby.Dlna.Didl AddVideoResource(writer, video, deviceId, filter, contentFeature, streamInfo); } - foreach (var subtitle in streamInfo.GetSubtitleProfiles(false, _serverAddress, _accessToken)) + var subtitleProfiles = streamInfo.GetSubtitleProfiles(false, _serverAddress, _accessToken) + .Where(subtitle => subtitle.DeliveryMethod == SubtitleDeliveryMethod.External) + .ToList(); + + foreach (var subtitle in subtitleProfiles) { - if (subtitle.DeliveryMethod == SubtitleDeliveryMethod.External) - { - var subtitleAdded = AddSubtitleElement(writer, subtitle); + var subtitleAdded = AddSubtitleElement(writer, subtitle); - if (subtitleAdded && _profile.EnableSingleSubtitleLimit) - { - break; - } + if (subtitleAdded && _profile.EnableSingleSubtitleLimit) + { + break; } } } diff --git a/Emby.Server.Implementations/Notifications/SqliteNotificationsRepository.cs b/Emby.Server.Implementations/Notifications/SqliteNotificationsRepository.cs index 767ba55049..aae41da198 100644 --- a/Emby.Server.Implementations/Notifications/SqliteNotificationsRepository.cs +++ b/Emby.Server.Implementations/Notifications/SqliteNotificationsRepository.cs @@ -115,18 +115,18 @@ namespace Emby.Server.Implementations.Notifications statement.TryBind("@IsRead", false); statement.TryBind("@UserId", userId.ToGuidParamValue()); + var levels = new List(); + foreach (var row in statement.ExecuteQuery()) { - var levels = new List(); - levels.Add(GetLevel(row, 0)); + } - result.UnreadCount = levels.Count; + result.UnreadCount = levels.Count; - if (levels.Count > 0) - { - result.MaxUnreadNotificationLevel = levels.Max(); - } + if (levels.Count > 0) + { + result.MaxUnreadNotificationLevel = levels.Max(); } } diff --git a/MediaBrowser.Providers/TV/MissingEpisodeProvider.cs b/MediaBrowser.Providers/TV/MissingEpisodeProvider.cs index 05ca7c7d9a..4992675da2 100644 --- a/MediaBrowser.Providers/TV/MissingEpisodeProvider.cs +++ b/MediaBrowser.Providers/TV/MissingEpisodeProvider.cs @@ -232,11 +232,15 @@ namespace MediaBrowser.Providers.TV { continue; } + var now = DateTime.UtcNow; var targetSeries = DetermineAppropriateSeries(series, tuple.Item1); var seasonOffset = TvdbSeriesProvider.GetSeriesOffset(targetSeries.ProviderIds) ?? ((targetSeries.AnimeSeriesIndex ?? 1) - 1); + var unairedThresholdDays = 1; + now = now.AddDays(0 - unairedThresholdDays); + if (airDate.Value < now) { if (addMissingEpisodes)