aboutsummaryrefslogtreecommitdiff
path: root/Emby.Server.Implementations/Intros/DefaultIntroProvider.cs
diff options
context:
space:
mode:
authorLuke <luke.pulverenti@gmail.com>2017-01-26 15:40:15 -0500
committerGitHub <noreply@github.com>2017-01-26 15:40:15 -0500
commit1cd5e208713a057680b915c9136e0d4493611ed3 (patch)
tree59e258ecd246dfb253c06cade5f0092af9874774 /Emby.Server.Implementations/Intros/DefaultIntroProvider.cs
parent0d0e4ad695f3657d7ca3eef1ed54fe8608a490a1 (diff)
parent9ebf9162ab68fbf61a1dd5e7801eb9abe985762c (diff)
Merge pull request #2425 from MediaBrowser/beta
Beta
Diffstat (limited to 'Emby.Server.Implementations/Intros/DefaultIntroProvider.cs')
-rw-r--r--Emby.Server.Implementations/Intros/DefaultIntroProvider.cs18
1 files changed, 14 insertions, 4 deletions
diff --git a/Emby.Server.Implementations/Intros/DefaultIntroProvider.cs b/Emby.Server.Implementations/Intros/DefaultIntroProvider.cs
index 180f6aba7f..4d19a0e9b8 100644
--- a/Emby.Server.Implementations/Intros/DefaultIntroProvider.cs
+++ b/Emby.Server.Implementations/Intros/DefaultIntroProvider.cs
@@ -100,20 +100,30 @@ namespace Emby.Server.Implementations.Intros
if (trailerTypes.Count > 0)
{
+ if (trailerTypes.Count >= 5)
+ {
+ trailerTypes.Clear();
+ }
+
+ // 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()
-
- }).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
{