diff options
| author | Luke Pulverenti <luke.pulverenti@gmail.com> | 2014-11-16 17:46:01 -0500 |
|---|---|---|
| committer | Luke Pulverenti <luke.pulverenti@gmail.com> | 2014-11-16 17:46:01 -0500 |
| commit | 049ef9b4ecd2c884e0ddb062b606770ef7f2dfa9 (patch) | |
| tree | 13bb922d8203bcb8e9abb4d9dc2272e2d425bad6 /MediaBrowser.Controller/Providers | |
| parent | 5fdd7ec6725a3acb3365e92c090f2e90bbbf122f (diff) | |
update naming methods
Diffstat (limited to 'MediaBrowser.Controller/Providers')
| -rw-r--r-- | MediaBrowser.Controller/Providers/NameParser.cs | 39 |
1 files changed, 0 insertions, 39 deletions
diff --git a/MediaBrowser.Controller/Providers/NameParser.cs b/MediaBrowser.Controller/Providers/NameParser.cs deleted file mode 100644 index cdd0974ea..000000000 --- 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(@"(?<name>.*)\((?<year>\d{4})\)"), // matches "My Movie (2001)" and gives us the name and the year - new Regex(@"(?<name>.*)(\.(?<year>\d{4})(\.|$)).*$"), - new Regex(@"(?<name>.*)") // last resort matches the whole string as the name - }; - - /// <summary> - /// Parses the name. - /// </summary> - /// <param name="name">The name.</param> - /// <param name="justName">Name of the just.</param> - /// <param name="year">The year.</param> - 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; - } - } - } - } -} |
