Inheritance: Document
Ejemplo n.º 1
0
        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;
        }
Ejemplo n.º 2
0
        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;
        }
Ejemplo n.º 3
0
        public static new Film GetObjectFromFindDocXmlBsMarcLight(string xml)
        {
            var film = new Film();

            film.FillPropertiesLight(xml);

            return film;
        }
Ejemplo n.º 4
0
 public static string GetFilmSearchQuery(Film film)
 {
     var searchTitle = film.SeriesTitle + " " + film.SeriesNumber + " " + film.Title + " " + film.SubTitle;
     searchTitle = searchTitle.Replace("null", "").Trim();
     return searchTitle;
 }