From eec9e0482525c400e9dc7cb17bc000434adba105 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Thu, 13 Feb 2014 00:11:54 -0500 Subject: take photos into the core --- .../Library/LibraryManager.cs | 24 ++++++++++++---------- 1 file changed, 13 insertions(+), 11 deletions(-) (limited to 'MediaBrowser.Server.Implementations/Library/LibraryManager.cs') diff --git a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs index 735565e25..b42541204 100644 --- a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs +++ b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs @@ -462,21 +462,27 @@ namespace MediaBrowser.Server.Implementations.Library return item; } + public BaseItem ResolvePath(FileSystemInfo fileInfo, Folder parent = null) + { + return ResolvePath(fileInfo, new DirectoryService(_logger), parent); + } + /// /// Resolves a path into a BaseItem /// /// The file info. + /// The directory service. /// The parent. /// BaseItem. - /// - public BaseItem ResolvePath(FileSystemInfo fileInfo, Folder parent = null) + /// fileInfo + public BaseItem ResolvePath(FileSystemInfo fileInfo, IDirectoryService directoryService, Folder parent = null) { if (fileInfo == null) { throw new ArgumentNullException("fileInfo"); } - var args = new ItemResolveArgs(ConfigurationManager.ApplicationPaths, this) + var args = new ItemResolveArgs(ConfigurationManager.ApplicationPaths, this, directoryService) { Parent = parent, Path = fileInfo.FullName, @@ -497,8 +503,6 @@ namespace MediaBrowser.Server.Implementations.Library // When resolving the root, we need it's grandchildren (children of user views) var flattenFolderDepth = isPhysicalRoot ? 2 : 0; - var directoryService = new DirectoryService(_logger); - var fileSystemDictionary = FileData.GetFilteredFileSystemEntries(directoryService, args.Path, _fileSystem, _logger, args, flattenFolderDepth: flattenFolderDepth, resolveShortcuts: isPhysicalRoot || args.IsVf); // Need to remove subpaths that may have been resolved from shortcuts @@ -555,9 +559,10 @@ namespace MediaBrowser.Server.Implementations.Library /// /// /// The files. + /// The directory service. /// The parent. /// List{``0}. - public List ResolvePaths(IEnumerable files, Folder parent) + public List ResolvePaths(IEnumerable files, IDirectoryService directoryService, Folder parent) where T : BaseItem { var list = new List(); @@ -566,7 +571,7 @@ namespace MediaBrowser.Server.Implementations.Library { try { - var item = ResolvePath(f, parent) as T; + var item = ResolvePath(f, directoryService, parent) as T; if (item != null) { @@ -594,10 +599,7 @@ namespace MediaBrowser.Server.Implementations.Library { var rootFolderPath = ConfigurationManager.ApplicationPaths.RootFolderPath; - if (!Directory.Exists(rootFolderPath)) - { - Directory.CreateDirectory(rootFolderPath); - } + Directory.CreateDirectory(rootFolderPath); var rootFolder = RetrieveItem(rootFolderPath.GetMBId(typeof(AggregateFolder))) as AggregateFolder ?? (AggregateFolder)ResolvePath(new DirectoryInfo(rootFolderPath)); -- cgit v1.2.3