GetProperImdbId() static private method

Gets a correctly formatted imdb id string
static private GetProperImdbId ( string id ) : string
id string current movie imdb id
return string
Exemplo n.º 1
0
        private bool MovieMatch(IMDBMovie localMovie, TraktMovie traktMovie)
        {
            // IMDb comparison
            if (!string.IsNullOrEmpty(traktMovie.Ids.Imdb) && !string.IsNullOrEmpty(BasicHandler.GetProperImdbId(localMovie.IMDBNumber)))
            {
                return(string.Compare(BasicHandler.GetProperImdbId(localMovie.IMDBNumber), traktMovie.Ids.Imdb, true) == 0);
            }

            // Title & Year comparison
            return(string.Compare(localMovie.Title, traktMovie.Title, true) == 0 && localMovie.Year.ToString() == traktMovie.Year.ToString());
        }
Exemplo n.º 2
0
        private bool MovieMatch(IMDBMovie localMovie, TraktMovie traktMovie)
        {
            // IMDb ID comparison
            if (!string.IsNullOrEmpty(traktMovie.Ids.Imdb) && !string.IsNullOrEmpty(BasicHandler.GetProperImdbId(localMovie.IMDBNumber)))
            {
                return(string.Compare(BasicHandler.GetProperImdbId(localMovie.IMDBNumber), traktMovie.Ids.Imdb, true) == 0);
            }

            // TMDb ID comparison - we should always have a ID from trakt.tv
            if (!string.IsNullOrEmpty(localMovie.TMDBNumber))
            {
                return(localMovie.TMDBNumber.ToNullableInt32() == traktMovie.Ids.Tmdb);
            }

            // Title & Year comparison
            return(string.Compare(localMovie.Title, traktMovie.Title, true) == 0 && localMovie.Year.ToString() == traktMovie.Year.ToString());
        }
Exemplo n.º 3
0
        internal static bool FindMovieID(string title, int year, string imdbid, ref IMDBMovie imdbMovie)
        {
            // get all movies
            ArrayList myvideos = new ArrayList();

            VideoDatabase.GetMovies(ref myvideos);

            // get all movies in local database
            List <IMDBMovie> movies = (from IMDBMovie m in myvideos select m).ToList();

            // try find a match
            IMDBMovie movie = movies.Find(m => BasicHandler.GetProperImdbId(m.IMDBNumber) == imdbid || (string.Compare(m.Title, title, true) == 0 && m.Year == year));

            if (movie == null)
            {
                return(false);
            }

            imdbMovie = movie;
            return(true);
        }