diff options
| author | Luke <luke.pulverenti@gmail.com> | 2015-10-26 18:50:19 -0400 |
|---|---|---|
| committer | Luke <luke.pulverenti@gmail.com> | 2015-10-26 18:50:19 -0400 |
| commit | 35778ebc02e5931142a1fe31a256b7488a07c5c2 (patch) | |
| tree | ced0290be8820f5e507b51ca4c5165212b1879d1 /MediaBrowser.Server.Implementations/Intros/DefaultIntroProvider.cs | |
| parent | c0dc8d055bfd4d2f58591083beb9e9128357aad6 (diff) | |
| parent | 8d77308593c3b16b733b0109323770d9dfe7e166 (diff) | |
Merge pull request #1222 from MediaBrowser/dev
3.0.5768.7
Diffstat (limited to 'MediaBrowser.Server.Implementations/Intros/DefaultIntroProvider.cs')
| -rw-r--r-- | MediaBrowser.Server.Implementations/Intros/DefaultIntroProvider.cs | 20 |
1 files changed, 16 insertions, 4 deletions
diff --git a/MediaBrowser.Server.Implementations/Intros/DefaultIntroProvider.cs b/MediaBrowser.Server.Implementations/Intros/DefaultIntroProvider.cs index db9841f9d..ec94e16db 100644 --- a/MediaBrowser.Server.Implementations/Intros/DefaultIntroProvider.cs +++ b/MediaBrowser.Server.Implementations/Intros/DefaultIntroProvider.cs @@ -15,6 +15,8 @@ using System.IO; using System.Linq; using System.Threading; using System.Threading.Tasks; +using CommonIO; +using MediaBrowser.Common.IO; namespace MediaBrowser.Server.Implementations.Intros { @@ -25,14 +27,16 @@ namespace MediaBrowser.Server.Implementations.Intros private readonly ILocalizationManager _localization; private readonly IConfigurationManager _serverConfig; private readonly ILibraryManager _libraryManager; + private readonly IFileSystem _fileSystem; - public DefaultIntroProvider(ISecurityManager security, IChannelManager channelManager, ILocalizationManager localization, IConfigurationManager serverConfig, ILibraryManager libraryManager) + public DefaultIntroProvider(ISecurityManager security, IChannelManager channelManager, ILocalizationManager localization, IConfigurationManager serverConfig, ILibraryManager libraryManager, IFileSystem fileSystem) { _security = security; _channelManager = channelManager; _localization = localization; _serverConfig = serverConfig; _libraryManager = libraryManager; + _fileSystem = fileSystem; } public async Task<IEnumerable<IntroInfo>> GetIntros(BaseItem item, User user) @@ -79,8 +83,16 @@ namespace MediaBrowser.Server.Implementations.Intros if (config.EnableIntrosFromMoviesInLibrary) { - var itemsWithTrailers = user.RootFolder - .GetRecursiveChildren(user, i => + var inputItems = _libraryManager.GetItems(new InternalItemsQuery + { + IncludeItemTypes = new[] { typeof(Movie).Name }, + + User = user + + }).Items; + + var itemsWithTrailers = inputItems + .Where(i => { var hasTrailers = i as IHasTrailers; @@ -232,7 +244,7 @@ namespace MediaBrowser.Server.Implementations.Intros return new List<string>(); } - return Directory.EnumerateFiles(options.CustomIntroPath, "*", SearchOption.AllDirectories) + return _fileSystem.GetFilePaths(options.CustomIntroPath, true) .Where(_libraryManager.IsVideoFile); } |
