diff --git a/MediaBrowser.Controller/IO/FileData.cs b/MediaBrowser.Controller/IO/FileData.cs index 8896d4fc1f..53dde4f5cf 100644 --- a/MediaBrowser.Controller/IO/FileData.cs +++ b/MediaBrowser.Controller/IO/FileData.cs @@ -37,14 +37,16 @@ namespace MediaBrowser.Controller.IO { var isDirectory = (entry.Attributes & FileAttributes.Directory) == FileAttributes.Directory; - if (resolveShortcuts && FileSystem.IsShortcut(entry.FullName)) + var fullName = entry.FullName; + + if (resolveShortcuts && FileSystem.IsShortcut(fullName)) { - var newPath = FileSystem.ResolveShortcut(entry.FullName); + var newPath = FileSystem.ResolveShortcut(fullName); if (string.IsNullOrWhiteSpace(newPath)) { //invalid shortcut - could be old or target could just be unavailable - logger.Warn("Encountered invalid shortcut: " + entry.FullName); + logger.Warn("Encountered invalid shortcut: " + fullName); continue; } @@ -57,18 +59,18 @@ namespace MediaBrowser.Controller.IO args.AddAdditionalLocation(newPath); } - dict[data.FullName] = data; + dict[newPath] = data; } else if (flattenFolderDepth > 0 && isDirectory) { - foreach (var child in GetFilteredFileSystemEntries(entry.FullName, logger, flattenFolderDepth: flattenFolderDepth - 1, resolveShortcuts: resolveShortcuts)) + foreach (var child in GetFilteredFileSystemEntries(fullName, logger, flattenFolderDepth: flattenFolderDepth - 1, resolveShortcuts: resolveShortcuts)) { dict[child.Key] = child.Value; } } else { - dict[entry.FullName] = entry; + dict[fullName] = entry; } } diff --git a/MediaBrowser.Controller/Library/ItemResolveArgs.cs b/MediaBrowser.Controller/Library/ItemResolveArgs.cs index 9ca2b6ad5a..109ffe7e7e 100644 --- a/MediaBrowser.Controller/Library/ItemResolveArgs.cs +++ b/MediaBrowser.Controller/Library/ItemResolveArgs.cs @@ -112,7 +112,7 @@ namespace MediaBrowser.Controller.Library return false; } - var parentDir = System.IO.Path.GetDirectoryName(FileInfo.FullName) ?? string.Empty; + var parentDir = System.IO.Path.GetDirectoryName(Path) ?? string.Empty; return (parentDir.Length > _appPaths.RootFolderPath.Length && parentDir.StartsWith(_appPaths.RootFolderPath, StringComparison.OrdinalIgnoreCase)); diff --git a/MediaBrowser.Controller/Library/TVUtils.cs b/MediaBrowser.Controller/Library/TVUtils.cs index 921bbb808f..03df934cf9 100644 --- a/MediaBrowser.Controller/Library/TVUtils.cs +++ b/MediaBrowser.Controller/Library/TVUtils.cs @@ -179,7 +179,7 @@ namespace MediaBrowser.Controller.Library private static bool IsSeasonFolder(string path) { // It's a season folder if it's named as such and does not contain any audio files, apart from theme.mp3 - return GetSeasonNumberFromPath(path) != null && !new DirectoryInfo(path).EnumerateFiles().Any(i => EntityResolutionHelper.IsAudioFile(i.FullName) && !string.Equals(Path.GetFileNameWithoutExtension(i.Name), BaseItem.ThemeSongFilename)); + return GetSeasonNumberFromPath(path) != null && !Directory.EnumerateFiles(path).Any(i => EntityResolutionHelper.IsAudioFile(i) && !string.Equals(Path.GetFileNameWithoutExtension(i), BaseItem.ThemeSongFilename)); } /// @@ -223,7 +223,9 @@ namespace MediaBrowser.Controller.Library } else { - if (EntityResolutionHelper.IsVideoFile(child.FullName) && GetEpisodeNumberFromFile(child.FullName, false).HasValue) + var fullName = child.FullName; + + if (EntityResolutionHelper.IsVideoFile(fullName) && GetEpisodeNumberFromFile(fullName, false).HasValue) { return true; } @@ -275,7 +277,7 @@ namespace MediaBrowser.Controller.Library } private static readonly CultureInfo UsCulture = new CultureInfo("en-US"); - + private static int? ParseEpisodeNumber(string val) { int num;