public List<DbMovieInfo> GetTMDBinfos(string otitle, string ttitle, int year, string director, string fanartPath, bool multiImage, bool choose, string MasterTitle, string language) { var listemovies = new List<DbMovieInfo>(); if (otitle.Length == 0) return listemovies; string wtitle1 = otitle; string wtitle2 = ttitle; if (otitle.IndexOf("\\") > 0) wtitle1 = wtitle1.Substring(wtitle1.IndexOf("\\") + 1); if (ttitle.IndexOf("\\") > 0) wtitle2 = wtitle2.Substring(wtitle2.IndexOf("\\") + 1); if (ttitle.Length == 0) ttitle = otitle; var theMoviedb = new TheMoviedb(); listemovies = theMoviedb.GetMoviesByTitles(wtitle1, wtitle2, year, director, "", null, choose, language); string filename = string.Empty; string filename1 = string.Empty; string filename2 = string.Empty; if (MasterTitle == "OriginalTitle") wtitle2 = wtitle1; if (listemovies.Count == 1 && listemovies[0].Posters != null && listemovies[0].Posters.Count > 0 && !choose) { bool first = true; foreach (string backdrop in listemovies[0].Posters) { filename1 = GrabUtil.DownloadCovers(fanartPath, backdrop, wtitle2, multiImage, first, out filename); //if (filename2 == string.Empty) // filename2 = filename1; if ((filename2 != "added") && (filename1 != "already")) filename2 = "added"; else filename2 = "already"; first = false; } listemovies[0].Name = filename2; } else if (listemovies.Count > 1) //listemovies[0].Name = "(toomany)"; listemovies[0].Name = "(toomany) - (" + listemovies.Count + " results) - " + listemovies[0].Name; return listemovies; }
public List<DbMovieInfo> GetFanart(string otitle, string ttitle, int year, string director, string imdbid, string fanartPath, bool multiImage, bool choose, string MasterTitle, string personArtworkPath, int downloadlimit, string resolutionMin, string resolutionMax) { string language = CultureInfo.CurrentCulture.Name.Substring(0, 2); // use local language instead List<DbMovieInfo> listemovies = new List<DbMovieInfo>(); if (otitle.Length == 0) return listemovies; if (ttitle.Length == 0) ttitle = otitle; string wtitle1 = otitle; string wtitle2 = ttitle; if (otitle.IndexOf("\\") > 0) wtitle1 = wtitle1.Substring(wtitle1.IndexOf("\\") + 1); if (ttitle.IndexOf("\\") > 0) wtitle2 = wtitle2.Substring(wtitle2.IndexOf("\\") + 1); var theMoviedb = new TheMoviedb(); listemovies = theMoviedb.GetMoviesByTitles(wtitle1, wtitle2, year, director, imdbid, null, choose, language); string filename = string.Empty; string filename1 = string.Empty; string filename2 = string.Empty; if (MasterTitle == "OriginalTitle") wtitle2 = wtitle1; if (listemovies.Count == 1 && listemovies[0].Backdrops != null && listemovies[0].Backdrops.Count > 0 && !choose) { // Download Fanart !!! bool first = true; foreach (string backdrop in listemovies[0].Backdrops) { // old: filename1 = GrabUtil.DownloadBacdropArt(fanartPath, backdrop, wtitle2, multiImage, first, out filename); filename1 = GrabUtil.DownloadBacdropArt(fanartPath, backdrop, wtitle2, multiImage, first, out filename, downloadlimit, resolutionMin, resolutionMax); //if (filename2 == string.Empty) // filename2 = filename1; if ((filename2 != "added") && (filename1 != "already") && !filename1.StartsWith("numberlimit") && !filename1.StartsWith("resolution")) { filename2 = "added"; } else { if (filename1.StartsWith("numberlimit")) filename2 = "numberlimit"; else if (filename1.StartsWith("resolution")) { filename2 = "resolution"; } else { filename2 = "already"; first = false; } } } listemovies[0].Name = filename2; #region Download PersonArtwork (disabled) //// Get Actors from TMDB //string filenameperson = string.Empty; //string filename1person = string.Empty; //string filename2person = string.Empty; ////string ImdbBaseUrl = "http://www.imdb.com/"; //if (!string.IsNullOrEmpty(personArtworkPath) && listemovies[0].Persons != null && listemovies[0].Persons.Count > 0) //{ // List<grabber.DBPersonInfo> listepersons = listemovies[0].Persons; // foreach (grabber.DBPersonInfo person in listepersons) // { // bool firstpersonimage = true; // grabber.DBPersonInfo persondetails = new DBPersonInfo(); // persondetails = TheMoviedb.getPersonsById(person.Id, string.Empty); // foreach (var image in persondetails.Images) // { // filename1person = GrabUtil.DownloadPersonArtwork(personArtworkPath, image, persondetails.Name, multiImage, firstpersonimage, out filenameperson); // if ((filename2person != "added") && (filename1person != "already")) // filename2person = "added"; // else // filename2person = "already"; // firstpersonimage = false; // } // //// Get further IMDB images // //Grabber.MyFilmsIMDB _imdb = new Grabber.MyFilmsIMDB(); // //Grabber.MyFilmsIMDB.IMDBUrl wurl; // //_imdb.FindActor(persondetails.Name); // //IMDBActor imdbActor = new IMDBActor(); // //if (_imdb.Count > 0) // //{ // // string url = string.Empty; // // wurl = (Grabber.MyFilmsIMDB.IMDBUrl)_imdb[0]; // Assume first match is the best ! // // if (wurl.URL.Length != 0) // // { // // url = wurl.URL; // // //url = wurl.URL + "videogallery"; // Assign proper Webpage for Actorinfos // // //url = ImdbBaseUrl + url.Substring(url.IndexOf("name")); // // this.GetActorDetails(url, persondetails.Name, false, out imdbActor); // // filename1person = GrabUtil.DownloadPersonArtwork(personArtworkPath, imdbActor.ThumbnailUrl, persondetails.Name, multiImage, firstpersonimage, out filenameperson); // // firstpersonimage = false; // // } // //} // } // //// Get further Actors from IMDB // //IMDBMovie MPmovie = new IMDBMovie(); // //MPmovie.Title = listemovies[0].Name; // //MPmovie.IMDBNumber = listemovies[0].ImdbID; // //FetchActorsInMovie(MPmovie, personArtworkPath); //} #endregion } else if (listemovies.Count > 1) { //listemovies[0].Name = "(toomany)"; listemovies[0].Name = "(toomany) - (" + listemovies.Count + " results) - " + listemovies[0].Name; } return listemovies; }