The Free Software Media System - Server Backend & API
update intro queries
Luke Pulverentiba9222898b9a
diff --git a/Emby.Server.Implementations/Data/SqliteItemRepository.cs b/Emby.Server.Implementations/Data/SqliteItemRepository.csindex a6119f1556..06704bafad 100644--- a/Emby.Server.Implementations/Data/SqliteItemRepository.cs+++ b/Emby.Server.Implementations/Data/SqliteItemRepository.cs@@ -3368,9 +3368,9 @@ namespace Emby.Server.Implementations.Data}}- if (query.SimilarTo != null)+ if (query.SimilarTo != null && query.MinSimilarityScore > 0){- whereClauses.Add("SimilarityScore > 0");+ whereClauses.Add("SimilarityScore > " + (query.MinSimilarityScore - 1).ToString(CultureInfo.InvariantCulture));}if (query.IsFolder.HasValue)diff --git a/Emby.Server.Implementations/Intros/DefaultIntroProvider.cs b/Emby.Server.Implementations/Intros/DefaultIntroProvider.csindex 180f6aba7f..90bb2f5c07 100644--- a/Emby.Server.Implementations/Intros/DefaultIntroProvider.cs+++ b/Emby.Server.Implementations/Intros/DefaultIntroProvider.cs@@ -100,7 +100,12 @@ namespace Emby.Server.Implementations.Introsif (trailerTypes.Count > 0){- var trailerResult = _libraryManager.GetItemList(new InternalItemsQuery+ if (trailerTypes.Count >= 5)+ {+ trailerTypes.Clear();+ }++ var trailerResult = _libraryManager.GetItemList(new InternalItemsQuery(user){IncludeItemTypes = new[] { typeof(Trailer).Name },TrailerTypes = trailerTypes.ToArray(),@@ -111,7 +116,8 @@ namespace Emby.Server.Implementations.Intros// Account for duplicates by imdb id, since the database doesn't support this yetLimit = config.TrailerLimit * 2,- SourceTypes = sourceTypes.ToArray()+ 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);diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.csindex 9e32fd1991..c8f49820ff 100644--- a/MediaBrowser.Controller/Entities/BaseItem.cs+++ b/MediaBrowser.Controller/Entities/BaseItem.cs@@ -53,6 +53,7 @@ namespace MediaBrowser.Controller.EntitiesImageInfos = new List<ItemImageInfo>();InheritedTags = new List<string>();ProductionLocations = new List<string>();+ SourceType = SourceType.Library;}public static readonly char[] SlugReplaceChars = { '?', '/', '&' };diff --git a/MediaBrowser.Controller/Entities/InternalItemsQuery.cs b/MediaBrowser.Controller/Entities/InternalItemsQuery.csindex 15af0888d5..f5af7d5c64 100644--- a/MediaBrowser.Controller/Entities/InternalItemsQuery.cs+++ b/MediaBrowser.Controller/Entities/InternalItemsQuery.cs@@ -160,6 +160,7 @@ namespace MediaBrowser.Controller.Entitiespublic DateTime? MinDateLastSaved { get; set; }public DtoOptions DtoOptions { get; set; }+ public int MinSimilarityScore { get; set; }public bool HasField(ItemFields name){@@ -197,6 +198,8 @@ namespace MediaBrowser.Controller.Entitiespublic InternalItemsQuery(){+ MinSimilarityScore = 1;+GroupByPresentationUniqueKey = true;EnableTotalRecordCount = true;