diff --git a/MediaBrowser.Api/ApiService.cs b/MediaBrowser.Api/ApiService.cs index f706a97c9..b8c4b96d9 100644 --- a/MediaBrowser.Api/ApiService.cs +++ b/MediaBrowser.Api/ApiService.cs @@ -116,7 +116,7 @@ namespace MediaBrowser.Api dto.SpecialCounts = folder.GetSpecialCounts(user); dto.IsRoot = folder.IsRoot; - dto.IsVirtualFolder = folder.Parent != null && folder.Parent.IsRoot; + dto.IsVirtualFolder = folder.IsVirtualFolder; } Audio audio = item as Audio; diff --git a/MediaBrowser.Model/Entities/Folder.cs b/MediaBrowser.Model/Entities/Folder.cs index 4ea3afea3..ed3a38088 100644 --- a/MediaBrowser.Model/Entities/Folder.cs +++ b/MediaBrowser.Model/Entities/Folder.cs @@ -16,6 +16,14 @@ namespace MediaBrowser.Model.Entities public bool IsRoot { get; set; } + public bool IsVirtualFolder + { + get + { + return Parent != null && Parent.IsRoot; + } + } + public IEnumerable Children { get; set; } /// diff --git a/MediaBrowser.Movies/Resolvers/MovieResolver.cs b/MediaBrowser.Movies/Resolvers/MovieResolver.cs index b343e21e4..527359cfe 100644 --- a/MediaBrowser.Movies/Resolvers/MovieResolver.cs +++ b/MediaBrowser.Movies/Resolvers/MovieResolver.cs @@ -24,6 +24,12 @@ namespace MediaBrowser.Movies.Resolvers } } + // Optimization to avoid running all these tests against VF's + if (args.Parent != null && args.Parent.IsVirtualFolder) + { + return null; + } + // Return a movie if the video resolver finds something in the folder return GetMovie(args); } diff --git a/MediaBrowser.TV/Resolvers/SeriesResolver.cs b/MediaBrowser.TV/Resolvers/SeriesResolver.cs index 9e9a67fae..32bcdec4b 100644 --- a/MediaBrowser.TV/Resolvers/SeriesResolver.cs +++ b/MediaBrowser.TV/Resolvers/SeriesResolver.cs @@ -15,6 +15,12 @@ namespace MediaBrowser.TV.Resolvers { if (args.IsDirectory) { + // Optimization to avoid running all these tests against VF's + if (args.Parent != null && args.Parent.IsVirtualFolder) + { + return null; + } + // Optimization to avoid running these tests against Seasons if (args.Parent is Series) {