Пример #1
0
        public CachedSeriesInfo GetSeries(string showName, bool showErrorMsgBox) => throw new NotImplementedException();//todo when we can offer search for TMDB

        public CachedMovieInfo?GetMovie(PossibleNewMovie show, bool showErrorMsgBox)
        {
            Search(show.RefinedHint, showErrorMsgBox);

            string showName = show.RefinedHint;

            if (string.IsNullOrEmpty(showName))
            {
                return(null);
            }

            showName = showName.ToLower();

            List <CachedMovieInfo> matchingShows = GetSeriesDictMatching(showName).Values.ToList();

            if (matchingShows.Count == 0)
            {
                return(null);
            }

            if (matchingShows.Count == 1)
            {
                return(matchingShows.First());
            }

            var exactMatchingShows = matchingShows
                                     .Where(info => info.Name.CompareName().Equals(showName, StringComparison.InvariantCultureIgnoreCase)).ToList();

            if (exactMatchingShows.Count == 0)
            {
                return(null);
            }

            if (exactMatchingShows.Count == 1)
            {
                return(exactMatchingShows.First());
            }

            if (show.PossibleYear is null)
            {
                return(null);
            }

            var exactMatchingShowsWithYear = exactMatchingShows
                                             .Where(info => info.Year == show.PossibleYear).ToList();

            if (exactMatchingShowsWithYear.Count == 0)
            {
                return(null);
            }

            if (exactMatchingShowsWithYear.Count == 1)
            {
                return(exactMatchingShowsWithYear.First());
            }

            return(null);
        }
Пример #2
0
        public CachedSeriesInfo GetSeries(string showName, bool showErrorMsgBox) => throw new NotImplementedException();//todo when we can offer search for TMDB

        public CachedMovieInfo?GetMovie(PossibleNewMovie show, bool showErrorMsgBox) => GetMovie(show.RefinedHint, show.PossibleYear, showErrorMsgBox, false);