|
@@ -105,21 +105,26 @@ namespace Emby.Server.Implementations.Intros
|
|
trailerTypes.Clear();
|
|
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 },
|
|
IncludeItemTypes = new[] { typeof(Trailer).Name },
|
|
TrailerTypes = trailerTypes.ToArray(),
|
|
TrailerTypes = trailerTypes.ToArray(),
|
|
SimilarTo = item,
|
|
SimilarTo = item,
|
|
- IsPlayed = config.EnableIntrosForWatchedContent ? (bool?)null : false,
|
|
|
|
|
|
+ //IsPlayed = config.EnableIntrosForWatchedContent ? (bool?)null : false,
|
|
MaxParentalRating = config.EnableIntrosParentalControl ? ratingLevel : null,
|
|
MaxParentalRating = config.EnableIntrosParentalControl ? ratingLevel : null,
|
|
BlockUnratedItems = config.EnableIntrosParentalControl ? new[] { UnratedItem.Trailer } : new UnratedItem[] { },
|
|
BlockUnratedItems = config.EnableIntrosParentalControl ? new[] { UnratedItem.Trailer } : new UnratedItem[] { },
|
|
|
|
|
|
// Account for duplicates by imdb id, since the database doesn't support this yet
|
|
// 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(),
|
|
SourceTypes = sourceTypes.ToArray(),
|
|
MinSimilarityScore = 0
|
|
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
|
|
candidates.AddRange(trailerResult.Select(i => new ItemWithTrailer
|
|
{
|
|
{
|