diff options
Diffstat (limited to 'MediaBrowser.Server.Implementations/Library/ResolverHelper.cs')
| -rw-r--r-- | MediaBrowser.Server.Implementations/Library/ResolverHelper.cs | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/MediaBrowser.Server.Implementations/Library/ResolverHelper.cs b/MediaBrowser.Server.Implementations/Library/ResolverHelper.cs index b9fbd6f8c..92c837932 100644 --- a/MediaBrowser.Server.Implementations/Library/ResolverHelper.cs +++ b/MediaBrowser.Server.Implementations/Library/ResolverHelper.cs @@ -56,43 +56,40 @@ namespace MediaBrowser.Server.Implementations.Library /// Ensures the name. /// </summary> /// <param name="item">The item.</param> + /// <param name="args">The arguments.</param> private static void EnsureName(BaseItem item, ItemResolveArgs args) { // If the subclass didn't supply a name, add it here 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(args.FileInfo.Name, (args.FileInfo.Attributes & FileAttributes.Directory) == FileAttributes.Directory); + item.Name = GetDisplayName(args.FileInfo.Name, (args.FileInfo.Attributes & FileAttributes.Directory) == FileAttributes.Directory); } } /// <summary> - /// The MB name regex - /// </summary> - private static readonly Regex MbNameRegex = new Regex(@"(\[.*?\])", RegexOptions.Compiled); - - /// <summary> - /// Strip out attribute items and return just the name we will use for items + /// Gets the display name. /// </summary> - /// <param name="path">Assumed to be a file or directory path</param> + /// <param name="path">The path.</param> /// <param name="isDirectory">if set to <c>true</c> [is directory].</param> - /// <returns>The cleaned name</returns> - private static string GetMbName(string path, bool isDirectory) + /// <returns>System.String.</returns> + private static string GetDisplayName(string path, bool isDirectory) { //first just get the file or directory name var fn = isDirectory ? Path.GetFileName(path) : Path.GetFileNameWithoutExtension(path); - //now - strip out anything inside brackets - fn = StripBrackets(fn); - return fn; } - private static string StripBrackets(string inputString) + /// <summary> + /// The MB name regex + /// </summary> + private static readonly Regex MbNameRegex = new Regex(@"(\[.*?\])", RegexOptions.Compiled); + + internal static string StripBrackets(string inputString) { var output = MbNameRegex.Replace(inputString, string.Empty).Trim(); return Regex.Replace(output, @"\s+", " "); } - } } |
