mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-04-21 01:24:44 +01:00
fixed issue of not seeing network shares
This commit is contained in:
@@ -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))
|
||||
{
|
||||
if (new DriveInfo(args.Path).IsReady)
|
||||
return false;
|
||||
}
|
||||
|
||||
// Shares will sometimes be hidden
|
||||
if (args.Path.StartsWith("\\", StringComparison.OrdinalIgnoreCase))
|
||||
{
|
||||
// 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;
|
||||
|
||||
@@ -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>
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -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))
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user