diff options
| author | Luke <luke.pulverenti@gmail.com> | 2017-01-20 13:48:32 -0500 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2017-01-20 13:48:32 -0500 |
| commit | d0ce1cc3193eddb237844b7df8565c5c97747249 (patch) | |
| tree | e4afeb3047e9a1c5f3f00208b24a0f2f44a413a0 /Emby.Server.Implementations/Intros/DefaultIntroProvider.cs | |
| parent | 4f5151023aabb7f2f303daadb3cbd023cedb7302 (diff) | |
| parent | e4fd626d1cccc38b8bd84aa9dcbcde7e7306e1ea (diff) | |
Merge pull request #2406 from MediaBrowser/dev
Dev
Diffstat (limited to 'Emby.Server.Implementations/Intros/DefaultIntroProvider.cs')
| -rw-r--r-- | Emby.Server.Implementations/Intros/DefaultIntroProvider.cs | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/Emby.Server.Implementations/Intros/DefaultIntroProvider.cs b/Emby.Server.Implementations/Intros/DefaultIntroProvider.cs index 90bb2f5c0..500d4b69b 100644 --- a/Emby.Server.Implementations/Intros/DefaultIntroProvider.cs +++ b/Emby.Server.Implementations/Intros/DefaultIntroProvider.cs @@ -105,21 +105,26 @@ namespace Emby.Server.Implementations.Intros trailerTypes.Clear(); } - var trailerResult = _libraryManager.GetItemList(new InternalItemsQuery(user) + // hack - can't filter by user library because local trailers get TopParentId =null in the db. + // for now we have to use a post-query filter afterwards to solve that + var trailerResult = _libraryManager.GetItemList(new InternalItemsQuery { IncludeItemTypes = new[] { typeof(Trailer).Name }, TrailerTypes = trailerTypes.ToArray(), SimilarTo = item, - IsPlayed = config.EnableIntrosForWatchedContent ? (bool?)null : false, + //IsPlayed = config.EnableIntrosForWatchedContent ? (bool?)null : false, MaxParentalRating = config.EnableIntrosParentalControl ? ratingLevel : null, BlockUnratedItems = config.EnableIntrosParentalControl ? new[] { UnratedItem.Trailer } : new UnratedItem[] { }, // Account for duplicates by imdb id, since the database doesn't support this yet - Limit = config.TrailerLimit * 2, + Limit = config.TrailerLimit * 4, SourceTypes = sourceTypes.ToArray(), MinSimilarityScore = 0 - - }).Where(i => string.IsNullOrWhiteSpace(i.GetProviderId(MetadataProviders.Imdb)) || !string.Equals(i.GetProviderId(MetadataProviders.Imdb), item.GetProviderId(MetadataProviders.Imdb), StringComparison.OrdinalIgnoreCase)).Take(config.TrailerLimit); + }) + .Where(i => string.IsNullOrWhiteSpace(i.GetProviderId(MetadataProviders.Imdb)) || !string.Equals(i.GetProviderId(MetadataProviders.Imdb), item.GetProviderId(MetadataProviders.Imdb), StringComparison.OrdinalIgnoreCase)) + .Where(i => i.IsVisibleStandalone(user)) + .Where(i => config.EnableIntrosForWatchedContent || !i.IsPlayed(user)) + .Take(config.TrailerLimit); candidates.AddRange(trailerResult.Select(i => new ItemWithTrailer { |
