diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2014-11-29 14:51:30 -0500 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2014-11-29 14:51:30 -0500 |
| commit | 999ad78a0d899c4b9a441933ff68843b0ae3e0a9 (patch) | |
| tree | 63d2bbc8504595b1c47e36f5e3c16e3fc51b671e /MediaBrowser.Server.Implementations/Library/ResolverHelper.cs | |
| parent | aaac7e4208a1098bccdc5a7d4c939ef30a3a1e9f (diff) | |
rework configurations
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+", " "); } - } } |
