From 809e4629c09821e7373bff79e0d0be86df11ce2c Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Tue, 26 Aug 2014 23:25:39 -0400 Subject: update translations --- .../Resolvers/EntityResolutionHelper.cs | 41 +++++++++++++++++++++- 1 file changed, 40 insertions(+), 1 deletion(-) (limited to 'MediaBrowser.Controller/Resolvers/EntityResolutionHelper.cs') diff --git a/MediaBrowser.Controller/Resolvers/EntityResolutionHelper.cs b/MediaBrowser.Controller/Resolvers/EntityResolutionHelper.cs index ff94ceff3..7c68448e5 100644 --- a/MediaBrowser.Controller/Resolvers/EntityResolutionHelper.cs +++ b/MediaBrowser.Controller/Resolvers/EntityResolutionHelper.cs @@ -1,4 +1,5 @@ -using MediaBrowser.Common.IO; +using System.Globalization; +using MediaBrowser.Common.IO; using MediaBrowser.Controller.Entities; using MediaBrowser.Controller.Library; using System; @@ -188,6 +189,44 @@ namespace MediaBrowser.Controller.Resolvers return string.Equals(extension, ".disc", StringComparison.OrdinalIgnoreCase); } + /// + /// Determines whether [is multi disc album folder] [the specified path]. + /// + /// The path. + /// true if [is multi disc album folder] [the specified path]; otherwise, false. + public static bool IsMultiDiscAlbumFolder(string path) + { + var filename = Path.GetFileName(path); + + if (string.IsNullOrWhiteSpace(filename)) + { + return false; + } + + // Normalize + // Remove whitespace + filename = filename.Replace("-", string.Empty); + filename = Regex.Replace(filename, @"\s+", ""); + + var prefixes = new[] { "disc", "cd", "disk" }; + + foreach (var prefix in prefixes) + { + if (filename.IndexOf(prefix, StringComparison.OrdinalIgnoreCase) == 0) + { + var tmp = filename.Substring(prefix.Length); + + int val; + if (int.TryParse(tmp, NumberStyles.Any, CultureInfo.InvariantCulture, out val)) + { + return true; + } + } + } + + return false; + } + /// /// Ensures DateCreated and DateModified have values /// -- cgit v1.2.3