From 8a0606e9704f98e368cea4a1391b21fb7e2dec03 Mon Sep 17 00:00:00 2001 From: Luis Miguel Almánzar Date: Sat, 2 Nov 2013 21:19:33 -0400 Subject: strip only certain bracket blocks fixes #598 --- MediaBrowser.Server.Implementations/Library/ResolverHelper.cs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) (limited to 'MediaBrowser.Server.Implementations/Library/ResolverHelper.cs') diff --git a/MediaBrowser.Server.Implementations/Library/ResolverHelper.cs b/MediaBrowser.Server.Implementations/Library/ResolverHelper.cs index 96057f8b7..f9b051cd5 100644 --- a/MediaBrowser.Server.Implementations/Library/ResolverHelper.cs +++ b/MediaBrowser.Server.Implementations/Library/ResolverHelper.cs @@ -71,7 +71,7 @@ namespace MediaBrowser.Server.Implementations.Library /// /// The MB name regex /// - private static readonly Regex MBNameRegex = new Regex("(\\[.*\\])", RegexOptions.Compiled); + private static readonly Regex MBNameRegex = new Regex(@"(\[boxset\]|\[tmdbid=\d+\]|\[tvdbid=\d+\])", RegexOptions.Compiled); /// /// Strip out attribute items and return just the name we will use for items @@ -85,10 +85,15 @@ namespace MediaBrowser.Server.Implementations.Library var fn = isDirectory ? Path.GetFileName(path) : Path.GetFileNameWithoutExtension(path); //now - strip out anything inside brackets - fn = MBNameRegex.Replace(fn, string.Empty); + fn = StripBrackets(fn); return fn; } + public static string StripBrackets(string inputString) { + var output = MBNameRegex.Replace(inputString, string.Empty).Trim(); + return Regex.Replace(output, @"\s+", " "); + } + } } -- cgit v1.2.3