From 0bc84b7d4163184bbdf0db542a79f37bb06049a3 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Wed, 1 Oct 2014 21:36:58 -0400 Subject: [PATCH] 3.0.5387 Beta --- .../Intros/DefaultIntroProvider.cs | 21 +++++++++++++++++-- .../Session/SessionManager.cs | 4 ++++ 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/MediaBrowser.Server.Implementations/Intros/DefaultIntroProvider.cs b/MediaBrowser.Server.Implementations/Intros/DefaultIntroProvider.cs index d8d26a9bc..6c3eb2dc4 100644 --- a/MediaBrowser.Server.Implementations/Intros/DefaultIntroProvider.cs +++ b/MediaBrowser.Server.Implementations/Intros/DefaultIntroProvider.cs @@ -79,7 +79,7 @@ namespace MediaBrowser.Server.Implementations.Intros { if (i is Movie) { - return true; + return !IsDuplicate(item, i); } } return false; @@ -162,7 +162,7 @@ namespace MediaBrowser.Server.Implementations.Intros { return false; } - return true; + return !IsDuplicate(item, i.Item); }) .OrderByDescending(i => i.Score) .ThenBy(i => Guid.NewGuid()) @@ -172,6 +172,23 @@ namespace MediaBrowser.Server.Implementations.Intros .Concat(customIntros.Take(1)); } + private bool IsDuplicate(BaseItem playingContent, BaseItem test) + { + var id = playingContent.GetProviderId(MetadataProviders.Imdb); + if (!string.IsNullOrWhiteSpace(id) && string.Equals(id, test.GetProviderId(MetadataProviders.Imdb), StringComparison.OrdinalIgnoreCase)) + { + return true; + } + + id = playingContent.GetProviderId(MetadataProviders.Tmdb); + if (!string.IsNullOrWhiteSpace(id) && string.Equals(id, test.GetProviderId(MetadataProviders.Tmdb), StringComparison.OrdinalIgnoreCase)) + { + return true; + } + + return false; + } + private CinemaModeConfiguration GetOptions() { return _serverConfig.GetConfiguration("cinemamode"); diff --git a/MediaBrowser.Server.Implementations/Session/SessionManager.cs b/MediaBrowser.Server.Implementations/Session/SessionManager.cs index ceda8f47d..58a6f649c 100644 --- a/MediaBrowser.Server.Implementations/Session/SessionManager.cs +++ b/MediaBrowser.Server.Implementations/Session/SessionManager.cs @@ -1417,6 +1417,10 @@ namespace MediaBrowser.Server.Implementations.Session { _jsonSerializer.SerializeToFile(capabilities, path); } + catch (Exception ex) + { + _logger.ErrorException("Error saving to {0}", ex, path); + } finally { _capabilitiesLock.Release();