//GET IMDB TITLE private static string GetIMDBTITLE(string IMDBID) { IMDbLib newSearch = new IMDbLib("USA"); //Make this a module option IIMDbMovie MovieSearch = newSearch.GetMovieDetails(IMDBID,true); return MovieSearch.Title; }
//GET IMDBID private static string GetIMDBID(string movieName, string amgDirector, string amgActor, string year, string dvdid) { var id = string.Empty; var newSearch = new IMDbLib("USA"); //TODO: Make this a module option IIMDbMovie imdblist; var titleList = new List<String>(); var movieList = IMDbConventionalFilmSearchEngine.SearchForTitleReturnResults(movieName); try { for (var i = 0; i < movieList.Count; i++) { if (i >= movieList.Count) continue; titleList.Add(movieList[i].IMDb_ID); Debugger.LogMessageToFile("IMDb Search Results: " + movieList[i].Title.ToString()); } if (String.IsNullOrEmpty(year)) { year = DVDWebUtils.GetReleaseYear(dvdid); if (titleList.Count > 1) { foreach (string t in titleList) { imdblist = newSearch.GetMovieDetails(t,false); String iDir = imdblist.People.GetDirectorString(); Debugger.LogMessageToFile("Directors: " + iDir); if (!iDir.ToLower().Contains(amgDirector.ToLower())) continue; Debugger.LogMessageToFile(imdblist.Title + ": " + "Directors Matched"); String iActor = imdblist.People.GetActorsString(false); //true to get roles Debugger.LogMessageToFile("Actors: " + iActor); if (!iActor.ToLower().Contains(amgActor.ToLower())) continue; Debugger.LogMessageToFile(imdblist.Title + ": " + "Actors Matched"); id = imdblist.IMDb_ID; break; }//endof foreach } else { foreach (string t in titleList) { imdblist = newSearch.GetMovieDetails(t,false); if (imdblist.Title.ToLower() == movieName.ToLower() || imdblist.Title.ToLower().Contains(movieName.ToLower()) || movieName.ToLower().Contains(imdblist.Title.ToLower())) id = t; } } } if (!String.IsNullOrEmpty(year) && String.IsNullOrEmpty(id)) { foreach (string t in titleList) { imdblist = newSearch.GetMovieDetails(t,false); String sYear2 = imdblist.Year; String sYear = sYear2.Replace("/", "").Trim(); int iYear = Convert.ToInt16(year); int iYearMinusOne = iYear - 1; int iYearMinusTwo = iYear - 2; String sYearMinusTwo = Convert.ToString(iYearMinusTwo); String sYearMinusOne = Convert.ToString(iYearMinusOne); Debugger.LogMessageToFile("Search Year: " + year); Debugger.LogMessageToFile("Search Year: " + sYearMinusOne); Debugger.LogMessageToFile("Search Year: " + sYearMinusTwo); Debugger.LogMessageToFile("IMdb Year: " + sYear); if ((imdblist.Title.ToLower() != movieName.ToLower() && !imdblist.Title.ToLower().Contains(movieName.ToLower())) && !movieName.ToLower().Contains(imdblist.Title.ToLower())) continue; if ((sYear != year && sYear != sYearMinusOne) && sYear != sYearMinusTwo) continue; Debugger.LogMessageToFile(imdblist.Title + ": " + "Years Matched"); id = imdblist.IMDb_ID; break; } } } catch (Exception e) { Debugger.LogMessageToFile("Get IMDb 2 - Error on OnMessage: " + e.ToString()); } return id.ToString(); }