diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2015-01-25 01:34:50 -0500 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2015-01-25 01:34:50 -0500 |
| commit | a1a56557ece84d8b726a6c06b2620fa43ff22461 (patch) | |
| tree | a9b96eccbe5fd08c34174f5c5cff8e01ac822fea /MediaBrowser.Server.Implementations/Intros/DefaultIntroProvider.cs | |
| parent | 67559378009062a26173888ad457d0c9116bfc9a (diff) | |
sync updates
Diffstat (limited to 'MediaBrowser.Server.Implementations/Intros/DefaultIntroProvider.cs')
| -rw-r--r-- | MediaBrowser.Server.Implementations/Intros/DefaultIntroProvider.cs | 40 |
1 files changed, 19 insertions, 21 deletions
diff --git a/MediaBrowser.Server.Implementations/Intros/DefaultIntroProvider.cs b/MediaBrowser.Server.Implementations/Intros/DefaultIntroProvider.cs index a113e8d5e..2af6e5588 100644 --- a/MediaBrowser.Server.Implementations/Intros/DefaultIntroProvider.cs +++ b/MediaBrowser.Server.Implementations/Intros/DefaultIntroProvider.cs @@ -67,29 +67,26 @@ namespace MediaBrowser.Server.Implementations.Intros ? null : _localization.GetRatingLevel(item.OfficialRating); - var libaryItems = user.RootFolder.GetRecursiveChildren(user, false) - .ToList(); - var random = new Random(Environment.TickCount + Guid.NewGuid().GetHashCode()); var candidates = new List<ItemWithTrailer>(); if (config.EnableIntrosFromMoviesInLibrary) { - var itemsWithTrailers = libaryItems - .Where(i => - { - var hasTrailers = i as IHasTrailers; - - if (hasTrailers != null && hasTrailers.LocalTrailerIds.Count > 0) - { - if (i is Movie) - { - return !IsDuplicate(item, i); - } - } - return false; - }); + var itemsWithTrailers = user.RootFolder + .GetRecursiveChildren(user, i => + { + var hasTrailers = i as IHasTrailers; + + if (hasTrailers != null && hasTrailers.LocalTrailerIds.Count > 0) + { + if (i is Movie) + { + return !IsDuplicate(item, i); + } + } + return false; + }); candidates.AddRange(itemsWithTrailers.Select(i => new ItemWithTrailer { @@ -141,15 +138,16 @@ namespace MediaBrowser.Server.Implementations.Intros })); } + return GetResult(item, candidates, config, ratingLevel); + } + + private IEnumerable<IntroInfo> GetResult(BaseItem item, IEnumerable<ItemWithTrailer> candidates, CinemaModeConfiguration config, int? ratingLevel) + { var customIntros = !string.IsNullOrWhiteSpace(config.CustomIntroPath) ? GetCustomIntros(item) : new List<IntroInfo>(); var trailerLimit = config.TrailerLimit; - if (customIntros.Count > 0) - { - trailerLimit--; - } // Avoid implicitly captured closure return candidates.Where(i => |
