public static bool IsFilmValidImdbMatch(Film film, ImdbObject imdbObject) { if (imdbObject == null) return false; if (string.IsNullOrEmpty(imdbObject.Poster) || imdbObject.Poster.Equals("N/A")) return false; foreach (var person in film.InvolvedPersons) { if (string.IsNullOrEmpty(person.Name)) continue; var personNames = person.Name.Split(','); string personName; if (personNames.Length > 1) personName = personNames[1] + " " + personNames[0]; else personName = personNames[0]; personName = personName.Trim(); if (imdbObject.Director.Split(',').Any(director => director.Trim().Equals(personName))) return true; if (imdbObject.Writer.Split(',').Any(writer => writer.Trim().Equals(personName))) return true; } return false; }
private static string GetExternalFilmImdbRating(Film film) { // --------------------------- IMDB --------------------------- var searchQuery = ImdbRepository.GetFilmSearchQuery(film); var imdbObject = ImdbRepository.GetImdbObjectFromSeachQuery(searchQuery); if (ImdbRepository.IsFilmValidImdbMatch(film, imdbObject)) return imdbObject.imdbRating; if (!string.IsNullOrEmpty(film.OriginalTitle)) imdbObject = ImdbRepository.GetImdbObjectFromSeachQuery(film.OriginalTitle); if (ImdbRepository.IsFilmValidImdbMatch(film, imdbObject)) return imdbObject.imdbRating; // --------------------------- END IMDB ------------------------ // Here we can try other sources if available return string.Empty; }
public static new Film GetObjectFromFindDocXmlBsMarcLight(string xml) { var film = new Film(); film.FillPropertiesLight(xml); return film; }
public static string GetFilmSearchQuery(Film film) { var searchTitle = film.SeriesTitle + " " + film.SeriesNumber + " " + film.Title + " " + film.SubTitle; searchTitle = searchTitle.Replace("null", "").Trim(); return searchTitle; }