static public bool DownloadSeriesDetails(VideoTags videoTags, bool prioritizeMatchDate = false) { // The new v3 database is accessed via the TMDbLib API's try { TMDbClient client = new TMDbClient(MCEBUDDY_TMDB_APIKey); List<TvShowBase> showSearch = new List<TvShowBase>(); // TODO: Add support for multiple language searches if (String.IsNullOrWhiteSpace(videoTags.tmdbId)) // If dont' have a specific movieId specified, look up the show details { if (videoTags.OriginalBroadcastDateTime > GlobalDefs.NO_BROADCAST_TIME) // Release date narrow down { // The information is stored on the server using the network timezone // So we assume that the show being converted was recorded locally and is converted locally so the timezones match DateTime dt = videoTags.OriginalBroadcastDateTime.ToLocalTime(); showSearch = client.SearchTvShow(videoTags.Title.Trim().ToLower(), 0).Results; } else // Title Check showSearch = client.SearchTvShow(videoTags.Title.Trim().ToLower(), 0).Results; } else // Specific ID { TvShow showMatch = client.GetTvShow(int.Parse(videoTags.tmdbId)); // We have a specific show to work with // First match by Episode name and then by Original broadcast date (by default prioritize match date is false) if (!MatchSeriesInformation(client, videoTags, showMatch, prioritizeMatchDate)) return MatchSeriesInformation(client, videoTags, showMatch, !prioritizeMatchDate); else return true; } foreach (TvShowBase showResult in showSearch) // Cycle through all possible combinations { TvShow show = client.GetTvShow(showResult.Id); string title = videoTags.Title; // Get and match Show name (check both titles and aka values) if (String.Compare(show.Name.Trim(), videoTags.Title.Trim(), CultureInfo.InvariantCulture, (CompareOptions.IgnoreSymbols | CompareOptions.IgnoreCase)) != 0) // ignore white space and special characters if (String.Compare(show.OriginalName.Trim(), videoTags.Title.Trim(), CultureInfo.InvariantCulture, (CompareOptions.IgnoreSymbols | CompareOptions.IgnoreCase)) != 0) // ignore white space and special characters continue; // No match in name // If we got here, then we found a match // First match by Episode name and then by Original broadcast date (by default prioritize match date is false) if (!MatchSeriesInformation(client, videoTags, show, prioritizeMatchDate)) { if (MatchSeriesInformation(client, videoTags, show, !prioritizeMatchDate)) return true; // Else we continue looping through the returned series looking for a match if nothing matches } else return true; } return false; } catch { return false; } }