internal static string GetIMDBID(PluginClass pluginClass, string MovieName, string AMGDirector, string AMGActor, string Year, string DVDID) { String id = ""; IMDbLib newSearch = new IMDbLib("USA"); //Make this a module option IList<IIMDbSearchResult> MovieList = null; IIMDbMovie imdblist = null; List<string> titleList = new List<string>(); MovieList = newSearch.SearchMovies(MovieName); try { for (int i = 0; i < MovieList.Count; i++) { if (i < MovieList.Count) { titleList.Add(MovieList[i].IMDb_ID); MeedioUtils.LogEntry(pluginClass.Log, pluginClass.swWriteLog, "[MAIN CODE] - IMDb Search Results: " + MovieList[i].Title.ToString()); } } if (Year == "") { Year = DVDWebUtils.GetReleaseYear(DVDID, pluginClass.Log, pluginClass.swWriteLog); if (titleList.Count > 1) { foreach (string t in titleList) { imdblist = newSearch.GetMovieDetails(t); String iDir = imdblist.People.GetDirectorString(); MeedioUtils.LogEntry(pluginClass.Log, pluginClass.swWriteLog, "[MAIN CODE] - Directors: " + iDir); if (!iDir.ToLower().Contains(AMGDirector.ToLower())) continue; MeedioUtils.LogEntry(pluginClass.Log, pluginClass.swWriteLog, "[MAIN CODE] - " + imdblist.Title + ": " + "Directors Matched"); String iActor = imdblist.People.GetActorsString(false); //true to get roles MeedioUtils.LogEntry(pluginClass.Log, pluginClass.swWriteLog, "[MAIN CODE] - Actors: " + iActor); if (!iActor.ToLower().Contains(AMGActor.ToLower())) continue; MeedioUtils.LogEntry(pluginClass.Log, pluginClass.swWriteLog, "[MAIN CODE] - " + imdblist.Title + ": " + "Actors Matched"); id = imdblist.IMDb_ID; break; } } else { foreach (string t in titleList) { imdblist = newSearch.GetMovieDetails(t); if (imdblist.Title.ToLower() == MovieName.ToLower() || imdblist.Title.ToLower().Contains(MovieName.ToLower()) || MovieName.ToLower().Contains(imdblist.Title.ToLower())) { id = t; } } } } if (Year != "" && id == "") { foreach (string t in titleList) { imdblist = newSearch.GetMovieDetails(t); 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); MeedioUtils.LogEntry(pluginClass.Log, pluginClass.swWriteLog, "[MAIN CODE] - Search Year: " + Year); MeedioUtils.LogEntry(pluginClass.Log, pluginClass.swWriteLog, "[MAIN CODE] - Search Year: " + sYearMinusOne); MeedioUtils.LogEntry(pluginClass.Log, pluginClass.swWriteLog, "[MAIN CODE] - Search Year: " + sYearMinusTwo); MeedioUtils.LogEntry(pluginClass.Log, pluginClass.swWriteLog, "[MAIN CODE] - IMdb Year: " + sYear); if (imdblist.Title.ToLower() == MovieName.ToLower() || imdblist.Title.ToLower().Contains(MovieName.ToLower()) || MovieName.ToLower().Contains(imdblist.Title.ToLower())) { if (sYear == Year || sYear == sYearMinusOne || sYear == sYearMinusTwo) { MeedioUtils.LogEntry(pluginClass.Log, pluginClass.swWriteLog, "[MAIN CODE] - " + imdblist.Title + ": " + "Years Matched"); id = imdblist.IMDb_ID; break; } } } } } catch (Exception e) { MeedioUtils.LogEntry(pluginClass.Log, pluginClass.swWriteLog, "[MAIN CODE] - Get IMDb 2 - Error on OnMessage: " + e.ToString()); } return id.ToString(); }
internal static string GetIMDBTITLE(string IMDBID) { var newSearch = new IMDbLib("USA"); //Make this a module option IIMDbMovie movieSearch = newSearch.GetMovieDetails(IMDBID); return movieSearch.Title; }