private static bool _TryParseShow(string name, out NiceName result, string releaser = null, string resolution = null) { Match match = null; foreach (var regex in seriesregs) { match = regex.Match(name); if (match.Success) { break; } } if (match == null || !match.Success) { result = null; return(false); } var season = 0; var episode = 0; var nicename = string.Empty; if (!string.IsNullOrEmpty(match.Groups["title"].Value)) { nicename = match.Groups["title"].Value; } else { Trace.WriteLine(name); Trace.WriteLine("ERROR PARSING " + match.Groups["title"].Value); } if (!string.IsNullOrEmpty(match.Groups["season"].Value)) { if (!int.TryParse(match.Groups["season"].Value, out season)) { Trace.WriteLine(name); Trace.WriteLine("ERROR PARSING " + match.Groups["season"].Value); } } if (!string.IsNullOrEmpty(match.Groups["episode"].Value)) { if (!int.TryParse(match.Groups["episode"].Value, out episode)) { Trace.WriteLine(name); Trace.WriteLine("ERROR PARSING " + match.Groups["episode"].Value); } } result = new NiceSeriesName { Name = cleanstr.Replace(nicename.StemNameBase(), string.Empty), Episode = episode, Season = season, Resolution = resolution, Releaser = releaser }; return(true); }
private static bool _TryParseMove(string name, out NiceName result, string releaserText, string resolutionText) { Match match = null; foreach (var regex in movieclear) { match = regex.Match(name); if (match.Success) { break; } } if (match == null || !match.Success) { result = null; return(false); } var nicename = string.Empty; var year = 0; if (!string.IsNullOrEmpty(match.Groups["title"].Value)) { nicename = match.Groups["title"].Value; } else { Trace.WriteLine(name); Trace.WriteLine("ERROR PARSING " + match.Groups["title"].Value); } if (!string.IsNullOrEmpty(match.Groups["year"].Value)) { year = int.Parse(match.Groups["year"].Value); } else { Trace.WriteLine(name); Trace.WriteLine("ERROR PARSING " + match.Groups["year"].Value); } result = new MovieName { Name = cleanstr.Replace(nicename.StemNameBase(), ""), Year = year, Resolution = resolutionText, Releaser = releaserText }; return(true); }