From 450f246f959f55bdc0b63f78141e7397891c4210 Mon Sep 17 00:00:00 2001 From: Erwin de Haan Date: Sat, 26 Jan 2019 23:23:43 +0100 Subject: [PATCH] Unwrapped `GetFileNameWithoutExtension` --- MediaBrowser.Controller/Entities/BaseItem.cs | 2 +- .../Images/EpisodeLocalImageProvider.cs | 2 +- MediaBrowser.Providers/Manager/ImageSaver.cs | 8 ++++---- MediaBrowser.Providers/MediaInfo/SubtitleResolver.cs | 4 ++-- MediaBrowser.Providers/Subtitles/SubtitleManager.cs | 2 +- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/MediaBrowser.Controller/Entities/BaseItem.cs b/MediaBrowser.Controller/Entities/BaseItem.cs index ab9458187..34ae446c7 100644 --- a/MediaBrowser.Controller/Entities/BaseItem.cs +++ b/MediaBrowser.Controller/Entities/BaseItem.cs @@ -2509,7 +2509,7 @@ namespace MediaBrowser.Controller.Entities if (string.IsNullOrEmpty(Name) && !string.IsNullOrEmpty(Path)) { - Name = FileSystem.GetFileNameWithoutExtension(Path); + Name = System.IO.Path.GetFileNameWithoutExtension(Path); hasChanges = true; } diff --git a/MediaBrowser.LocalMetadata/Images/EpisodeLocalImageProvider.cs b/MediaBrowser.LocalMetadata/Images/EpisodeLocalImageProvider.cs index 16f280982..443f3fbb5 100644 --- a/MediaBrowser.LocalMetadata/Images/EpisodeLocalImageProvider.cs +++ b/MediaBrowser.LocalMetadata/Images/EpisodeLocalImageProvider.cs @@ -34,7 +34,7 @@ namespace MediaBrowser.LocalMetadata.Images var parentPathFiles = directoryService.GetFiles(parentPath); - var nameWithoutExtension = _fileSystem.GetFileNameWithoutExtension(item.Path); + var nameWithoutExtension = Path.GetFileNameWithoutExtension(item.Path); return GetFilesFromParentFolder(nameWithoutExtension, parentPathFiles); } diff --git a/MediaBrowser.Providers/Manager/ImageSaver.cs b/MediaBrowser.Providers/Manager/ImageSaver.cs index 802e02f78..dee473374 100644 --- a/MediaBrowser.Providers/Manager/ImageSaver.cs +++ b/MediaBrowser.Providers/Manager/ImageSaver.cs @@ -411,7 +411,7 @@ namespace MediaBrowser.Providers.Manager filename = item is MusicAlbum ? "cdart" : "disc"; break; case ImageType.Primary: - filename = saveLocally && item is Episode ? _fileSystem.GetFileNameWithoutExtension(item.Path) : folderName; + filename = saveLocally && item is Episode ? Path.GetFileNameWithoutExtension(item.Path) : folderName; break; case ImageType.Backdrop: filename = GetBackdropSaveFilename(item.GetImages(type), "backdrop", "backdrop", imageIndex); @@ -471,7 +471,7 @@ namespace MediaBrowser.Providers.Manager return zeroIndexFilename; } - var filenames = images.Select(i => _fileSystem.GetFileNameWithoutExtension(i.Path)).ToList(); + var filenames = images.Select(i => Path.GetFileNameWithoutExtension(i.Path)).ToList(); var current = 1; while (filenames.Contains(numberedIndexPrefix + current.ToString(UsCulture), StringComparer.OrdinalIgnoreCase)) @@ -571,7 +571,7 @@ namespace MediaBrowser.Providers.Manager { var seasonFolder = Path.GetDirectoryName(item.Path); - var imageFilename = _fileSystem.GetFileNameWithoutExtension(item.Path) + "-thumb" + extension; + var imageFilename = Path.GetFileNameWithoutExtension(item.Path) + "-thumb" + extension; return new[] { Path.Combine(seasonFolder, imageFilename) }; } @@ -619,7 +619,7 @@ namespace MediaBrowser.Providers.Manager } var folder = Path.GetDirectoryName(item.Path); - return Path.Combine(folder, _fileSystem.GetFileNameWithoutExtension(item.Path) + "-" + imageFilename + extension); + return Path.Combine(folder, Path.GetFileNameWithoutExtension(item.Path) + "-" + imageFilename + extension); } } } diff --git a/MediaBrowser.Providers/MediaInfo/SubtitleResolver.cs b/MediaBrowser.Providers/MediaInfo/SubtitleResolver.cs index 2ce10b656..b6f862f9a 100644 --- a/MediaBrowser.Providers/MediaInfo/SubtitleResolver.cs +++ b/MediaBrowser.Providers/MediaInfo/SubtitleResolver.cs @@ -98,7 +98,7 @@ namespace MediaBrowser.Providers.MediaInfo int startIndex, string[] files) { - var videoFileNameWithoutExtension = _fileSystem.GetFileNameWithoutExtension(videoPath); + var videoFileNameWithoutExtension = Path.GetFileNameWithoutExtension(videoPath); videoFileNameWithoutExtension = NormalizeFilenameForSubtitleComparison(videoFileNameWithoutExtension); foreach (var fullName in files) @@ -110,7 +110,7 @@ namespace MediaBrowser.Providers.MediaInfo continue; } - var fileNameWithoutExtension = _fileSystem.GetFileNameWithoutExtension(fullName); + var fileNameWithoutExtension = Path.GetFileNameWithoutExtension(fullName); fileNameWithoutExtension = NormalizeFilenameForSubtitleComparison(fileNameWithoutExtension); if (!string.Equals(videoFileNameWithoutExtension, fileNameWithoutExtension, StringComparison.OrdinalIgnoreCase) && diff --git a/MediaBrowser.Providers/Subtitles/SubtitleManager.cs b/MediaBrowser.Providers/Subtitles/SubtitleManager.cs index 4cec8b4a9..138794b7c 100644 --- a/MediaBrowser.Providers/Subtitles/SubtitleManager.cs +++ b/MediaBrowser.Providers/Subtitles/SubtitleManager.cs @@ -168,7 +168,7 @@ namespace MediaBrowser.Providers.Subtitles memoryStream.Position = 0; var savePaths = new List(); - var saveFileName = _fileSystem.GetFileNameWithoutExtension(video.Path) + "." + response.Language.ToLower(); + var saveFileName = Path.GetFileNameWithoutExtension(video.Path) + "." + response.Language.ToLower(); if (response.IsForced) {