aboutsummaryrefslogtreecommitdiff
path: root/MediaBrowser.Server.Implementations
diff options
context:
space:
mode:
Diffstat (limited to 'MediaBrowser.Server.Implementations')
-rw-r--r--MediaBrowser.Server.Implementations/Library/CoreResolutionIgnoreRule.cs20
-rw-r--r--MediaBrowser.Server.Implementations/Library/LibraryManager.cs19
-rw-r--r--MediaBrowser.Server.Implementations/Library/ResolverHelper.cs2
-rw-r--r--MediaBrowser.Server.Implementations/Library/Resolvers/Audio/MusicArtistResolver.cs2
-rw-r--r--MediaBrowser.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs2
5 files changed, 26 insertions, 19 deletions
diff --git a/MediaBrowser.Server.Implementations/Library/CoreResolutionIgnoreRule.cs b/MediaBrowser.Server.Implementations/Library/CoreResolutionIgnoreRule.cs
index 612dc0d42..ebb79e96b 100644
--- a/MediaBrowser.Server.Implementations/Library/CoreResolutionIgnoreRule.cs
+++ b/MediaBrowser.Server.Implementations/Library/CoreResolutionIgnoreRule.cs
@@ -47,20 +47,30 @@ namespace MediaBrowser.Server.Implementations.Library
{
var parentFolderName = Path.GetFileName(Path.GetDirectoryName(args.Path));
- if (string.Equals(parentFolderName, BaseItem.ThemeSongsFolderName, StringComparison.OrdinalIgnoreCase) || string.Equals(parentFolderName, BaseItem.ThemeVideosFolderName, StringComparison.OrdinalIgnoreCase))
+ if (string.Equals(parentFolderName, BaseItem.ThemeSongsFolderName, StringComparison.OrdinalIgnoreCase))
+ {
+ return false;
+ }
+ if (string.Equals(parentFolderName, BaseItem.ThemeVideosFolderName, StringComparison.OrdinalIgnoreCase))
{
return false;
}
// Drives will sometimes be hidden
- if (args.Path.EndsWith(":\\", StringComparison.OrdinalIgnoreCase))
+ if (args.Path.EndsWith(Path.VolumeSeparatorChar + "\\", StringComparison.OrdinalIgnoreCase))
+ {
+ return false;
+ }
+
+ // Shares will sometimes be hidden
+ if (args.Path.StartsWith("\\", StringComparison.OrdinalIgnoreCase))
{
- if (new DriveInfo(args.Path).IsReady)
+ // Look for a share, e.g. \\server\movies
+ // Is there a better way to detect if a path is a share without using native code?
+ if (args.Path.Substring(2).Split(Path.DirectorySeparatorChar).Length == 2)
{
return false;
}
-
- _logger.Error("Operating system reports drive is not ready: {0}", args.Path);
}
return true;
diff --git a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs
index fb05c8c43..bc122ff6d 100644
--- a/MediaBrowser.Server.Implementations/Library/LibraryManager.cs
+++ b/MediaBrowser.Server.Implementations/Library/LibraryManager.cs
@@ -446,24 +446,21 @@ namespace MediaBrowser.Server.Implementations.Library
/// <summary>
/// Resolves a path into a BaseItem
/// </summary>
- /// <param name="path">The path.</param>
- /// <param name="parent">The parent.</param>
/// <param name="fileInfo">The file info.</param>
+ /// <param name="parent">The parent.</param>
/// <returns>BaseItem.</returns>
/// <exception cref="System.ArgumentNullException"></exception>
- public BaseItem ResolvePath(string path, Folder parent = null, FileSystemInfo fileInfo = null)
+ public BaseItem ResolvePath(FileSystemInfo fileInfo, Folder parent = null)
{
- if (string.IsNullOrEmpty(path))
+ if (fileInfo == null)
{
- throw new ArgumentNullException();
+ throw new ArgumentNullException("fileInfo");
}
- fileInfo = fileInfo ?? FileSystem.GetFileSystemInfo(path);
-
var args = new ItemResolveArgs(ConfigurationManager.ApplicationPaths)
{
Parent = parent,
- Path = path,
+ Path = fileInfo.FullName,
FileInfo = fileInfo
};
@@ -534,7 +531,7 @@ namespace MediaBrowser.Server.Implementations.Library
{
try
{
- var item = ResolvePath(f.FullName, parent, f) as T;
+ var item = ResolvePath(f, parent) as T;
if (item != null)
{
@@ -567,7 +564,7 @@ namespace MediaBrowser.Server.Implementations.Library
Directory.CreateDirectory(rootFolderPath);
}
- var rootFolder = RetrieveItem(rootFolderPath.GetMBId(typeof(AggregateFolder))) as AggregateFolder ?? (AggregateFolder)ResolvePath(rootFolderPath);
+ var rootFolder = RetrieveItem(rootFolderPath.GetMBId(typeof(AggregateFolder))) as AggregateFolder ?? (AggregateFolder)ResolvePath(new DirectoryInfo(rootFolderPath));
// Add in the plug-in folders
foreach (var child in PluginFolderCreators)
@@ -585,7 +582,7 @@ namespace MediaBrowser.Server.Implementations.Library
/// <returns>UserRootFolder.</returns>
public UserRootFolder GetUserRootFolder(string userRootPath)
{
- return _userRootFolders.GetOrAdd(userRootPath, key => RetrieveItem(userRootPath.GetMBId(typeof(UserRootFolder))) as UserRootFolder ?? (UserRootFolder)ResolvePath(userRootPath));
+ return _userRootFolders.GetOrAdd(userRootPath, key => RetrieveItem(userRootPath.GetMBId(typeof(UserRootFolder))) as UserRootFolder ?? (UserRootFolder)ResolvePath(new DirectoryInfo(userRootPath)));
}
/// <summary>
diff --git a/MediaBrowser.Server.Implementations/Library/ResolverHelper.cs b/MediaBrowser.Server.Implementations/Library/ResolverHelper.cs
index ef303008d..5a4e27108 100644
--- a/MediaBrowser.Server.Implementations/Library/ResolverHelper.cs
+++ b/MediaBrowser.Server.Implementations/Library/ResolverHelper.cs
@@ -56,7 +56,7 @@ namespace MediaBrowser.Server.Implementations.Library
if (string.IsNullOrEmpty(item.Name) && !string.IsNullOrEmpty(item.Path))
{
//we use our resolve args name here to get the name of the containg folder, not actual video file
- item.Name = GetMBName(item.ResolveArgs.FileInfo.Name, item.ResolveArgs.FileInfo.Attributes.HasFlag(FileAttributes.Directory));
+ item.Name = GetMBName(item.ResolveArgs.FileInfo.Name, (item.ResolveArgs.FileInfo.Attributes & FileAttributes.Directory) == FileAttributes.Directory);
}
}
diff --git a/MediaBrowser.Server.Implementations/Library/Resolvers/Audio/MusicArtistResolver.cs b/MediaBrowser.Server.Implementations/Library/Resolvers/Audio/MusicArtistResolver.cs
index 60a262fab..fa34a6a2e 100644
--- a/MediaBrowser.Server.Implementations/Library/Resolvers/Audio/MusicArtistResolver.cs
+++ b/MediaBrowser.Server.Implementations/Library/Resolvers/Audio/MusicArtistResolver.cs
@@ -40,7 +40,7 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Audio
}
// If we contain an album assume we are an artist folder
- return args.FileSystemChildren.Where(i => i.Attributes.HasFlag(FileAttributes.Directory)).Any(i => MusicAlbumResolver.IsMusicAlbum(i.FullName)) ? new MusicArtist() : null;
+ return args.FileSystemChildren.Where(i => (i.Attributes & FileAttributes.Directory) == FileAttributes.Directory).Any(i => MusicAlbumResolver.IsMusicAlbum(i.FullName)) ? new MusicArtist() : null;
}
}
diff --git a/MediaBrowser.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs b/MediaBrowser.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs
index f54c78f35..a21c15f4f 100644
--- a/MediaBrowser.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs
+++ b/MediaBrowser.Server.Implementations/Library/Resolvers/Movies/MovieResolver.cs
@@ -135,7 +135,7 @@ namespace MediaBrowser.Server.Implementations.Library.Resolvers.Movies
// Loop through each child file/folder and see if we find a video
foreach (var child in args.FileSystemChildren)
{
- if (child.Attributes.HasFlag(FileAttributes.Directory))
+ if ((child.Attributes & FileAttributes.Directory) == FileAttributes.Directory)
{
if (IsDvdDirectory(child.Name))
{