From 049ef9b4ecd2c884e0ddb062b606770ef7f2dfa9 Mon Sep 17 00:00:00 2001 From: Luke Pulverenti Date: Sun, 16 Nov 2014 17:46:01 -0500 Subject: update naming methods --- MediaBrowser.Controller/Providers/NameParser.cs | 39 ------------------------- 1 file changed, 39 deletions(-) delete mode 100644 MediaBrowser.Controller/Providers/NameParser.cs (limited to 'MediaBrowser.Controller/Providers') diff --git a/MediaBrowser.Controller/Providers/NameParser.cs b/MediaBrowser.Controller/Providers/NameParser.cs deleted file mode 100644 index cdd0974eac..0000000000 --- a/MediaBrowser.Controller/Providers/NameParser.cs +++ /dev/null @@ -1,39 +0,0 @@ -using System; -using System.Text.RegularExpressions; - -namespace MediaBrowser.Controller.Providers -{ - public static class NameParser - { - static readonly Regex[] NameMatches = - { - new Regex(@"(?.*)\((?\d{4})\)"), // matches "My Movie (2001)" and gives us the name and the year - new Regex(@"(?.*)(\.(?\d{4})(\.|$)).*$"), - new Regex(@"(?.*)") // last resort matches the whole string as the name - }; - - /// - /// Parses the name. - /// - /// The name. - /// Name of the just. - /// The year. - public static void ParseName(string name, out string justName, out int? year) - { - justName = null; - year = null; - foreach (var re in NameMatches) - { - Match m = re.Match(name); - if (m.Success) - { - justName = m.Groups["name"].Value.Trim(); - string y = m.Groups["year"] != null ? m.Groups["year"].Value : null; - int temp; - year = Int32.TryParse(y, out temp) ? temp : (int?)null; - break; - } - } - } - } -} -- cgit v1.2.3