mirror of
https://github.com/jellyfin/jellyfin.git
synced 2026-03-21 01:26:41 +00:00
strip only certain bracket blocks fixes #598
This commit is contained in:
@@ -71,7 +71,7 @@ namespace MediaBrowser.Server.Implementations.Library
|
||||
/// <summary>
|
||||
/// The MB name regex
|
||||
/// </summary>
|
||||
private static readonly Regex MBNameRegex = new Regex("(\\[.*\\])", RegexOptions.Compiled);
|
||||
private static readonly Regex MBNameRegex = new Regex(@"(\[boxset\]|\[tmdbid=\d+\]|\[tvdbid=\d+\])", RegexOptions.Compiled);
|
||||
|
||||
/// <summary>
|
||||
/// 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+", " ");
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user