aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Api/Library/LibraryStructureService.cs
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.Api/Library/LibraryStructureService.cs')
-rw-r--r--MediaBrowser.Api/Library/LibraryStructureService.cs17
1 files changed, 10 insertions, 7 deletions
diff --git a/MediaBrowser.Api/Library/LibraryStructureService.cs b/MediaBrowser.Api/Library/LibraryStructureService.cs
index e6fa1d1c0..a5476ec8b 100644
--- a/MediaBrowser.Api/Library/LibraryStructureService.cs
+++ b/MediaBrowser.Api/Library/LibraryStructureService.cs
@@ -186,6 +186,8 @@ namespace MediaBrowser.Api.Library
private readonly IDirectoryWatchers _directoryWatchers;
+ private readonly IFileSystem _fileSystem;
+
/// <summary>
/// Initializes a new instance of the <see cref="LibraryStructureService"/> class.
/// </summary>
@@ -193,7 +195,7 @@ namespace MediaBrowser.Api.Library
/// <param name="userManager">The user manager.</param>
/// <param name="libraryManager">The library manager.</param>
/// <exception cref="System.ArgumentNullException">appPaths</exception>
- public LibraryStructureService(IServerApplicationPaths appPaths, IUserManager userManager, ILibraryManager libraryManager, IDirectoryWatchers directoryWatchers)
+ public LibraryStructureService(IServerApplicationPaths appPaths, IUserManager userManager, ILibraryManager libraryManager, IDirectoryWatchers directoryWatchers, IFileSystem fileSystem)
{
if (appPaths == null)
{
@@ -204,6 +206,7 @@ namespace MediaBrowser.Api.Library
_appPaths = appPaths;
_libraryManager = libraryManager;
_directoryWatchers = directoryWatchers;
+ _fileSystem = fileSystem;
}
/// <summary>
@@ -241,13 +244,13 @@ namespace MediaBrowser.Api.Library
{
if (string.IsNullOrEmpty(request.UserId))
{
- LibraryHelpers.AddVirtualFolder(request.Name, request.CollectionType, null, _appPaths);
+ LibraryHelpers.AddVirtualFolder(_fileSystem, request.Name, request.CollectionType, null, _appPaths);
}
else
{
var user = _userManager.GetUserById(new Guid(request.UserId));
- LibraryHelpers.AddVirtualFolder(request.Name, request.CollectionType, user, _appPaths);
+ LibraryHelpers.AddVirtualFolder(_fileSystem, request.Name, request.CollectionType, user, _appPaths);
}
// Need to add a delay here or directory watchers may still pick up the changes
@@ -352,13 +355,13 @@ namespace MediaBrowser.Api.Library
{
if (string.IsNullOrEmpty(request.UserId))
{
- LibraryHelpers.AddMediaPath(request.Name, request.Path, null, _appPaths);
+ LibraryHelpers.AddMediaPath(_fileSystem, request.Name, request.Path, null, _appPaths);
}
else
{
var user = _userManager.GetUserById(new Guid(request.UserId));
- LibraryHelpers.AddMediaPath(request.Name, request.Path, user, _appPaths);
+ LibraryHelpers.AddMediaPath(_fileSystem, request.Name, request.Path, user, _appPaths);
}
// Need to add a delay here or directory watchers may still pick up the changes
@@ -389,13 +392,13 @@ namespace MediaBrowser.Api.Library
{
if (string.IsNullOrEmpty(request.UserId))
{
- LibraryHelpers.RemoveMediaPath(request.Name, request.Path, null, _appPaths);
+ LibraryHelpers.RemoveMediaPath(_fileSystem, request.Name, request.Path, null, _appPaths);
}
else
{
var user = _userManager.GetUserById(new Guid(request.UserId));
- LibraryHelpers.RemoveMediaPath(request.Name, request.Path, user, _appPaths);
+ LibraryHelpers.RemoveMediaPath(_fileSystem, request.Name, request.Path, user, _appPaths);
}
// Need to add a delay here or directory watchers may still pick up the changes