示例#1
0
    //-------------------------------------------------------------------------------------------
    //  Dowload backdrops on theMovieDB.org
    //-------------------------------------------------------------------------------------------        
    public static void Download_Backdrops_Fanart(string wtitle, string wttitle, string wftitle, string director, string imdbid, string year, bool choose, int wGetID, string savetitle, string personartworkpath, bool loadFanart, bool loadPersonImages, GUIAnimation searchanimation)
    {
      new Thread(delegate()
      {
        var grab = new Grabber_URLClass();
        int wyear = 0;
        try { wyear = Convert.ToInt32(year); }
        catch { }
        try
        {
          SetProcessAnimationStatus(true, searchanimation);  // GUIWaitCursor.Init(); GUIWaitCursor.Show();
          List<DbMovieInfo> listemovies = grab.GetFanart(
            wtitle,
            savetitle,
            wyear,
            director,
            imdbid,
            MyFilms.conf.StrPathFanart,
            true,
            choose,
            MyFilms.conf.StrTitle1,
            personartworkpath);
          SetProcessAnimationStatus(false, searchanimation);  //GUIWaitCursor.Hide();
          //System.Collections.Generic.List<grabber.DBMovieInfo> listemovies = Grab.GetFanart(wtitle, wttitle, wyear, director, MyFilms.conf.StrPathFanart, true, choose);
          LogMyFilms.Debug("(DownloadBackdrops) - listemovies: '" + wtitle + "', '" + wttitle + "', '" + wyear + "', '" + director + "', '" + MyFilms.conf.StrPathFanart + "', 'true', '" + choose.ToString() + "', '" + MyFilms.conf.StrTitle1 + "'");
          int listCount = listemovies.Count;
          LogMyFilms.Debug("(DownloadBackdrops) - listemovies: Result Listcount: '" + listCount.ToString() + "'");

          if (choose) listCount = 2;
          switch (listCount)
          {
            case 0:
              break;
            case 1:
              LogMyFilms.Debug("Fanart " + listemovies[0].Name.Substring(listemovies[0].Name.LastIndexOf("\\") + 1) + " downloaded for " + wttitle);
              if (listemovies[0].Persons.Count > 0)
              {
                LogMyFilms.Debug("PersonArtwork: " + listemovies[0].Persons.Count.ToString() + " Persons checked for " + wttitle);
                foreach (DbPersonInfo person in listemovies[0].Persons)
                {
                  LogMyFilms.Debug("PersonArtwork: " + person.Images.Count.ToString() + " images found for " + person.Name);
                }
              }
              break;
            default:

              var wotitle_tableau = new ArrayList();
              var wttitle_tableau = new ArrayList();
              var wotitle_sub_tableau = new ArrayList();
              var wttitle_sub_tableau = new ArrayList();
              const int MinChars = 2;
              bool Filter = true;

              var dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);
              if (dlg == null) return;
              dlg.Reset();
              dlg.SetHeading(loadFanart ? GUILocalizeStrings.Get(1079862) : GUILocalizeStrings.Get(1079900));  // Load fanart (online)  // Download person images (selected film)
              dlg.Add("  *****  " + GUILocalizeStrings.Get(1079860) + "  *****  "); //manual selection
              foreach (DbMovieInfo t in listemovies)
              {
                string dialoginfoline = t.Name + "  (" + t.Year + ")";
                if (loadFanart) dialoginfoline += " - Fanarts: " + t.Backdrops.Count;
                if (loadPersonImages) dialoginfoline += " - Persons: " + t.Persons.Count.ToString();
                dlg.Add(dialoginfoline);
                LogMyFilms.Debug("TMDB listemovies: " + t.Name + "  (" + t.Year + ") - Fanarts: " + t.Backdrops.Count + " - TMDB-Id: " + t.Identifier + " - Persons: " + t.Persons.Count.ToString());
              }
              if (!(dlg.SelectedLabel > -1))
              {
                dlg.SelectedLabel = -1;
                dlg.DoModal(wGetID);
              }
              if (dlg.SelectedLabel == 0)
              {
                #region Get SubTitles and Subwords from otitle and ttitle

                wotitle_tableau = MyFilms.SubTitleGrabbing(wtitle);
                wttitle_tableau = MyFilms.SubTitleGrabbing(wttitle);
                wotitle_sub_tableau = MyFilms.SubWordGrabbing(wtitle, MinChars, Filter);
                // Min 3 Chars, Filter true (no der die das)
                wttitle_sub_tableau = MyFilms.SubWordGrabbing(wttitle, MinChars, Filter);
                // Min 3 Chars, Filter true (no der die das)
                //First Show Dialog to choose Otitle, Ttitle or substrings - or Keyboard to manually enter searchstring!!!
                var dlgSearchFilm = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);
                if (dlgSearchFilm == null) return;
                dlgSearchFilm.Reset();
                dlgSearchFilm.SetHeading(GUILocalizeStrings.Get(1079859)); // choose search expression
                dlgSearchFilm.Add("  *****  " + GUILocalizeStrings.Get(1079858) + "  *****  ");
                //manual selection with keyboard
                //dlgs.Add(wtitle); //Otitle
                dlgSearchFilm.Add(savetitle); //Otitle = savetitle
                dlgSearchFilm.Add(wttitle); //Ttitle
                foreach (object t in from object t in wotitle_tableau where t.ToString().Length > 1 select t)
                {
                  dlgSearchFilm.Add(t.ToString());
                }
                foreach (object t in from object t in wttitle_tableau where t.ToString().Length > 1 select t)
                {
                  dlgSearchFilm.Add(t.ToString());
                }
                foreach (object t in from object t in wotitle_sub_tableau where t.ToString().Length > 1 select t)
                {
                  dlgSearchFilm.Add(t.ToString());
                }
                foreach (object t in from object t in wttitle_sub_tableau where t.ToString().Length > 1 select t)
                {
                  dlgSearchFilm.Add(t.ToString());
                }
                //Now all titles and Substrings listed in dialog !
                //dlgs.Add("  *****  " + GUILocalizeStrings.Get(1079860) + "  *****  "); //manual selection
                if (!(dlgSearchFilm.SelectedLabel > -1))
                {
                  dlgSearchFilm.SelectedLabel = -1;
                  dlgSearchFilm.DoModal(wGetID);
                }
                if (dlgSearchFilm.SelectedLabel == 0) // enter manual searchstring via VK
                {
                  var keyboard = (VirtualKeyboard)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_VIRTUAL_KEYBOARD);
                  if (null == keyboard) return;
                  keyboard.Reset();
                  keyboard.SetLabelAsInitialText(false); // set to false, otherwise our intial text is cleared
                  keyboard.Text = wtitle;
                  keyboard.DoModal(wGetID);
                  if ((keyboard.IsConfirmed) && (keyboard.Text.Length > 0))
                  {
                    //Remove_Backdrops_Fanart(wtitle, true);
                    //Remove_Backdrops_Fanart(wttitle, true);
                    //Remove_Backdrops_Fanart(wftitle, true);
                    Download_Backdrops_Fanart(
                      keyboard.Text,
                      string.Empty,
                      string.Empty,
                      string.Empty,
                      string.Empty,
                      string.Empty,
                      true,
                      wGetID,
                      savetitle,
                      personartworkpath,
                      loadFanart,
                      loadPersonImages,
                      searchanimation);
                  }
                  break;
                }
                if (dlgSearchFilm.SelectedLabel > 0 && dlgSearchFilm.SelectedLabel < 3) // if one of otitle or ttitle selected, keep year and director
                {
                  Download_Backdrops_Fanart(
                    dlgSearchFilm.SelectedLabelText,
                    wttitle,
                    wftitle,
                    year,
                    director,
                    string.Empty,
                    true,
                    wGetID,
                    savetitle,
                    personartworkpath,
                    loadFanart,
                    loadPersonImages,
                    searchanimation);
                  //Download_Backdrops_Fanart(string wtitle, string wttitle, string director, string year, bool choose,int wGetID, string savetitle)
                  break;
                }
                if (dlgSearchFilm.SelectedLabel > 2) // For subitems, search without year and director !
                {
                  Download_Backdrops_Fanart(
                    dlgSearchFilm.SelectedLabelText,
                    wttitle,
                    wftitle,
                    string.Empty,
                    string.Empty,
                    string.Empty,
                    true,
                    wGetID,
                    savetitle,
                    personartworkpath,
                    loadFanart,
                    loadPersonImages,
                    searchanimation);
                  //Download_Backdrops_Fanart(string wtitle, string wttitle, string director, string year, bool choose,int wGetID, string savetitle)
                  break;
                }

                #endregion
              }
              if (dlg.SelectedLabel > 0)
              {
                // Load Fanart  -> show progress dialog !

                var dlgPrgrs = (GUIDialogProgress)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_PROGRESS);
                if (dlgPrgrs != null)
                {
                  dlgPrgrs.Reset();
                  dlgPrgrs.DisplayProgressBar = true;
                  dlgPrgrs.ShowWaitCursor = false;
                  dlgPrgrs.DisableCancel(true);
                  dlgPrgrs.SetHeading("MyFilms Artwork Download");
                  dlgPrgrs.StartModal(GUIWindowManager.ActiveWindow);
                  dlgPrgrs.SetLine(1, "Loading Artwork ...");
                  dlgPrgrs.Percentage = 0;

                  #region load fanarts ...
                  bool first = true;
                  string filename = string.Empty;
                  string filename1 = string.Empty;
                  //if (MyFilms.conf.StrTitle1 == "OriginalTitle")
                  //  wttitle = savetitle; // Was wttitle = wtitle;
                  int i = 0;
                  if (loadFanart) // Download Fanart
                  {
                    if (dlgPrgrs != null) dlgPrgrs.SetLine(1, "Loading Fanart for '" + savetitle + "'");

                    foreach (string backdrop in listemovies[dlg.SelectedLabel - 1].Backdrops)
                    {
                      filename1 = Grabber.GrabUtil.DownloadBacdropArt(MyFilms.conf.StrPathFanart, backdrop, savetitle, true, first, out filename);
                      if (dlgPrgrs != null) dlgPrgrs.SetLine(2, "loading '" + System.IO.Path.GetFileName(filename) + "'");
                      if (dlgPrgrs != null) dlgPrgrs.Percentage = i * 100 / listemovies[dlg.SelectedLabel - 1].Backdrops.Count;
                      LogMyFilms.Debug("Fanart " + filename1.Substring(filename1.LastIndexOf("\\") + 1) + " downloaded for " + savetitle);

                      if (filename == string.Empty) filename = filename1;
                      if (!(filename == "already" && filename1 == "already")) filename = "added";
                      first = false;
                      i++;
                    }
                  }
                  #endregion

                  listemovies[0].Name = filename;

                  if (loadPersonImages) // Download PersonArtwork
                  {
                    string filenameperson = string.Empty;
                    string filename1person = string.Empty;
                    string filename2person = string.Empty;
                    LogMyFilms.Debug(
                      "Person Artwork - " + listemovies[0].Persons.Count + " persons found - now loading artwork");
                    if (!string.IsNullOrEmpty(personartworkpath) && listemovies[0].Persons != null &&
                        listemovies[0].Persons.Count > 0)
                    {
                      if (dlgPrgrs != null) dlgPrgrs.SetLine(1, "Loading person images for '" + wttitle + "'");
                      if (dlgPrgrs != null) dlgPrgrs.SetLine(2, "");

                      foreach (Grabber.DbPersonInfo person in listemovies[0].Persons)
                      {
                        bool firstpersonimage = true;
                        bool onlysinglepersonimage = true;
                        var persondetails = new DbPersonInfo();
                        var theMoviedb = new TheMoviedb();
                        persondetails = theMoviedb.GetPersonsById(person.Id, string.Empty);
                        LogMyFilms.Debug("Person Artwork: found '" + persondetails.Images.Count + "' TMDB images for '" + persondetails.Name + "' in movie '" + savetitle + "'");
                        if (dlgPrgrs != null) dlgPrgrs.SetLine(2, "loading '" + persondetails.Name + "'");
                        if (dlgPrgrs != null) dlgPrgrs.Percentage = 0;

                        if (persondetails.Images.Count > 0)
                        {
                          i = 0;
                          foreach (var image in persondetails.Images)
                          {
                            filename1person = Grabber.GrabUtil.DownloadPersonArtwork(personartworkpath, image, persondetails.Name, true, firstpersonimage, out filenameperson);
                            if (dlgPrgrs != null) dlgPrgrs.SetLine(2, "loading '" + persondetails.Name + "' (TMDB - #" + i + ")");
                            if (dlgPrgrs != null) dlgPrgrs.Percentage = i * 100 / persondetails.Images.Count;

                            LogMyFilms.Debug("Person Artwork " + filename1person.Substring(filename1person.LastIndexOf("\\") + 1) + " downloaded for '" + persondetails.Name + "' in movie '" + savetitle + "', path='" + filename1person + "'");
                            if (filenameperson == string.Empty) filenameperson = filename1person;
                            if (!(filenameperson == "already" && filename1person == "already")) filenameperson = "added";
                            firstpersonimage = false;
                            i++;
                            if (onlysinglepersonimage) break;
                          }
                        }
                      }
                    }
                    else if (string.IsNullOrEmpty(personartworkpath)) LogMyFilms.Debug("No Personartwork loaded - Personartworkpath is not set in setup!");
                  }
                  if (dlgPrgrs != null) dlgPrgrs.Percentage = 100;
                  dlgPrgrs.ShowWaitCursor = false;
                  dlgPrgrs.SetLine(1, GUILocalizeStrings.Get(1079846));
                  dlgPrgrs.SetLine(2, "");
                  Thread.Sleep(50);
                  dlgPrgrs.Close(); // Done...
                  return;
                }
              }
              break;
          }
        }
        catch (Exception ex)
        {
          LogMyFilms.DebugException("Thread 'MyFilmsTMDBLoader' - exception! - ", ex);
        }
        GUIWindowManager.SendThreadCallbackAndWait((p1, p2, data) =>
        {
          //dlgPrgrs.ShowWaitCursor = false;
          // enter here what to load after background thread has finished !
          if (DetailsUpdated != null) DetailsUpdated(true);
          return 0;
        }, 0, 0, null);
      }) { Name = "MyFilmsTMDBLoader", IsBackground = true }.Start();
    }
示例#2
0
    public static bool GrabActorDetails(string url, string wscript, out IMDBActor person)
    {
      LogMyFilms.Debug("launching (GrabActorDetails) with url = '" + url + "', wscript = '" + wscript + "'");

      person = new IMDBActor();
      var Grab = new Grabber_URLClass();
      var Result = new string[80];

      #region load internet data
      try
      {
        Result = Grab.GetDetail(url, "", wscript, false, null, null, null, null);
        // Result = Grab.GetDetail(url, downLoadPath, wscript, true, MyFilms.conf.GrabberOverrideLanguage, MyFilms.conf.GrabberOverridePersonLimit, MyFilms.conf.GrabberOverrideTitleLimit, MyFilms.conf.GrabberOverrideGetRoles, null);
        for (int i = 0; i < 40; i++) // copy mapped values to original values
        {
          Result[i] = Result[i + 40];
        }
      }
      catch (Exception ex)
      {
        LogMyFilms.ErrorException("GrabActorDetails() - exception = '" + ex.Message + "'", ex);
        return false;
      }
      #endregion

      #region load details data for person
      person.Name = Result[(int)Grabber_URLClass.Grabber_Output.OriginalTitle];
      person.DateOfBirth = Result[(int)Grabber_URLClass.Grabber_Output.Comments];
      person.PlaceOfBirth = Result[(int)Grabber_URLClass.Grabber_Output.Country];
      person.Biography = Result[(int)Grabber_URLClass.Grabber_Output.Description];
      person.ThumbnailUrl = Result[(int)Grabber_URLClass.Grabber_Output.PictureURL];
      #endregion
      LogMyFilms.Debug("GrabActorDetails() done for person : '" + person.Name + "'");
      return true;
    }
示例#3
0
    //-------------------------------------------------------------------------------------------
    //  Dowload TMDBinfos (Poster(s), Movieinfos) on theMovieDB.org
    //-------------------------------------------------------------------------------------------        
    public static void Download_TMDB_Posters(string wtitle, string wttitle, string director, string year, bool choose, int wGetID, string savetitle, GUIAnimation searchanimation)
    {
      string oldPicture = MyFilmsDetail.getGUIProperty("picture");
      string newPicture = ""; // full path to new picture
      string newPictureCatalogname = ""; // entry to be stored in catalog
      if (string.IsNullOrEmpty(oldPicture)) 
        oldPicture = "";

      if (!Directory.Exists(MyFilms.conf.StrPathImg + "\\" + MyFilms.conf.StrPicturePrefix))
        try
        {
          Directory.CreateDirectory(MyFilms.conf.StrPathImg + "\\" + MyFilms.conf.StrPicturePrefix);
        }
        catch (Exception) { }
      var grab = new Grabber_URLClass();
      string language = CultureInfo.CurrentCulture.Name.Substring(0, 2);
      int wyear = 0;
      try { wyear = Convert.ToInt32(year); }
      catch { }
      new Thread(delegate()
        {
          try
          {
            SetProcessAnimationStatus(true, searchanimation); // GUIWaitCursor.Init(); GUIWaitCursor.Show();
            List<DbMovieInfo> listemovies = grab.GetTMDBinfos(wtitle, wttitle, wyear, director, MyFilms.conf.StrPathImg + "\\" + MyFilms.conf.StrPicturePrefix, true, choose, MyFilms.conf.StrTitle1, language);
            SetProcessAnimationStatus(false, searchanimation); // GUIWaitCursor.Hide();
            LogMyFilms.Debug("(TMDB-Infos) - listemovies: '" + wtitle + "', '" + wttitle + "', '" + wyear + "', '" + director + "', '" + MyFilms.conf.StrPathImg + "\\" + MyFilms.conf.StrPicturePrefix + "', 'true', '" + choose.ToString() + "', '" + MyFilms.conf.StrTitle1 + "', '" + language + "'");
            int listCount = listemovies.Count;
            LogMyFilms.Debug("(TMDB-Infos) - listemovies: Result Listcount: '" + listCount + "'");

            if (choose)
              listCount = 2;
            switch (listCount)
            {
              case 0:
                break;
              case 1:
                LogMyFilms.Info("Posters " + listemovies[0].Name.Substring(listemovies[0].Name.LastIndexOf("\\") + 1) + " downloaded for " + wttitle);
                break;
              default:

                var wotitle_tableau = new ArrayList();
                var wttitle_tableau = new ArrayList();
                var wotitle_sub_tableau = new ArrayList();
                var wttitle_sub_tableau = new ArrayList();
                const int MinChars = 2;
                bool Filter = true;

                var dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);
                if (dlg == null) return;
                dlg.Reset();
                dlg.SetHeading(GUILocalizeStrings.Get(1079857)); // Load TMDB data (online)
                dlg.Add("  *****  " + GUILocalizeStrings.Get(1079860) + "  *****  "); //manual selection
                foreach (DbMovieInfo t in listemovies)
                {
                  dlg.Add(t.Name + "  (" + t.Year + ") - Posters: " + t.Posters.Count + " - Id" + t.Identifier);
                  LogMyFilms.Debug("TMDB listemovies: " + t.Name + "  (" + t.Year + ") - Posters: " + t.Posters.Count + " - TMDB-Id: " + t.Identifier);
                }
                if (!(dlg.SelectedLabel > -1))
                {
                  dlg.SelectedLabel = -1;
                  dlg.DoModal(wGetID);
                }
                if (dlg.SelectedLabel == 0)
                {
                  #region Get SubTitles and Subwords from otitle and ttitle
                  wotitle_tableau = MyFilms.SubTitleGrabbing(wtitle);
                  wttitle_tableau = MyFilms.SubTitleGrabbing(wttitle);
                  wotitle_sub_tableau = MyFilms.SubWordGrabbing(wtitle, MinChars, Filter); // Min 3 Chars, Filter true (no der die das)
                  wttitle_sub_tableau = MyFilms.SubWordGrabbing(wttitle, MinChars, Filter); // Min 3 Chars, Filter true (no der die das)
                  //First Show Dialog to choose Otitle, Ttitle or substrings - or Keyboard to manually enter searchstring!!!
                  var dlgs = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);
                  if (dlgs == null) return;
                  dlgs.Reset();
                  dlgs.SetHeading(GUILocalizeStrings.Get(1079859)); // choose search expression
                  dlgs.Add("  *****  " + GUILocalizeStrings.Get(1079858) + "  *****  "); //manual selection with keyboard
                  //dlgs.Add(wtitle); //Otitle
                  dlgs.Add(savetitle); //Otitle = savetitle
                  dlgs.Add(wttitle); //Ttitle
                  foreach (object t in from object t in wotitle_tableau where t.ToString().Length > 1 select t)
                  {
                    dlgs.Add(t.ToString());
                  }
                  foreach (object t in from object t in wttitle_tableau where t.ToString().Length > 1 select t)
                  {
                    dlgs.Add(t.ToString());
                  }
                  foreach (object t in from object t in wotitle_sub_tableau where t.ToString().Length > 1 select t)
                  {
                    dlgs.Add(t.ToString());
                  }
                  foreach (object t in from object t in wttitle_sub_tableau where t.ToString().Length > 1 select t)
                  {
                    dlgs.Add(t.ToString());
                  }
                  //Now all titles and Substrings listed in dialog !
                  //dlgs.Add("  *****  " + GUILocalizeStrings.Get(1079860) + "  *****  "); //manual selection
                  if (!(dlgs.SelectedLabel > -1))
                  {
                    dlgs.SelectedLabel = -1;
                    dlgs.DoModal(wGetID);
                  }
                  if (dlgs.SelectedLabel == 0)
                  {
                    var keyboard = (VirtualKeyboard)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_VIRTUAL_KEYBOARD);
                    if (null == keyboard) return;
                    keyboard.Reset();
                    keyboard.SetLabelAsInitialText(false); // set to false, otherwise our intial text is cleared
                    keyboard.Text = wtitle;
                    keyboard.DoModal(wGetID);
                    if ((keyboard.IsConfirmed) && (keyboard.Text.Length > 0))
                    {
                      Download_TMDB_Posters(keyboard.Text, wttitle, string.Empty, string.Empty, true, wGetID, savetitle, searchanimation);
                    }
                    break;
                  }
                  if (dlgs.SelectedLabel > 0 && dlgs.SelectedLabel < 3) // if one of otitle or ttitle selected, keep year and director
                  {
                    Download_TMDB_Posters(dlgs.SelectedLabelText, wttitle, year, director, true, wGetID, savetitle, searchanimation);
                    //Download_TMDB_Posters(string wtitle, string wttitle, string director, string year, bool choose,int wGetID, string savetitle)
                    break;
                  }
                  if (dlgs.SelectedLabel > 2) // For subitems, search without year and director !
                  {
                    Download_TMDB_Posters(dlgs.SelectedLabelText, wttitle, string.Empty, string.Empty, true, wGetID, savetitle, searchanimation);
                    //Download_TMDB_Posters(string wtitle, string wttitle, string director, string year, bool choose,int wGetID, string savetitle)
                    break;
                  }
                  #endregion
                }
                if (dlg.SelectedLabel > 0)
                {
                  // Load Posters  -> show progress dialog !

                  var dlgPrgrs = (GUIDialogProgress)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_PROGRESS);
                  if (dlgPrgrs != null)
                  {
                    dlgPrgrs.Reset();
                    dlgPrgrs.DisplayProgressBar = true;
                    dlgPrgrs.ShowWaitCursor = false;
                    dlgPrgrs.DisableCancel(true);
                    dlgPrgrs.SetHeading("MyFilms Artwork Download");
                    dlgPrgrs.StartModal(GUIWindowManager.ActiveWindow);
                    dlgPrgrs.SetLine(1, "Loading Artwork ...");
                    dlgPrgrs.Percentage = 0;

                    bool first = true;
                    string filename = string.Empty;
                    string filename1 = string.Empty;
                    if (MyFilms.conf.StrTitle1 == "OriginalTitle")
                      wttitle = savetitle; // Was wttitle = wtitle;
                    int i = 0;
                    if (dlgPrgrs != null) dlgPrgrs.SetLine(1, "Loading Poster for '" + savetitle + "'");
                    foreach (string poster in listemovies[dlg.SelectedLabel - 1].Posters)
                    {
                      filename1 = Grabber.GrabUtil.DownloadCovers(MyFilms.conf.StrPathImg + "\\" + MyFilms.conf.StrPicturePrefix, poster, wttitle, true, first, out filename);
                      if (dlgPrgrs != null) dlgPrgrs.SetLine(2, "loading '" + System.IO.Path.GetFileName(filename) + "'");
                      if (dlgPrgrs != null) dlgPrgrs.Percentage = i * 100 / listemovies[dlg.SelectedLabel - 1].Posters.Count;
                      LogMyFilms.Info("Poster " + filename1.Substring(filename1.LastIndexOf("\\") + 1) + " downloaded for " + wttitle);
                      if (first)
                        newPicture = filename1;
                      if (filename == string.Empty)
                        filename = filename1;
                      if (!(filename == "already" && filename1 == "already"))
                        filename = "added";
                      first = false;
                      i++;
                    }
                    foreach (string person in listemovies[dlg.SelectedLabel - 1].Actors)
                    {
                      // ToDo: Load Actorinfodetails (API Call to be written in grabber) and download Person Artwork
                    }
                    listemovies[0].Name = filename;

                    newPictureCatalogname = GetPictureCatalogNameFromFilename(newPicture);

                    if (wGetID != MyFilms.ID_MyFilmsCoverManager)
                    {
                      if (!choose)
                      {
                        MyFilms.r[MyFilms.conf.StrIndex]["Picture"] = newPictureCatalogname;
                        Update_XML_database();
                        LogMyFilms.Info("(Update_XML_database()) - Database Updated for created Coverthumb: " + newPicture);
                      }
                      else
                      {
                        //TMDB_Details_Select();
                        setGUIProperty("picture", newPicture);
                        GUIWindowManager.Process(); // To Update GUI display ...

                        var dlgYesNo = (GUIDialogYesNo)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_YES_NO);
                        dlgYesNo.SetHeading(GUILocalizeStrings.Get(1079870)); // choice
                        dlgYesNo.SetLine(1, "");
                        dlgYesNo.SetLine(2, GUILocalizeStrings.Get(10798733)); // Replace cover with new one
                        dlgYesNo.SetLine(3, "");
                        dlgYesNo.DoModal(wGetID);
                        if (!(dlgYesNo.IsConfirmed))
                        {
                          setGUIProperty("picture", oldPicture);
                          GUIWindowManager.Process();
                          return;
                        }
                        MyFilms.r[MyFilms.conf.StrIndex]["Picture"] = newPictureCatalogname;
                        Update_XML_database();
                        LogMyFilms.Info("(Update_XML_database()) - Database Updated with '" + newPictureCatalogname + "' for created Coverthumb '" + newPicture + "'");
                      }
                    }
                  }
                  if (dlgPrgrs != null) dlgPrgrs.Percentage = 100; dlgPrgrs.ShowWaitCursor = false; dlgPrgrs.SetLine(1, GUILocalizeStrings.Get(1079846)); dlgPrgrs.SetLine(2, ""); Thread.Sleep(50); dlgPrgrs.Close(); // Done...
                  // return;
                }
                break;
            }
          }
          catch (Exception ex)
          {
            LogMyFilms.DebugException("Thread 'MyFilmsTMDBLoader' - exception! - ", ex);
          }
          GUIWindowManager.SendThreadCallbackAndWait((p1, p2, data) =>
            {
              if (DetailsUpdated != null) DetailsUpdated(true);
              return 0;
            }, 0, 0, null);
        }) { Name = "MyFilmsTMDBLoader", IsBackground = true }.Start();
    }
示例#4
0
    private static void GrabArtwork(string title, string ttitle, int year, string director, string imdbid, string StrTitle1, GUIDialogProgress dlgPrgrs)
    {
      try
      {
        if (dlgPrgrs != null)
          dlgPrgrs.SetLine(1, "Now loading Fanart ...");

        if (dlgPrgrs != null && !dlgPrgrs.ShouldRenderLayer())
          return;

        if (dlgPrgrs != null)
          dlgPrgrs.Percentage = 10;

        var grab = new Grabber_URLClass();
        List<DbMovieInfo> listemovies = grab.GetFanart(title, ttitle, year, director, imdbid, MyFilms.conf.StrPathFanart, true, false, StrTitle1, string.Empty);
      }
      catch (Exception ex)
      {
        LogMyFilms.Debug("GrabArtwork() - Error getting fanart: " + ex.Message);
      }
      finally
      {
        if (dlgPrgrs != null)
        {
          dlgPrgrs.Percentage = 100;
          dlgPrgrs.SetLine(1, "Finished loading Fanart !");
          dlgPrgrs.ShowWaitCursor = false;
          Thread.Sleep(500);
          dlgPrgrs.Close();
        }
      }
    }
示例#5
0
 public static ArrayList FindActor(string personname, string wscript)
 {
   var listUrl = new ArrayList();
   if (string.IsNullOrEmpty(wscript)) return listUrl;
   LogMyFilms.Debug("FindActor() with name = '" + personname + "', grabberfile = '" + wscript + "'");
   var grab = new Grabber_URLClass();
   try
   {
     listUrl = grab.ReturnURL(personname, wscript, 1, false, "");
   }
   catch (Exception ex)
   {
     LogMyFilms.ErrorException("FindActor() - exception = '" + ex.Message + "'", ex);
   }
   return listUrl;
 }
示例#6
0
    //-------------------------------------------------------------------------------------------
    //  Grab URL Internet Movie Informations and update the XML database and refresh screen
    //  -> Search and select matching movie
    //-------------------------------------------------------------------------------------------        
    public static void grabb_Internet_Informations_Search(string fullMovieName, int GetID, string wscript, string fullMoviePath, GrabType grabtype, Searchtitles sTitles, GUIAnimation searchanimation)
    {
      if (string.IsNullOrEmpty(wscript)) return;
      LogMyFilms.Debug("grabb_Internet_Informations_Search() with title = '" + fullMovieName + "', grabberfile = '" + wscript + "'");
      string movieName = fullMovieName;
      string movieHierarchy = string.Empty;
      string moviePath = fullMoviePath;
      if (MyFilms.conf.TitleDelim.Length > 0)
      {
        movieName = fullMovieName.Substring(fullMovieName.LastIndexOf(MyFilms.conf.TitleDelim, StringComparison.Ordinal) + 1).Trim();
        movieHierarchy = fullMovieName.Substring(0, fullMovieName.LastIndexOf(MyFilms.conf.TitleDelim, StringComparison.Ordinal) + 1).Trim();
      }
      var grab = new Grabber.Grabber_URLClass();
      Grabber_URLClass.IMDBUrl wurl;
      var listUrl = new ArrayList();

      new Thread(delegate()
        {
          SetProcessAnimationStatus(true, searchanimation); // GUIWaitCursor.Init(); GUIWaitCursor.Show();
          try
          {
            // listUrl = Grab.ReturnURL(MovieName, wscript, 1, !MyFilms.conf.StrGrabber_Always, MoviePath); // MoviePath only when nfo reader used !!!
            listUrl = grab.ReturnURL(movieName, wscript, 1, !MyFilms.conf.StrGrabber_Always, "");
          }
          catch (Exception ex)
          {
            LogMyFilms.ErrorException("grabb_Internet_Details_Search() - exception = '" + ex.Message + "'", ex);
          }
          SetProcessAnimationStatus(false, searchanimation); // GUIWaitCursor.Hide();

          int listCount = listUrl.Count;
          if (!MyFilms.conf.StrGrabber_Always)
            listCount = 2;
          switch (listCount)
          {
            case 1: // only one match -> grab details without user interaction
              wurl = (Grabber.Grabber_URLClass.IMDBUrl)listUrl[0];
              grabb_Internet_Details_Informations(wurl.URL, movieHierarchy, wscript, GetID, false, grabtype, sTitles, searchanimation);
              break;
            case 0:
              break;
            default:
              #region manual choice
              var dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);
              var choiceViewMenu = new List<string>();
              choiceViewMenu.Clear();

              if (dlg == null) return;
              dlg.Reset();
              dlg.SetHeading(GUILocalizeStrings.Get(924)); // menu
              dlg.Add("  *****  " + GUILocalizeStrings.Get(1079860) + "  *****  "); //manual selection
              choiceViewMenu.Add("manual selection");

              for (int i = 0; i < listUrl.Count; i++)
              {
                wurl = (Grabber.Grabber_URLClass.IMDBUrl)listUrl[i];
                if (wurl.Director.Contains(MyFilms.r[MyFilms.conf.StrIndex]["Director"].ToString()) && wurl.Year.Contains(MyFilms.r[MyFilms.conf.StrIndex]["Year"].ToString()) && !MyFilms.conf.StrGrabber_Always)
                {
                  if (dlg.SelectedLabel == -1)
                    dlg.SelectedLabel = i + 1;
                  else
                    dlg.SelectedLabel = -2;
                }
                string viewTitle = wurl.Title;
                if (!string.IsNullOrEmpty(wurl.Year)) viewTitle += " (" + wurl.Year + ")";
                if (!string.IsNullOrEmpty(wurl.Options)) viewTitle += " - " + wurl.Options + "";
                dlg.Add(viewTitle);
                choiceViewMenu.Add(wurl.Title);
              }
              string[] split = movieName.Trim().Split(new Char[] { ' ', '-' }, StringSplitOptions.RemoveEmptyEntries);
              foreach (string s in split.Where(s => s.Length > 2))
              {
                dlg.Add(GUILocalizeStrings.Get(137) + " '" + s + "'"); // add words from title as search items
                choiceViewMenu.Add(s);
              }
              if (grabtype != GrabType.Person)
              {
                #region add all titles as alternative search expressions
                if (!string.IsNullOrEmpty(sTitles.OriginalTitle) && !choiceViewMenu.Contains(sTitles.OriginalTitle))
                {
                  dlg.Add(GUILocalizeStrings.Get(137) + " '" + sTitles.OriginalTitle + "'"); //search
                  choiceViewMenu.Add(sTitles.OriginalTitle);
                }
                if (!string.IsNullOrEmpty(sTitles.TranslatedTitle) && !choiceViewMenu.Contains(sTitles.TranslatedTitle))
                {
                  dlg.Add(GUILocalizeStrings.Get(137) + " '" + sTitles.TranslatedTitle + "'");
                  choiceViewMenu.Add(sTitles.TranslatedTitle);
                }
                if (!string.IsNullOrEmpty(sTitles.FormattedTitle) && !choiceViewMenu.Contains(sTitles.FormattedTitle))
                {
                  dlg.Add(GUILocalizeStrings.Get(137) + " '" + sTitles.FormattedTitle + "'");
                  choiceViewMenu.Add(sTitles.FormattedTitle);
                }
                if (!string.IsNullOrEmpty(sTitles.MovieDirectoryTitle) && !choiceViewMenu.Contains(sTitles.MovieDirectoryTitle))
                {
                  dlg.Add(GUILocalizeStrings.Get(137) + " '" + sTitles.MovieDirectoryTitle + "'");
                  choiceViewMenu.Add(sTitles.MovieDirectoryTitle);
                }
                if (!string.IsNullOrEmpty(sTitles.MovieFileTitle) && !choiceViewMenu.Contains(sTitles.MovieFileTitle))
                {
                  dlg.Add(GUILocalizeStrings.Get(137) + " '" + sTitles.MovieFileTitle + "'");
                  choiceViewMenu.Add(sTitles.MovieFileTitle);
                }
                #endregion
              }

              if (!(dlg.SelectedLabel > -1))
              {
                dlg.SelectedLabel = -1;
                dlg.DoModal(GetID);
              }
              if (dlg.SelectedLabel == 0)
              {
                VirtualKeyboard keyboard = (VirtualKeyboard)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_VIRTUAL_KEYBOARD);
                if (null == keyboard) return;
                keyboard.Reset();
                keyboard.SetLabelAsInitialText(false); // set to false, otherwise our intial text is cleared
                keyboard.Text = movieName;
                keyboard.DoModal(GetID);
                if (keyboard.IsConfirmed && keyboard.Text.Length > 0)
                  grabb_Internet_Informations_Search(keyboard.Text, GetID, wscript, moviePath, grabtype, sTitles, searchanimation);
                break;
              }
              if (dlg.SelectedLabel > 0 && dlg.SelectedLabel <= listUrl.Count)
              {
                wurl = (Grabber_URLClass.IMDBUrl)listUrl[dlg.SelectedLabel - 1];
                grabb_Internet_Details_Informations(wurl.URL, movieHierarchy, wscript, GetID, true, grabtype, sTitles, searchanimation);
                break;
              }
              if (dlg.SelectedLabel > listUrl.Count)
              {
                //VirtualKeyboard keyboard = (VirtualKeyboard)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_VIRTUAL_KEYBOARD);
                //if (null == keyboard) return;
                //keyboard.Reset();
                //keyboard.Text = dlg.SelectedLabelText;
                //// keyboard.Text = choiceViewMenu[dlg.SelectedLabel];
                //keyboard.DoModal(GetID);
                //if ((keyboard.IsConfirmed) && (keyboard.Text.Length > 0))
                //  grabb_Internet_Informations_Search(keyboard.Text, GetID, wscript, MoviePath, grabtype, sTitles);
                string strChoice = choiceViewMenu[dlg.SelectedLabel];
                LogMyFilms.Debug("grabb_Internet_Informations_Search(): (re)search with new search expression: '" + strChoice + "'");
                grabb_Internet_Informations_Search(strChoice, GetID, wscript, moviePath, grabtype, sTitles, searchanimation);
              }
              break;
              #endregion
          }
          GUIWindowManager.SendThreadCallbackAndWait((p1, p2, data) => { return 0; }, 0, 0, null);
        }) { Name = "MyFilmsDetailsLoader", IsBackground = true }.Start();
    }
示例#7
0
    //-------------------------------------------------------------------------------------------
    //  Grab Internet Movie Details Informations and update the XML database and refresh screen
    //-------------------------------------------------------------------------------------------        
    public static void grabb_Internet_Details_Informations(string url, string moviehead, string wscript, int GetID, bool interactive, GrabType grabtype, Searchtitles sTitles, GUIAnimation searchanimation)
    {
      LogMyFilms.Debug("launching (grabb_Internet_Details_Informations) with url = '" + url + "', moviehead = '" + moviehead + "', wscript = '" + wscript + "', GetID = '" + GetID + "', interactive = '" + interactive + "'");

      #region set environment
      var Grab = new Grabber_URLClass();
      var Result = new string[80];
      string title = string.Empty;
      string ttitle = string.Empty;
      string wtitle = string.Empty;
      int year = 0;
      string director = string.Empty;
      // Those settings were used in the past from AMCupdater settings - now they exist in MF config as primary source!
      // XmlConfig XmlConfig = new XmlConfig();
      // string Img_Path = XmlConfig.ReadAMCUXmlConfig(MyFilms.conf.StrAMCUpd_cnf, "Image_Download_Filename_Prefix", "");
      // string Img_Path_Type = XmlConfig.ReadAMCUXmlConfig(MyFilms.conf.StrAMCUpd_cnf, "Store_Image_With_Relative_Path", "false");

      string downLoadPath; //downLoadPath = MyFilmsSettings.GetPath(MyFilmsSettings.Path.MyFilmsPath);
      if (interactive)
        downLoadPath = Path.GetTempPath();
      else
      {
        downLoadPath = grabtype == GrabType.Person
                         ? MyFilms.conf.StrPathArtist
                         : MyFilms.conf.StrPathImg + "\\" + MyFilms.conf.StrPicturePrefix;
      }
      LogMyFilms.Debug("Grabber - GetDetail: OverrideLanguage = '" + MyFilms.conf.GrabberOverrideLanguage + "', OverridePersonLimit = '" + MyFilms.conf.GrabberOverridePersonLimit + "', OverrideTitleLimit = '" + MyFilms.conf.GrabberOverrideTitleLimit + "', Get Roles = '" + MyFilms.conf.GrabberOverrideGetRoles + "'");
      LogMyFilms.Debug("Grabber - GetDetail: script = '" + wscript + "', url = '" + url + "', download path = '" + downLoadPath + "'");
      #endregion

      new Thread(delegate()
          {
            #region load internet data
            var dlgPrgrs = (GUIDialogProgress)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_PROGRESS);
            if (interactive)
            {
              if (dlgPrgrs != null)
              {
                dlgPrgrs.Reset();
                dlgPrgrs.DisplayProgressBar = false;
                dlgPrgrs.ShowWaitCursor = true;
                dlgPrgrs.DisableCancel(true);
                dlgPrgrs.SetHeading(string.Format("{0} - {1}", "MyFilms", "Internet Updates"));
                dlgPrgrs.SetLine(1, "Loading Details ...");
                dlgPrgrs.Percentage = 0;
                dlgPrgrs.NeedRefresh();
                dlgPrgrs.ShouldRenderLayer();
                dlgPrgrs.StartModal(GUIWindowManager.ActiveWindow);
              }

            }
            try
            {
              Result = Grab.GetDetail(url, downLoadPath, wscript, true, MyFilms.conf.GrabberOverrideLanguage, MyFilms.conf.GrabberOverridePersonLimit, MyFilms.conf.GrabberOverrideTitleLimit, MyFilms.conf.GrabberOverrideGetRoles, null);
            }
            catch (Exception ex) { LogMyFilms.ErrorException("grabb_Internet_Details_Information() - exception = '" + ex.Message + "'", ex); }

            if (interactive)
            {
              // SetProcessAnimationStatus(false, searchanimation);
              if (dlgPrgrs != null)
              {
                dlgPrgrs.ShowWaitCursor = false;
                dlgPrgrs.Close();
              }
            }

            // copy mapped values to original values
            for (int i = 0; i < 40; i++)
            {
              LogMyFilms.Debug("Grabber Details: original: '" + i + "' - '" + Result[i] + "'");
              Result[i] = Result[i + 40];
              LogMyFilms.Debug("Grabber Details: mapped  : '" + i + "' - '" + Result[i] + "'");
            }
            LogMyFilms.Debug("Grab Internet Information done for title/ttitle: " + MyFilms.r[MyFilms.conf.StrIndex]["OriginalTitle"] + "/" + MyFilms.r[MyFilms.conf.StrIndex]["TranslatedTitle"]);

            // string Title_Group = XmlConfig.ReadAMCUXmlConfig(MyFilms.conf.StrAMCUpd_cnf, "Folder_Name_Is_Group_Name", "false");
            // string Title_Group_Apply = XmlConfig.ReadAMCUXmlConfig(MyFilms.conf.StrAMCUpd_cnf, "Group_Name_Applies_To", "");
            #endregion

            if (grabtype == GrabType.Details || grabtype == GrabType.All) // grabtype "all" includes cover
            {
              #region Movie Details

              string strChoice = "all"; // defaults to "all", if no other choice
              bool onlyselected = false;
              bool onlymissing = false;
              bool onlynonempty = false;
              var choiceViewMenu = new List<string>();
              var updateItems = new List<string>(); // store properties to update for later use ...
              const int iPropertyLengthLimit = 33;
              var PropertyList = new string[] {
                        "OriginalTitle", "TranslatedTitle", "Picture", "Description", "Rating", "Actors", "Director",
                        "Producer", "Year", "Country", "Category", "URL", "ImageURL", "Writer", "Comments", "Languages",
                        "TagLine", "Certification", "IMDB_Id", "IMDB_Rank", "Studio", "Edition", "Fanart", "Generic1",
                        "Generic2", "Generic3", "TranslatedTitleAllNames", "TranslatedTitleAllValues",
                        "CertificationAllNames", "CertificationAllValues", "MultiPosters", "Photos", "PersonImages",
                        "MultiFanart", "Trailer", "TMDB_Id", "Runtime", "Collection", "CollectionImageURL", "PictureURL"
                      };

              if (interactive) // Dialog only in interactive mode
              {
                #region interactive selection dialog
                var dlgmenu = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);
                bool returnToMainDialog = false; // by default do NOT repeat the dialog - only if returning from sub dialogs
                do
                {
                  #region set main selection dialog for options
                  returnToMainDialog = false;
                  choiceViewMenu.Clear();
                  dlgmenu.Reset();
                  dlgmenu.SetHeading(GUILocalizeStrings.Get(10798797)); // Choose update option ...
                  dlgmenu.Add(" *** " + GUILocalizeStrings.Get(10798734) + " *** ");
                  choiceViewMenu.Add("all");
                  dlgmenu.Add(" *** " + GUILocalizeStrings.Get(10798735) + " *** ");
                  choiceViewMenu.Add("missing");
                  dlgmenu.Add(" *** " + GUILocalizeStrings.Get(10798730) + " *** ");
                  choiceViewMenu.Add("all-onlynewdata");
                  // disabled, as we now have the multiselect dialog
                  //dlgmenu.Add(" *** " + GUILocalizeStrings.Get(10798798) + " *** "); // Select single field for update ...
                  //choiceViewMenu.Add("singlefield");
                  if (File.Exists(GUIGraphicsContext.Skin + @"\MyFilmsDialogMultiSelect.xml"))
                  {
                    dlgmenu.Add(" *** " + GUILocalizeStrings.Get(10798799) + " *** "); // Select multiple fields for update ...
                    choiceViewMenu.Add("multiplefields");
                  }
                  dlgmenu.DoModal(GetID);
                  if (dlgmenu.SelectedLabel == -1) return;
                  strChoice = choiceViewMenu[dlgmenu.SelectedLabel];

                  #endregion

                  if (strChoice == "singlefield")
                  {
                    #region populate select menu, if user has chosen to ...

                    string strOldValue = "";
                    string strNewValue = "";

                    var dlgSelect = (GUIDialogSelect)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_SELECT); // GUIDialogSelect2 dlgmenu = (GUIDialogSelect2)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_SELECT2);  
                    if (dlgSelect == null) return;
                    choiceViewMenu.Clear();
                    dlgSelect.Reset();
                    dlgSelect.SetHeading(GUILocalizeStrings.Get(10798732)); // choose property to update
                    dlgSelect.SetButtonLabel("");

                    int i = 0;
                    foreach (string wProperty in PropertyList)
                    {
                      try
                      {
                        strOldValue = MyFilms.r[MyFilms.conf.StrIndex][wProperty].ToString() ?? "";
                        strNewValue = Result[i];
                        if (i == 2) strNewValue = Result[12];
                        if (strNewValue == null) strNewValue = "";

                        if ( // make sure, only supported fields are offered to user for update
                          wProperty != "ImageURL" && !wProperty.Contains("Sub") && !wProperty.Contains("All") &&
                          !wProperty.Contains("Generic") && !wProperty.Contains("Empty") &&
                          ((wProperty != "TagLine" && wProperty != "Certification" && wProperty != "Writer" &&
                            wProperty != "Studio" && wProperty != "Edition" && wProperty != "IMDB_Id" &&
                            wProperty != "IMDB_Rank" && wProperty != "TMDB_Id") ||
                           MyFilms.conf.StrFileType == Configuration.CatalogType.AntMovieCatalog4Xtended) &&
                          wProperty != "Fanart" && wProperty != "Aspectratio" && wProperty != "MultiPosters"
                          // set to enabled to get proper selection - WIP
                          && wProperty != "Photos" && wProperty != "PersonImages" && wProperty != "MultiFanart" &&
                          wProperty != "Trailer") //  && wProperty != "Runtime" && wProperty != "Collection"
                        {
                          dlgSelect.Add(BaseMesFilms.TranslateColumn(wProperty) + ": '" + Helper.LimitString(strOldValue.Replace(Environment.NewLine, " # "), iPropertyLengthLimit) + "' -> '" + Helper.LimitString(strNewValue.Replace(Environment.NewLine, " # "), iPropertyLengthLimit) + "'");
                          choiceViewMenu.Add(wProperty);
                          LogMyFilms.Debug("GrabberUpdate - Add (" + wProperty + "): '" + strOldValue + "' -> '" + strNewValue + "'");
                        }
                        else
                        {
                          LogMyFilms.Debug("GrabberUpdate - not added (unsupported) - (" + wProperty + "): '" + strOldValue + "' -> '" + strNewValue + "'");
                        }
                      }
                      catch (Exception ex)
                      {
                        LogMyFilms.Debug("GrabberUpdate - cannot add Property '" + wProperty + "' to Selectionmenu - reason: " + ex.Message);
                      }
                      i = i + 1;
                    }

                    dlgSelect.DoModal(GetID);
                    if (dlgSelect.SelectedLabel == -1) returnToMainDialog = true; // Nothing was selected - return to main selection menu
                    strChoice = choiceViewMenu[dlgmenu.SelectedLabel];

                    #endregion
                  }

                  if (choiceViewMenu[dlgmenu.SelectedLabel] == "multiplefields")
                  {
                    #region populate multi selection menu, if user has chosen to ...

                    string strOldValue = "";
                    string strNewValue = "";

                    var dlgMultiSelectOld = (GUIWindow)GUIWindowManager.GetWindow(2100);
                    var dlgMultiSelect = new GUIDialogMultiSelect();
                    if (dlgMultiSelect == null) return;
                    dlgMultiSelect.Init();
                    GUIWindowManager.Replace(2100, dlgMultiSelect);
                    try
                    {
                      dlgMultiSelect.Reset();
                      dlgMultiSelect.SetHeading(GUILocalizeStrings.Get(10798732)); // choose property to update

                      int i = 0;
                      foreach (string wProperty in PropertyList)
                      {
                        try
                        {
                          strOldValue = MyFilms.r[MyFilms.conf.StrIndex][wProperty].ToString() ?? "";
                          strNewValue = Result[i];
                          if (i == (int)Grabber_URLClass.Grabber_Output.PicturePathLong) strNewValue = Result[(int)Grabber_URLClass.Grabber_Output.PicturePathShort];
                          if (strNewValue == null) strNewValue = "";

                          if ( // make sure, only supported fields are offered to user for update
                            wProperty != "ImageURL" && !wProperty.Contains("Sub") && !wProperty.Contains("All") &&
                            !wProperty.Contains("Generic") && !wProperty.Contains("Empty") &&
                            ((wProperty != "TagLine" && wProperty != "Certification" && wProperty != "Writer" &&
                              wProperty != "Studio" && wProperty != "Edition" && wProperty != "IMDB_Id" &&
                              wProperty != "IMDB_Rank" && wProperty != "TMDB_Id") ||
                             MyFilms.conf.StrFileType == Configuration.CatalogType.AntMovieCatalog4Xtended) &&
                            wProperty != "Fanart" && wProperty != "Aspectratio" && wProperty != "MultiPosters"
                            // set to enabled to get proper selection - WIP
                            && wProperty != "Photos" && wProperty != "PersonImages" && wProperty != "MultiFanart" &&
                            wProperty != "Trailer") //  && wProperty != "Collection" && wProperty != "CollectionImageURL"
                          {
                            var pItem = new GUIListItem(wProperty);
                            pItem.TVTag = wProperty;
                            if (i == (int)Grabber_URLClass.Grabber_Output.PicturePathLong) pItem.IconImage = Result[(int)Grabber_URLClass.Grabber_Output.PicturePathLong];
                            pItem.Selected = false;
                            pItem.Label = BaseMesFilms.TranslateColumn(wProperty) + ": '" + Helper.LimitString(strOldValue.Replace(Environment.NewLine, " # "), iPropertyLengthLimit) + "' -> '" + Helper.LimitString(strNewValue.Replace(Environment.NewLine, " # "), iPropertyLengthLimit) + "'";
                            dlgMultiSelect.Add(pItem);
                            LogMyFilms.Debug("GrabberUpdate - Add (" + wProperty + "): '" + strOldValue + "' -> '" + strNewValue + "'");
                          }
                          else
                          {
                            LogMyFilms.Debug("GrabberUpdate - not added (unsupported) - (" + wProperty + "): '" + strOldValue + "' -> '" + strNewValue + "'");
                          }
                        }
                        catch (Exception ex)
                        {
                          LogMyFilms.Debug("GrabberUpdate - cannot add Property '" + wProperty + "' to Selectionmenu - reason: " + ex.Message);
                        }
                        i = i + 1;
                      }

                      dlgMultiSelect.DoModal(GetID);
                      updateItems.AddRange(from t in dlgMultiSelect.ListItems where t.Selected select t.TVTag.ToString());
                      LogMyFilms.Debug("GrabberUpdate - '" + updateItems.Count + "' updateItems selected !");
                      if (dlgMultiSelect.DialogModalResult == ModalResult.Cancel) return; // user cancelled
                      if (dlgMultiSelect.DialogModalResult == ModalResult.OK && updateItems.Count == 0) return; // Nothing was selected
                      if (dlgMultiSelect.DialogModalResult != ModalResult.OK) returnToMainDialog = true; // user wants to return to options menu
                    }
                    finally
                    {
                      GUIWindowManager.Replace(2100, dlgMultiSelectOld);
                    }

                    #endregion
                  }

                  switch (strChoice) // either an update type - or a single property to update
                  {
                    #region switch update options

                    case "all":
                      onlyselected = false;
                      onlymissing = false;
                      onlynonempty = false;
                      break;
                    case "missing":
                      onlyselected = false;
                      onlymissing = true;
                      onlynonempty = false;
                      break;
                    case "all-onlynewdata":
                      onlyselected = false;
                      onlymissing = false;
                      onlynonempty = true;
                      break;
                    default:
                      onlyselected = true;
                      onlymissing = false;
                      onlynonempty = false;
                      break;

                    #endregion
                  }
                }
                while (returnToMainDialog);
                LogMyFilms.Debug("GrabInternetDetails - interactive choice: '" + strChoice + "', onlyselected = '" + onlyselected + "', onlymissing = '" + onlymissing + "', onlynonempty = '" + onlynonempty + "'");
                #endregion
              }

              #region load details data

              // ********************************** now load data, if requested ! ******************************
              if (IsUpdateRequired("OriginalTitle", strChoice, MyFilms.r[MyFilms.conf.StrIndex]["OriginalTitle"].ToString(), Result[(int)Grabber_URLClass.Grabber_Output.OriginalTitle], grabtype, onlyselected, onlymissing, onlynonempty, updateItems))
              {
                title = Result[(int)Grabber_URLClass.Grabber_Output.OriginalTitle];
                wtitle = MyFilms.r[MyFilms.conf.StrIndex]["OriginalTitle"].ToString();
                if (wtitle.Contains(MyFilms.conf.TitleDelim)) wtitle = wtitle.Substring(wtitle.LastIndexOf(MyFilms.conf.TitleDelim) + 1);
                if (wtitle != title) Remove_Backdrops_Fanart(wtitle, true);

                // Add Collection from internet grabber
                if (!string.IsNullOrEmpty(Result[(int)Grabber_URLClass.Grabber_Output.Collection]) && string.IsNullOrEmpty(moviehead))
                {
                  moviehead = Result[(int)Grabber_URLClass.Grabber_Output.Collection] + @"\";
                }
                if (MyFilms.conf.StrTitle1 == "OriginalTitle") MyFilms.r[MyFilms.conf.StrIndex]["OriginalTitle"] = moviehead + title;
                else MyFilms.r[MyFilms.conf.StrIndex]["OriginalTitle"] = title;
              }

              if (IsUpdateRequired("TranslatedTitle", strChoice, MyFilms.r[MyFilms.conf.StrIndex]["TranslatedTitle"].ToString(), Result[(int)Grabber_URLClass.Grabber_Output.TranslatedTitle], grabtype, onlyselected, onlymissing, onlynonempty, updateItems))
              {
                ttitle = Result[(int)Grabber_URLClass.Grabber_Output.TranslatedTitle];
                if ("TranslatedTitle" == strChoice)
                {
                  if (string.IsNullOrEmpty(ttitle) && MyFilms.conf.StrTitle1 == "TranslatedTitle" && !string.IsNullOrEmpty(MyFilms.r[MyFilms.conf.StrIndex]["TranslatedTitle"].ToString())) // Added to fill ttitle with otitle in case ttitle is empty and mastertitle = ttitle and mastertitle is empty
                    ttitle = Result[(int)Grabber_URLClass.Grabber_Output.OriginalTitle];
                }
                wtitle = MyFilms.r[MyFilms.conf.StrIndex]["TranslatedTitle"].ToString();
                if (wtitle.Contains(MyFilms.conf.TitleDelim)) wtitle = wtitle.Substring(wtitle.LastIndexOf(MyFilms.conf.TitleDelim) + 1);
                if (wtitle != ttitle) Remove_Backdrops_Fanart(wtitle, true);
                if (MyFilms.conf.StrTitle1 == "TranslatedTitle")
                {
                  // Add Collection from internet grabber
                  if (!string.IsNullOrEmpty(Result[(int)Grabber_URLClass.Grabber_Output.Collection]) && string.IsNullOrEmpty(moviehead))
                  {
                    moviehead = Result[(int)Grabber_URLClass.Grabber_Output.Collection] + @"\";
                  }
                  MyFilms.r[MyFilms.conf.StrIndex]["TranslatedTitle"] = moviehead + ttitle;
                }
                else MyFilms.r[MyFilms.conf.StrIndex]["TranslatedTitle"] = ttitle;
              }

              //if (IsUpdateRequired("Collection", strChoice, MyFilms.r[MyFilms.conf.StrIndex]["Collection"].ToString(), Result[(int)Grabber_URLClass.Grabber_Output.Collection], grabtype, onlyselected, onlymissing, onlynonempty, updateItems))
              //  MyFilms.r[MyFilms.conf.StrIndex]["Collection"] = Result[(int)Grabber_URLClass.Grabber_Output.Collection];

              if (IsUpdateRequired("Description", strChoice, MyFilms.r[MyFilms.conf.StrIndex]["Description"].ToString(), Result[(int)Grabber_URLClass.Grabber_Output.Description], grabtype, onlyselected, onlymissing, onlynonempty, updateItems))
                MyFilms.r[MyFilms.conf.StrIndex]["Description"] = Result[(int)Grabber_URLClass.Grabber_Output.Description];

              if (IsUpdateRequired("Rating", strChoice, MyFilms.r[MyFilms.conf.StrIndex]["Rating"].ToString(), Result[(int)Grabber_URLClass.Grabber_Output.Rating], grabtype, onlyselected, onlymissing, onlynonempty, updateItems))
              {
                if (Result[(int)Grabber_URLClass.Grabber_Output.Rating].Length > 0)
                {
                  var provider = new NumberFormatInfo();
                  provider.NumberDecimalSeparator = ".";
                  provider.NumberDecimalDigits = 1;
                  decimal wnote = Convert.ToDecimal(Result[(int)Grabber_URLClass.Grabber_Output.Rating], provider);
                  if (string.IsNullOrEmpty(MyFilms.r[MyFilms.conf.StrIndex]["Rating"].ToString()) || !onlymissing)
                    MyFilms.r[MyFilms.conf.StrIndex]["Rating"] = string.Format("{0:F1}", wnote);
                }
              }
              if (IsUpdateRequired("Actors", strChoice, MyFilms.r[MyFilms.conf.StrIndex]["Actors"].ToString(), Result[(int)Grabber_URLClass.Grabber_Output.Actors], grabtype, onlyselected, onlymissing, onlynonempty, updateItems))
                if (string.IsNullOrEmpty(MyFilms.r[MyFilms.conf.StrIndex]["Actors"].ToString()) || !onlymissing)
                  MyFilms.r[MyFilms.conf.StrIndex]["Actors"] = Result[(int)Grabber_URLClass.Grabber_Output.Actors];
              if (IsUpdateRequired("Director", strChoice, MyFilms.r[MyFilms.conf.StrIndex]["Director"].ToString(), Result[(int)Grabber_URLClass.Grabber_Output.Director], grabtype, onlyselected, onlymissing, onlynonempty, updateItems))
              {
                director = Result[(int)Grabber_URLClass.Grabber_Output.Director];
                MyFilms.r[MyFilms.conf.StrIndex]["Director"] = Result[(int)Grabber_URLClass.Grabber_Output.Director];
              }
              if (IsUpdateRequired("Producer", strChoice, MyFilms.r[MyFilms.conf.StrIndex]["Producer"].ToString(), Result[(int)Grabber_URLClass.Grabber_Output.Producer], grabtype, onlyselected, onlymissing, onlynonempty, updateItems))
                MyFilms.r[MyFilms.conf.StrIndex]["Producer"] = Result[(int)Grabber_URLClass.Grabber_Output.Producer];
              if (IsUpdateRequired("Year", strChoice, MyFilms.r[MyFilms.conf.StrIndex]["Year"].ToString(), Result[(int)Grabber_URLClass.Grabber_Output.Year], grabtype, onlyselected, onlymissing, onlynonempty, updateItems))
              {
                try { year = Convert.ToInt16(Result[(int)Grabber_URLClass.Grabber_Output.Year]); }
                catch { year = 1900; }
                MyFilms.r[MyFilms.conf.StrIndex]["Year"] = year.ToString();
              }

              if (IsUpdateRequired("Country", strChoice, MyFilms.r[MyFilms.conf.StrIndex]["Country"].ToString(), Result[(int)Grabber_URLClass.Grabber_Output.Country], grabtype, onlyselected, onlymissing, onlynonempty, updateItems))
                MyFilms.r[MyFilms.conf.StrIndex]["Country"] = Result[(int)Grabber_URLClass.Grabber_Output.Country];
              if (IsUpdateRequired("Category", strChoice, MyFilms.r[MyFilms.conf.StrIndex]["Category"].ToString(), Result[(int)Grabber_URLClass.Grabber_Output.Category], grabtype, onlyselected, onlymissing, onlynonempty, updateItems))
                MyFilms.r[MyFilms.conf.StrIndex]["Category"] = Result[(int)Grabber_URLClass.Grabber_Output.Category];
              if (IsUpdateRequired("URL", strChoice, MyFilms.r[MyFilms.conf.StrIndex]["URL"].ToString(), Result[(int)Grabber_URLClass.Grabber_Output.URL], grabtype, onlyselected, onlymissing, onlynonempty, updateItems))
                if (MyFilms.conf.StrStorage != "URL")
                  MyFilms.r[MyFilms.conf.StrIndex]["URL"] = Result[(int)Grabber_URLClass.Grabber_Output.URL];
              if (IsUpdateRequired("Comments", strChoice, MyFilms.r[MyFilms.conf.StrIndex]["Comments"].ToString(), Result[(int)Grabber_URLClass.Grabber_Output.Comments], grabtype, onlyselected, onlymissing, onlynonempty, updateItems))
                MyFilms.r[MyFilms.conf.StrIndex]["Comments"] = Result[(int)Grabber_URLClass.Grabber_Output.Comments];
              if (IsUpdateRequired("Languages", strChoice, MyFilms.r[MyFilms.conf.StrIndex]["Languages"].ToString(), Result[(int)Grabber_URLClass.Grabber_Output.Language], grabtype, onlyselected, onlymissing, onlynonempty, updateItems))
                MyFilms.r[MyFilms.conf.StrIndex]["Languages"] =
                  Result[(int)Grabber_URLClass.Grabber_Output.Language];

              #region AMC4 extended fields
              if (MyFilms.conf.StrFileType == Configuration.CatalogType.AntMovieCatalog4Xtended)
              {
                if (IsUpdateRequired("Writer", strChoice, MyFilms.r[MyFilms.conf.StrIndex]["Writer"].ToString(), Result[(int)Grabber_URLClass.Grabber_Output.Writer], grabtype, onlyselected, onlymissing, onlynonempty, updateItems))
                  MyFilms.r[MyFilms.conf.StrIndex]["Writer"] = Result[(int)Grabber_URLClass.Grabber_Output.Writer];
                if (IsUpdateRequired("TagLine", strChoice, MyFilms.r[MyFilms.conf.StrIndex]["TagLine"].ToString(), Result[(int)Grabber_URLClass.Grabber_Output.Tagline], grabtype, onlyselected, onlymissing, onlynonempty, updateItems))
                  MyFilms.r[MyFilms.conf.StrIndex]["TagLine"] = Result[(int)Grabber_URLClass.Grabber_Output.Tagline];
                if (IsUpdateRequired("Certification", strChoice, MyFilms.r[MyFilms.conf.StrIndex]["Certification"].ToString(), Result[(int)Grabber_URLClass.Grabber_Output.Certification], grabtype, onlyselected, onlymissing, onlynonempty, updateItems))
                  MyFilms.r[MyFilms.conf.StrIndex]["Certification"] = Result[(int)Grabber_URLClass.Grabber_Output.Certification];
                if (IsUpdateRequired("IMDB_Id", strChoice, MyFilms.r[MyFilms.conf.StrIndex]["IMDB_Id"].ToString(), Result[(int)Grabber_URLClass.Grabber_Output.IMDB_Id], grabtype, onlyselected, onlymissing, onlynonempty, updateItems))
                  MyFilms.r[MyFilms.conf.StrIndex]["IMDB_Id"] = Result[(int)Grabber_URLClass.Grabber_Output.IMDB_Id];
                if (IsUpdateRequired("IMDB_Rank", strChoice, MyFilms.r[MyFilms.conf.StrIndex]["IMDB_Rank"].ToString(), Result[(int)Grabber_URLClass.Grabber_Output.IMDB_Rank], grabtype, onlyselected, onlymissing, onlynonempty, updateItems))
                  MyFilms.r[MyFilms.conf.StrIndex]["IMDB_Rank"] = Result[(int)Grabber_URLClass.Grabber_Output.IMDB_Rank];
                if (IsUpdateRequired("TMDB_Id", strChoice, MyFilms.r[MyFilms.conf.StrIndex]["TMDB_Id"].ToString(), Result[(int)Grabber_URLClass.Grabber_Output.TMDB_Id], grabtype, onlyselected, onlymissing, onlynonempty, updateItems))
                  MyFilms.r[MyFilms.conf.StrIndex]["TMDB_Id"] = Result[(int)Grabber_URLClass.Grabber_Output.TMDB_Id];
                if (IsUpdateRequired("Studio", strChoice, MyFilms.r[MyFilms.conf.StrIndex]["Studio"].ToString(), Result[(int)Grabber_URLClass.Grabber_Output.Studio], grabtype, onlyselected, onlymissing, onlynonempty, updateItems))
                  MyFilms.r[MyFilms.conf.StrIndex]["Studio"] = Result[(int)Grabber_URLClass.Grabber_Output.Studio];
                if (IsUpdateRequired("Edition", strChoice, MyFilms.r[MyFilms.conf.StrIndex]["Edition"].ToString(), Result[(int)Grabber_URLClass.Grabber_Output.Edition], grabtype, onlyselected, onlymissing, onlynonempty, updateItems))
                  MyFilms.r[MyFilms.conf.StrIndex]["Edition"] = Result[(int)Grabber_URLClass.Grabber_Output.Edition];
                //if (IsUpdateRequired("Fanart", strChoice, MyFilms.r[MyFilms.conf.StrIndex]["Fanart"].ToString(), Result[(int)Grabber_URLClass.Grabber_Output.Fanart], grabtype, onlyselected, onlymissing, onlynonempty, updateItems)) 
                //  MyFilms.r[MyFilms.conf.StrIndex]["Fanart"] = Result[(int)Grabber_URLClass.Grabber_Output.Fanart];
                //if (IsUpdateRequired("Trailer", strChoice, MyFilms.r[MyFilms.conf.StrIndex]["Trailer"].ToString(), Result[(int)Grabber_URLClass.Grabber_Output.Trailer], grabtype, onlyselected, onlymissing, onlynonempty, updateItems)) 
                //  MyFilms.r[MyFilms.conf.StrIndex]["Trailer"] = Result[(int)Grabber_URLClass.Grabber_Output.Trailer];
              }
              #endregion

              if (grabtype == GrabType.All && IsUpdateRequired("Picture", strChoice, MyFilms.r[MyFilms.conf.StrIndex]["Picture"].ToString(), Result[(int)Grabber_URLClass.Grabber_Output.PicturePathLong], grabtype, onlyselected, onlymissing, onlynonempty, updateItems))
                grabb_Internet_Details_Informations_Cover(Result, interactive, GetID, wscript, grabtype, sTitles);

              #endregion

              #endregion
            }

            if (grabtype == GrabType.Person)
            {
              #region Person

              #region Load existing person info
              IMDBActor person = null;
              var actorList = new ArrayList();
              VideoDatabase.GetActorByName(MyFilms.conf.StrTIndex, actorList);
              LogMyFilms.Debug("GrabberUpdate - found '" + actorList.Count + "' results for '" + MyFilms.conf.StrTIndex + "'");
              if (actorList.Count > 0 && actorList.Count < 5)
              {
                LogMyFilms.Debug("IMDB first search result: '" + actorList[0] + "'");
                string[] strActor = actorList[0].ToString().Split(new char[] { '|' });
                // int actorID = (strActor[0].Length > 0 && strActor.Count() > 1) ? Convert.ToInt32(strActor[0]) : 0; // string actorname = strActor[1];
                int actorId;
                int.TryParse(strActor[0], out actorId);
                person = actorId > 0 ? VideoDatabase.GetActorInfo(actorId) : new IMDBActor();
              }
              #endregion

              string strChoice = "all"; // defaults to "all", if no other choice
              var imageUrls = new Dictionary<string, string>();

              if (interactive) // Dialog only in interactive mode
              #region interactive selection dialog
              {
                var choiceViewMenu = new List<string>();
                var dlgmenu = (GUIDialogMenu)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_MENU);
                dlgmenu.Reset();
                dlgmenu.SetHeading(GUILocalizeStrings.Get(10798797)); // Choose update option ...
                dlgmenu.Add(" *** " + GUILocalizeStrings.Get(10798734) + " *** ");
                choiceViewMenu.Add("all");
                dlgmenu.Add(" *** " + GUILocalizeStrings.Get(10798735) + " *** ");
                choiceViewMenu.Add("missing");
                dlgmenu.Add(" *** " + GUILocalizeStrings.Get(10798730) + " *** ");
                choiceViewMenu.Add("all-onlynewdata");

                //if (File.Exists(GUIGraphicsContext.Skin + @"\MyFilmsDialogMultiSelect.xml"))
                //{
                //  dlgmenu.Add(" *** " + GUILocalizeStrings.Get(10798799) + " *** "); // Select multiple fields for update ...
                //  choiceViewMenu.Add("multiplefields");
                //}
                #region populate selection menu

                string[] PropertyList = new string[]
                      {
                        // "TMDB_Id", "IMDB_Id",
                        "OriginalTitle", // Name
                        "TranslatedTitle", // also known as (currently not supported)
                        "Picture", 
                        "Description", // biographie
                        "Comments", 
                        "Rating", // rating (if available)
                        "Actors", // filmographie
                        "Year", 
                        "Country", // birthplace
                        "URL", // URL to webpage
                        "Generic1", "Generic2", "Generic3", 
                        // "Photos", 
                        "PersonImages", // all images, if available
                        "PictureURL" // webUrl to main picture
                      };
                string personProperty;
                string strOldValue = "";
                string strNewValue = "";

                try
                {
                  personProperty = "name";
                  strOldValue = (person != null && person.Name.Length > 0) ? person.Name : "";
                  strNewValue = Result[(int)Grabber_URLClass.Grabber_Output.OriginalTitle];
                  dlgmenu.Add(GUILocalizeStrings.Get(10799301) + ": '" + strOldValue.Replace(Environment.NewLine, " # ") + "' -> '" + strNewValue.Replace(Environment.NewLine, " # ") + "'");
                  choiceViewMenu.Add(personProperty);
                  LogMyFilms.Debug("GrabberUpdate - Add to menu (" + personProperty + "): '" + strOldValue + "' -> '" + strNewValue + "'");

                  personProperty = "dateofbirth";
                  strOldValue = (person != null && person.DateOfBirth.Length > 0) ? person.DateOfBirth : "";
                  strNewValue = Result[(int)Grabber_URLClass.Grabber_Output.Comments];
                  dlgmenu.Add(GUILocalizeStrings.Get(10799302) + ": '" + strOldValue.Replace(Environment.NewLine, " # ") + "' -> '" + strNewValue.Replace(Environment.NewLine, " # ") + "'");
                  choiceViewMenu.Add(personProperty);
                  LogMyFilms.Debug("GrabberUpdate - Add to menu (" + personProperty + "): '" + strOldValue + "' -> '" + strNewValue + "'");

                  personProperty = "placeofbirth";
                  strOldValue = (person != null && person.PlaceOfBirth.Length > 0) ? person.PlaceOfBirth : "";
                  strNewValue = Result[(int)Grabber_URLClass.Grabber_Output.Country];
                  dlgmenu.Add(GUILocalizeStrings.Get(10799303) + ": '" + strOldValue.Replace(Environment.NewLine, " # ") + "' -> '" + strNewValue.Replace(Environment.NewLine, " # ") + "'");
                  choiceViewMenu.Add(personProperty);
                  LogMyFilms.Debug("GrabberUpdate - Add to menu (" + personProperty + "): '" + strOldValue + "' -> '" + strNewValue + "'");

                  personProperty = "biography";
                  strOldValue = (person != null && person.Biography.Length > 0) ? person.Biography : "";
                  strNewValue = Result[(int)Grabber_URLClass.Grabber_Output.Description];
                  dlgmenu.Add(GUILocalizeStrings.Get(10799304) + ": '" + strOldValue.Replace(Environment.NewLine, " # ") + "' -> '" + strNewValue.Replace(Environment.NewLine, " # ") + "'");
                  choiceViewMenu.Add(personProperty);
                  LogMyFilms.Debug("GrabberUpdate - Add to menu (" + personProperty + "): '" + strOldValue + "' -> '" + strNewValue + "'");
#if MP13
                  strOldValue = (person != null && person.DateOfDeath.Length > 0) ? person.DateOfDeath : "";
                  strOldValue = (person != null && person.PlaceOfDeath.Length > 0) ? person.PlaceOfDeath : "";
                  strOldValue = (person != null && person.LastUpdate.Length > 0) ? person.LastUpdate : "";
#endif
                  // main image
                  personProperty = "coverimage";
                  strOldValue = (person != null && person.ThumbnailUrl.Length > 0) ? person.ThumbnailUrl : "";
                  strNewValue = Result[(int)Grabber_URLClass.Grabber_Output.PictureURL];
                  dlgmenu.Add(GUILocalizeStrings.Get(10798682) + ": '" + strOldValue.Replace(Environment.NewLine, " # ") + "' -> '" + strNewValue.Replace(Environment.NewLine, " # ") + "'");
                  choiceViewMenu.Add(personProperty);
                  imageUrls.Add(personProperty, strNewValue);
                  LogMyFilms.Debug("GrabberUpdate - Add to menu (" + personProperty + "): '" + strOldValue + "' -> '" + strNewValue + "'");

                  // add additional images, if returned by grabber
                  string multipersonimages = Result[(int)Grabber_URLClass.Grabber_Output.PersonImages];
                  LogMyFilms.Debug("GrabberUpdate - multipersonimages = '" + multipersonimages + "'");
                  int i = 1;
                  string[] personimagesUrls = multipersonimages.Split(new char[] { ',', '|' });
                  Regex reg = new Regex(@"\(((?!\)).)*\)");
                  foreach (string personimagesUrl in personimagesUrls)
                  {
                    personProperty = "coverimage" + i.ToString();
                    strNewValue = reg.Replace(personimagesUrl, "").Trim();
                    if (strNewValue != Result[(int)Grabber_URLClass.Grabber_Output.PictureURL]) // do not add main image twice!
                    {
                      dlgmenu.Add(GUILocalizeStrings.Get(10798682) + " " + i.ToString() + ": '" + strOldValue.Replace(Environment.NewLine, " # ") + "' -> '" + strNewValue.Replace(Environment.NewLine, " # ") + "'");
                      choiceViewMenu.Add(personProperty);
                      imageUrls.Add(personProperty, strNewValue);
                      LogMyFilms.Debug("GrabberUpdate - Add to menu (" + personProperty + "): '" + strOldValue + "' -> '" + strNewValue + "'");
                      i++;
                    }
                  }
                }
                catch (Exception ex)
                {
                  LogMyFilms.Debug("GrabberUpdate - Error adding Person property to Selectionmenu: " + ex.Message);
                }
                #endregion

                dlgmenu.DoModal(GetID);
                if (dlgmenu.SelectedLabel == -1) return;
                strChoice = choiceViewMenu[dlgmenu.SelectedLabel];
                LogMyFilms.Debug("GrabInternetDetails - interactive choice: '" + strChoice + "'");
              }
              #endregion

              #region load details data for person
              switch (strChoice)
              {
                case "name":
                  person.Name = Result[(int)Grabber_URLClass.Grabber_Output.OriginalTitle];
                  break;
                case "dateofbirth":
                  person.DateOfBirth = Result[(int)Grabber_URLClass.Grabber_Output.Comments];
                  break;
                case "placeofbirth":
                  person.PlaceOfBirth = Result[(int)Grabber_URLClass.Grabber_Output.Country];
                  break;
                case "biography":
                  person.Biography = Result[(int)Grabber_URLClass.Grabber_Output.Description];
                  break;
                case "coverimage":
                  person.ThumbnailUrl = Result[(int)Grabber_URLClass.Grabber_Output.PictureURL];
                  // ToDo: Download Image
                  break;

                case "all":
                  person.Name = Result[(int)Grabber_URLClass.Grabber_Output.OriginalTitle];
                  person.DateOfBirth = Result[(int)Grabber_URLClass.Grabber_Output.Comments];
                  person.PlaceOfBirth = Result[(int)Grabber_URLClass.Grabber_Output.Country];
                  person.Biography = Result[(int)Grabber_URLClass.Grabber_Output.Description];
                  person.ThumbnailUrl = Result[(int)Grabber_URLClass.Grabber_Output.PictureURL];
                  // ToDo: Download Image
                  break;

                case "missing":
                  if (string.IsNullOrEmpty(person.Name)) person.Name = Result[(int)Grabber_URLClass.Grabber_Output.OriginalTitle];
                  if (string.IsNullOrEmpty(person.DateOfBirth)) person.DateOfBirth = Result[(int)Grabber_URLClass.Grabber_Output.Comments];
                  if (string.IsNullOrEmpty(person.PlaceOfBirth)) person.PlaceOfBirth = Result[(int)Grabber_URLClass.Grabber_Output.Country];
                  if (string.IsNullOrEmpty(person.Biography)) person.Biography = Result[(int)Grabber_URLClass.Grabber_Output.Description];
                  if (string.IsNullOrEmpty(person.ThumbnailUrl)) person.ThumbnailUrl = Result[(int)Grabber_URLClass.Grabber_Output.PictureURL];
                  // ToDo: Download Image
                  break;

                case "all-onlynewdata":
                  if (string.IsNullOrEmpty(Result[(int)Grabber_URLClass.Grabber_Output.OriginalTitle])) person.Name = Result[(int)Grabber_URLClass.Grabber_Output.OriginalTitle];
                  if (string.IsNullOrEmpty(Result[(int)Grabber_URLClass.Grabber_Output.Comments])) person.DateOfBirth = Result[(int)Grabber_URLClass.Grabber_Output.Comments];
                  if (string.IsNullOrEmpty(Result[(int)Grabber_URLClass.Grabber_Output.Country])) person.PlaceOfBirth = Result[(int)Grabber_URLClass.Grabber_Output.Country];
                  if (string.IsNullOrEmpty(Result[(int)Grabber_URLClass.Grabber_Output.Description])) person.Biography = Result[(int)Grabber_URLClass.Grabber_Output.Description];
                  if (string.IsNullOrEmpty(Result[(int)Grabber_URLClass.Grabber_Output.PictureURL]) && Result[(int)Grabber_URLClass.Grabber_Output.PictureURL].ToLower().StartsWith("http")) person.ThumbnailUrl = Result[(int)Grabber_URLClass.Grabber_Output.PictureURL];
                  // ToDo: Download Image
                  break;

                default:
                  if (strChoice.StartsWith("coverimage"))
                  {
                    person.ThumbnailUrl = imageUrls[strChoice];
                    LogMyFilms.Debug("GrabInternetDetails - set person URL to: " + person.ThumbnailUrl);
                  }
                  break;
              }

              LogMyFilms.Debug("GrabInternetDetails - downloadimage: '" + Result[(int)Grabber_URLClass.Grabber_Output.PicturePathLong]);

              #region Add or update actor to video database
              try
              {
                //#if MP1X
                //                  int actorId = VideoDatabase.AddActor(person.Name);
                //#else
                //                  int actorId = VideoDatabase.AddActor(null, person.Name);
                //#endif
                int actorId = GUIUtils.AddActor(null, person.Name);
                if (actorId > 0)
                {
                  if (!string.IsNullOrEmpty(person.Biography)) // clean up before saving ...
                  {
                    if (person.Biography.StartsWith("From Wikipedia, the free encyclopedia")) person.Biography = person.Biography.Replace("From Wikipedia, the free encyclopedia", "").TrimStart(new char[] { '.' }).Trim(new char[] { ' ', '\r', '\n' });
                  }
                  VideoDatabase.SetActorInfo(actorId, person);
                  //VideoDatabase.AddActorToMovie(_movieDetails.ID, actorId);
                }
              }
              catch (Exception ex) { LogMyFilms.Debug("Error adding person to VDB: " + ex.Message, ex.StackTrace); }
              #endregion

              #region load missing images ...
              if (!string.IsNullOrEmpty(MyFilms.conf.StrPathArtist) && !string.IsNullOrEmpty(person.ThumbnailUrl))
              {
                string filename = MyFilms.conf.StrPathArtist + "\\" + person.Name + ".jpg";  // string filename = Path.Combine(MyFilms.conf.StrPathArtist, personname); //File.Exists(MyFilms.conf.StrPathArtist + "\\" + personsname + ".jpg")))
                if (person.ThumbnailUrl.Contains("http:") && (strChoice == "all" || strChoice == "all-onlynewdata" || (!File.Exists(filename) && strChoice == "missing") || strChoice.StartsWith("coverimage")))
                {
                  #region MP Thumb download deactivated, as downloading not yet working !!!
                  //if (person.ThumbnailUrl != string.Empty) // to update MP person thumb dir
                  //{
                  //  string largeCoverArt = Utils.GetLargeCoverArtName(Thumbs.MovieActors, person.Name);
                  //  string coverArt = Utils.GetCoverArtName(Thumbs.MovieActors, person.Name);
                  //  Utils.FileDelete(largeCoverArt);
                  //  Utils.FileDelete(coverArt);
                  //  IMDBFetcher.DownloadCoverArt(Thumbs.MovieActors, person.ThumbnailUrl, person.Name);
                  //  //DownloadCoverArt(Thumbs.MovieActors, imdbActor.ThumbnailUrl, imdbActor.Name);
                  //}
                  #endregion
                  string filename1person = GrabUtil.DownloadPersonArtwork(MyFilms.conf.StrPathArtist, person.ThumbnailUrl, person.Name, false, true, out filename);
                }
              }
              #endregion
              // grabb_Internet_Details_Informations_Cover(Result, interactive, GetID, wscript, grabtype, sTitles);

              #endregion

              #endregion
            }

            if (grabtype == GrabType.Cover)
            {
              #region Cover

              if (string.IsNullOrEmpty(Result[(int)Grabber_URLClass.Grabber_Output.PicturePathLong]))
              {
                if (interactive)
                {
                  GUIUtils.ShowOKDialog(GUILocalizeStrings.Get(10798625));  // no results found
                  // grabb_Internet_Informations(FullMovieName, GetID, true, wscript, FullMoviePath, grabtype, showAll);
                }
                return;
              }
              grabb_Internet_Details_Informations_Cover(Result, interactive, GetID, wscript, grabtype, sTitles);

              #endregion
            }

            if (grabtype == GrabType.MultiCovers)
            {
              #region MultiCovers

              if (string.IsNullOrEmpty(Result[(int)Grabber_URLClass.Grabber_Output.MultiPosters]))
              {
                // no data found
                if (interactive)
                {
                  GUIUtils.ShowOKDialog(GUILocalizeStrings.Get(10798625));  // no results found
                  // grabb_Internet_Informations(FullMovieName, GetID, true, wscript, FullMoviePath, grabtype, showAll);
                }
                return;
              }
              grabb_Internet_Details_Informations_Cover(Result, interactive, GetID, wscript, grabtype, sTitles);

              #endregion
            }

            Update_XML_database();
            LogMyFilms.Info("Database Updated for title/ttitle: " + title + "/" + ttitle);

            if (GetID != MyFilms.ID_MyFilmsCoverManager)
              if (title.Length > 0 && MyFilms.conf.StrFanart && grabtype != GrabType.Person) // Get Fanart
              {
                #region fanart

                // GUIDialogProgress dlgPrgrs = (GUIDialogProgress)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_PROGRESS); // already defined above !
                if (dlgPrgrs != null)
                {
                  dlgPrgrs.Reset();
                  dlgPrgrs.DisplayProgressBar = false;
                  dlgPrgrs.ShowWaitCursor = true;
                  dlgPrgrs.DisableCancel(true);
                  dlgPrgrs.SetHeading(string.Format("{0} - {1}", "MyFilms", "Artwork Updater"));
                  dlgPrgrs.SetLine(1, "Loading Artwork ...");
                  dlgPrgrs.Percentage = 0;
                  dlgPrgrs.NeedRefresh();
                  dlgPrgrs.ShouldRenderLayer();
                  dlgPrgrs.StartModal(GUIWindowManager.ActiveWindow);

                  new System.Threading.Thread(delegate()
                      {
                        string imdbid = GetIMDB_Id(MyFilms.r[MyFilms.conf.StrIndex]);
                        GrabArtwork(title, ttitle, (int)year, director, imdbid, MyFilms.conf.StrTitle1, dlgPrgrs);
                        //  dlgPrgrs.Percentage = 100;
                        //  dlgPrgrs.SetLine(1, "Finished loading Movie Details ...");
                        //  dlgPrgrs.NeedRefresh();
                        //  dlgPrgrs.ShouldRenderLayer();
                        //  Thread.Sleep(500);
                        //  dlgPrgrs.ShowWaitCursor = false;
                        //  dlgPrgrs.Close();

                        //GrabArtwork(title, ttitle, (int)year, director, MyFilms.conf.StrTitle1.ToString(), r => 
                        //{
                        //  dlgPrgrs.Percentage = r;
                        //  return dlgPrgrs.ShouldRenderLayer();
                        //});
                        GUIWindowManager.SendThreadCallbackAndWait((p1, p2, data) =>
                            { return 0; }, 0, 0, null);
                      }) { Name = "MyFilmsArtworkLoader", IsBackground = true }.Start();
                  return;
                }
                // System.Collections.Generic.List<grabber.DBMovieInfo> listemovies = Grab.GetFanart(title, ttitle, (int)year, director, MyFilms.conf.StrPathFanart, true, false, MyFilms.conf.StrTitle1.ToString());

                #endregion
              }
            GUIWindowManager.SendThreadCallbackAndWait((p1, p2, data) =>
                {
                  if (GetID != MyFilms.ID_MyFilmsCoverManager)
                    if (DetailsUpdated != null) DetailsUpdated(true); // will launch screen update with new data, if handler registered
                  return 0;
                }, 0, 0, null);
          }) { Name = "MyFilmsDetailsLoader", IsBackground = true }.Start();
    }
示例#8
0
 private void Menu_LoadFanart(bool loadPersonImages)
 {
   Grabber.Grabber_URLClass Grab = new Grabber.Grabber_URLClass();
   string personartworkpath = string.Empty;
   Searchtitles sTitles = GetSearchTitles(MyFilms.r[MyFilms.conf.StrIndex], "");
   string imdbid = GetIMDB_Id(MyFilms.r[MyFilms.conf.StrIndex]);
   if (!string.IsNullOrEmpty(sTitles.FanartTitle) && MyFilms.conf.StrFanart)
   {
     LogMyFilms.Debug("MyFilmsDetails (fanart-menuselect) Download Fanart: originaltitle: '" + sTitles.OriginalTitle + "' - translatedtitle: '" + sTitles.TranslatedTitle + "' - director: '" + sTitles.Director + "' - year: '" + sTitles.Year.ToString() + "'");
     if (MyFilms.conf.UseThumbsForPersons && !string.IsNullOrEmpty(MyFilms.conf.StrPathArtist))
     {
       personartworkpath = MyFilms.conf.StrPathArtist;
       LogMyFilms.Debug("MyFilmsDetails (fanart-menuselect) Download PersonArtwork 'enabled' - destination: '" + personartworkpath + "'");
     }
     doUpdateDetailsViewByFinishEvent = true;
     Download_Backdrops_Fanart(sTitles.OriginalTitle, sTitles.TranslatedTitle, sTitles.FormattedTitle, sTitles.Director, imdbid, sTitles.Year.ToString(), true, GetID, sTitles.FanartTitle, personartworkpath, true, loadPersonImages, m_SearchAnimation);
   }
 }
示例#9
0
        private void Load_Preview(bool AlwaysAsk)
        {
            // dataGridViewSearchResults.Rows.Clear();
              while (dataGridViewSearchResults.Rows.Count > 0)
              {
            dataGridViewSearchResults.Rows.RemoveAt(0);
              }
              button_GoDetailPage.Enabled = false;
              button_Preview.Enabled = false;

              var Grab = new Grabber_URLClass();
              int pageNumber = -1;
              if (!string.IsNullOrEmpty(textPage.Text))
            pageNumber = Convert.ToInt16(textPage.Text);
              try
              {
            listUrl = Grab.ReturnURL(TextSearch.Text, textConfig.Text + ".tmp", pageNumber, AlwaysAsk, string.Empty);
              }
              catch (Exception ex)
              {
            DialogResult dlgResult = DialogResult.None;
            button_Preview.Enabled = true;
            dlgResult = MessageBox.Show("Grabber ERROR - check your definitions! \n\nException Message: " + ex.Message + "\nStacktrace: " + ex.StackTrace, "Error", MessageBoxButtons.OK);
            if (dlgResult == DialogResult.OK) { }
              }

              for (int i = 0; i < listUrl.Count; i++)
              {
            //DataGridViewRow row = new DataGridViewRow();
            //row.Cells[0].Value = i;
            //row.Cells[1].Value = image;
            //row.Cells[2].Value = wurl.Title;
            //row.Cells[3].Value = wurl.Year;
            //row.Cells[4].Value = wurl.Options;
            //row.Cells[5].Value = wurl.ID;
            //row.Cells[6].Value = wurl.URL;
            //row.Cells[7].Value = wurl.Director;
            //row.Cells[8].Value = wurl.Akas;
            //i = dataGridViewSearchResults.Rows.Add(row); // add row for config

            var wurl = (Grabber_URLClass.IMDBUrl)listUrl[i];
            Image image = GrabUtil.GetImageFromUrl(wurl.Thumb); // Image image = Image.FromFile(wurl.Thumb); // Image smallImage = image.GetThumbnailImage(20, 30, null, IntPtr.Zero);
            dataGridViewSearchResults.Rows.Add(new object[] { (i + 1).ToString(), image, wurl.Title, wurl.Year, wurl.Options, wurl.ID, wurl.URL, wurl.Director, wurl.Akas });

            //dataGridViewSearchResults.Rows[i].Cells[0].Value = i;
            //dataGridViewSearchResults.Rows[i].Cells[1].Style.NullValue = null;
            //dataGridViewSearchResults.Rows[i].Cells[1].Value = image;
            //dataGridViewSearchResults.Rows[i].Cells[2].Value = wurl.Title;
            //dataGridViewSearchResults.Rows[i].Cells[3].Value = wurl.Year;
            //dataGridViewSearchResults.Rows[i].Cells[4].Value = wurl.Options;
            //dataGridViewSearchResults.Rows[i].Cells[5].Value = wurl.ID;
            //dataGridViewSearchResults.Rows[i].Cells[6].Value = wurl.URL;
            //dataGridViewSearchResults.Rows[i].Cells[7].Value = wurl.Director;
            //dataGridViewSearchResults.Rows[i].Cells[8].Value = wurl.Akas;
              }
              if (dataGridViewSearchResults.Rows.Count > 0)
              {
            dataGridViewSearchResults.SelectionMode = DataGridViewSelectionMode.FullRowSelect;
            dataGridViewSearchResults.Rows[0].Selected = true; //set first line as selected
            button_GoDetailPage.Enabled = true;
            button_Preview.Enabled = true;
              }
        }
示例#10
0
        private void buttonPreview_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(textConfig.Text))
              {
            MessageBox.Show("No Config loaded !", "Error");
            return;
              }

              Stopwatch watch = new Stopwatch();
              string totalruntime = string.Empty;
              watch.Reset();
              watch.Start();
              textPreview.Clear();
              pictureBoxPreviewCollection.ImageLocation = "";
              pictureBoxPreviewCover.ImageLocation = "";
              labelImageSize.Text = "";

              SaveXml(textConfig.Text + ".tmp");
              Grabber.Grabber_URLClass Grab = new Grabber_URLClass();
              string[] Result = new string[80];

              try // http://akas.imdb.com/title/tt0133093/
              {
            Result = Grab.GetDetail(TextURLDetail.Text, Environment.GetEnvironmentVariable("TEMP"), textConfig.Text + ".tmp", true, string.Empty, string.Empty, string.Empty, string.Empty, null);
              }
              catch (Exception ex)
              {
            DialogResult dlgResult = DialogResult.None;
            dlgResult = MessageBox.Show("An error ocurred - check your definitions!\n Exception: " + ex.ToString() + ", Stacktrace: " + ex.StackTrace.ToString(), "Error", MessageBoxButtons.OK);
            if (dlgResult == DialogResult.OK)
            {
            }
              }
              watch.Stop();
              totalruntime = "Total Runtime: " + (watch.ElapsedMilliseconds).ToString() + " ms.";

              string mapped;
              for (int i = 0; i < Result.Length; i++)
              {
            textPreview.SelectionFont = new Font("Arial", (float)9.75, FontStyle.Bold | FontStyle.Underline);
            mapped = i > 39 ? " (mapped)" : "";

            switch (i)
            {
              case 0:
            textPreview.SelectedText += "(" + i.ToString() + ") " + "Original Title" + mapped + Environment.NewLine;
            break;
              case 40:
            textPreview.SelectedText += Environment.NewLine;
            textPreview.SelectedText += Environment.NewLine;
            textPreview.SelectionFont = new Font("Arial", (float)9.75, FontStyle.Bold | FontStyle.Underline);
            textPreview.SelectedText += "MAPPED OUTPUT FIELDS:" + Environment.NewLine;
            textPreview.SelectedText += Environment.NewLine;
            textPreview.SelectionFont = new Font("Arial", (float)9.75, FontStyle.Bold | FontStyle.Underline);
            textPreview.SelectedText += "(" + i.ToString() + ") " + "Original Title" + mapped + Environment.NewLine;
            break;
              case 1:
              case 41:
            textPreview.SelectedText += "(" + i.ToString() + ") " + "Translated Title" + mapped + Environment.NewLine;
            break;
              case 2:
              case 42:
            textPreview.SelectedText += "(" + i.ToString() + ") " + "Cover" + mapped + Environment.NewLine;
            if (i > 39) // only show image once !
            {
              try
              {
                pictureBoxPreviewCover.ImageLocation = Result[i];

                // Create new FileInfo object and get the Length.
                FileInfo f = new FileInfo(Result[i]);
                //long s1 = f.Length;
                //labelImageSize.Text = s1.ToString();
                labelImageSize.Text = this.ByteString(f.Length);
              }
              catch (Exception)
              {
                labelImageSize.Text = "n/a";
                //MessageBox.Show("An error ocurred in image preview - check your config.\n" + ex.Message + "\n" + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
              }
            }
            break;
              case 3:
              case 43:
            textPreview.SelectedText += "(" + i.ToString() + ") " + "Description" + mapped + Environment.NewLine;
            break;
              case 4:
              case 44:
            textPreview.SelectedText += "(" + i.ToString() + ") " + "Rating" + mapped + Environment.NewLine;
            break;
              case 5:
              case 45:
            textPreview.SelectedText += "(" + i.ToString() + ") " + "Actors" + mapped + Environment.NewLine;
            break;
              case 6:
              case 46:
            textPreview.SelectedText += "(" + i.ToString() + ") " + "Director" + mapped + Environment.NewLine;
            break;
              case 7:
              case 47:
            textPreview.SelectedText += "(" + i.ToString() + ") " + "Producer" + mapped + Environment.NewLine;
            break;
              case 8:
              case 48:
            textPreview.SelectedText += "(" + i.ToString() + ") " + "Year" + mapped + Environment.NewLine;
            break;
              case 9:
              case 49:
            textPreview.SelectedText += "(" + i.ToString() + ") " + "Country" + mapped + Environment.NewLine;
            break;
              case 10:
              case 50:
            textPreview.SelectedText += "(" + i.ToString() + ") " + "Category" + mapped + Environment.NewLine;
            break;
              case 11:
              case 51:
            textPreview.SelectedText += "(" + i.ToString() + ") " + "URL" + mapped + Environment.NewLine;
            break;
              case 12:
              case 52:
            textPreview.SelectedText += "(" + i.ToString() + ") " + "Image" + mapped + Environment.NewLine;
            break;
              case 13:
              case 53:
            textPreview.SelectedText += "(" + i.ToString() + ") " + "Writer" + mapped + Environment.NewLine;
            break;
              case 14:
              case 54:
            textPreview.SelectedText += "(" + i.ToString() + ") " + "Comment" + mapped + Environment.NewLine;
            break;
              case 15:
              case 55:
            textPreview.SelectedText += "(" + i.ToString() + ") " + "Language" + mapped + Environment.NewLine;
            break;
              case 16:
              case 56:
            textPreview.SelectedText += "(" + i.ToString() + ") " + "Tagline" + mapped + Environment.NewLine;
            break;
              case 17:
              case 57:
            textPreview.SelectedText += "(" + i.ToString() + ") " + "Certification" + mapped + Environment.NewLine;
            break;
              case 18:
              case 58:
            textPreview.SelectedText += "(" + i.ToString() + ") " + "IMDB_Id" + mapped + Environment.NewLine;
            break;
              case 19:
              case 59:
            textPreview.SelectedText += "(" + i.ToString() + ") " + "IMDB_Rank" + mapped + Environment.NewLine;
            break;
              case 20:
              case 60:
            textPreview.SelectedText += "(" + i.ToString() + ") " + "Studio" + mapped + Environment.NewLine;
            break;
              case 21:
              case 61:
            textPreview.SelectedText += "(" + i.ToString() + ") " + "Edition" + mapped + Environment.NewLine;
            break;
              case 22:
              case 62:
            textPreview.SelectedText += "(" + i.ToString() + ") " + "Fanart" + mapped + Environment.NewLine;
            break;
              case 23:
              case 63:
            textPreview.SelectedText += "(" + i.ToString() + ") " + "Generic 1" + mapped + Environment.NewLine;
            break;
              case 24:
              case 64:
            textPreview.SelectedText += "(" + i.ToString() + ") " + "Generic 2" + mapped + Environment.NewLine;
            break;
              case 25:
              case 65:
            textPreview.SelectedText += "(" + i.ToString() + ") " + "Generic 3" + mapped + Environment.NewLine;
            break;
              case 26:
              case 66:
            textPreview.SelectedText += "(" + i.ToString() + ") " + "Names: Countries for 'Translated Title'" + mapped + Environment.NewLine;
            break;
              case 27:
              case 67:
            textPreview.SelectedText += "(" + i.ToString() + ") " + "Values: Countries for 'Translated Title'" + mapped + Environment.NewLine;
            break;
              case 28:
              case 68:
            textPreview.SelectedText += "(" + i.ToString() + ") " + "Names: Countries for 'Certification'" + mapped + Environment.NewLine;
            break;
              case 29:
              case 69:
            textPreview.SelectedText += "(" + i.ToString() + ") " + "Values: Countries for 'Certification'" + mapped + Environment.NewLine;
            break;
              case 30:
              case 70:
            textPreview.SelectedText += "(" + i.ToString() + ") " + "Values: MultiPosters'" + mapped + Environment.NewLine;
            break;
              case 31:
              case 71:
            textPreview.SelectedText += "(" + i.ToString() + ") " + "Values: Photos'" + mapped + Environment.NewLine;
            break;
              case 32:
              case 72:
            textPreview.SelectedText += "(" + i.ToString() + ") " + "Values: PersonImages'" + mapped + Environment.NewLine;
            break;
              case 33:
              case 73:
            textPreview.SelectedText += "(" + i.ToString() + ") " + "Values: MultiFanart'" + mapped + Environment.NewLine;
            break;
              case 34:
              case 74:
            textPreview.SelectedText += "(" + i.ToString() + ") " + "Values: Trailer'" + mapped + Environment.NewLine;
            break;
              case 35:
              case 75:
            textPreview.SelectedText += "(" + i.ToString() + ") " + "TMDB_Id'" + mapped + Environment.NewLine;
            break;
              case 36:
              case 76:
            textPreview.SelectedText += "(" + i.ToString() + ") " + "Runtime'" + mapped + Environment.NewLine;
            break;
              case 37:
              case 77:
            textPreview.SelectedText += "(" + i.ToString() + ") " + "Collection'" + mapped + Environment.NewLine;
            break;
              case 38:
              case 78:
            textPreview.SelectedText += "(" + i.ToString() + ") " + "CollectionImageURL'" + mapped + Environment.NewLine;
            try
            {
              pictureBoxPreviewCollection.ImageLocation = Path.Combine(Path.GetDirectoryName(Result[i]), Path.GetFileName(Result[i]));
              //FileInfo f = new FileInfo(Result[i]);
              //labelImageSize.Text = this.ByteString(f.Length);
            }
            catch (Exception)
            {
              // labelImageSize.Text = "n/a";
            }
            break;
              case 39:
              case 79:
            textPreview.SelectedText += "(" + i.ToString() + ") " + "Picture URL'" + mapped + Environment.NewLine;
            break;
              default:
            textPreview.SelectedText += "(" + (i).ToString() + ") " + "Mapping Output Field '" + (i - 40).ToString() + "'" + mapped + Environment.NewLine;
            break;
            }
            if (i <= 80) // Changed to support new fields...
              textPreview.AppendText(Result[i] + Environment.NewLine);
              }
              // List of Grab Pages used for Grabber results:
              textPreview.AppendText(Environment.NewLine);
              textPreview.AppendText(Environment.NewLine);
              textPreview.SelectionFont = new Font("Arial", (float)9.75, FontStyle.Bold | FontStyle.Underline);
              textPreview.SelectedText += "*** Infos about used Grab Pages ***" + Environment.NewLine;
              textPreview.AppendText(Environment.NewLine);
              textPreview.AppendText("Base Page:" + TimeBodyDetail + Environment.NewLine);
              textPreview.AppendText(URLBodyDetail + Environment.NewLine);
              textPreview.AppendText(Environment.NewLine);
              textPreview.AppendText("URL Gateway:" + TimeBodyDetail2 + Environment.NewLine);
              textPreview.AppendText(URLBodyDetail2 + Environment.NewLine);
              textPreview.AppendText(Environment.NewLine);
              textPreview.AppendText("URL Redirection Generic 1:" + TimeBodyLinkGeneric1 + Environment.NewLine);
              textPreview.AppendText(URLBodyLinkGeneric1 + Environment.NewLine);
              textPreview.AppendText(Environment.NewLine);
              textPreview.AppendText("URL Redirection Generic 2:" + TimeBodyLinkGeneric2 + Environment.NewLine);
              textPreview.AppendText(URLBodyLinkGeneric2 + Environment.NewLine);
              textPreview.AppendText(Environment.NewLine);
              textPreview.AppendText("URL Redirection Cover:" + TimeBodyLinkImg + Environment.NewLine);
              textPreview.AppendText(URLBodyLinkImg + Environment.NewLine);
              textPreview.AppendText(Environment.NewLine);
              textPreview.AppendText("URL Redirection Persons:" + TimeBodyLinkPersons + Environment.NewLine);
              textPreview.AppendText(URLBodyLinkPersons + Environment.NewLine);
              textPreview.AppendText(Environment.NewLine);
              textPreview.AppendText("URL Redirection Title:" + TimeBodyLinkTitles + Environment.NewLine);
              textPreview.AppendText(URLBodyLinkTitles + Environment.NewLine);
              textPreview.AppendText(Environment.NewLine);
              textPreview.AppendText("URL Redirection Certification:" + TimeBodyLinkCertification + Environment.NewLine);
              textPreview.AppendText(URLBodyLinkCertification + Environment.NewLine);
              textPreview.AppendText(Environment.NewLine);
              textPreview.AppendText("URL Redirection Comment:" + TimeBodyLinkComment + Environment.NewLine);
              textPreview.AppendText(URLBodyLinkComment + Environment.NewLine);
              textPreview.AppendText(Environment.NewLine);
              textPreview.AppendText("URL Redirection Description:" + TimeBodyLinkSyn + Environment.NewLine);
              textPreview.AppendText(URLBodyLinkSyn + Environment.NewLine);
              textPreview.AppendText(Environment.NewLine);
              textPreview.AppendText("URL Redirection MultiPosters:" + TimeBodyLinkMultiPosters + Environment.NewLine);
              textPreview.AppendText(URLBodyLinkMultiPosters + Environment.NewLine);
              textPreview.AppendText(Environment.NewLine);
              textPreview.AppendText("URL Redirection Photos:" + TimeBodyLinkPhotos + Environment.NewLine);
              textPreview.AppendText(URLBodyLinkPhotos + Environment.NewLine);
              textPreview.AppendText(Environment.NewLine);
              textPreview.AppendText("URL Redirection PersonImages:" + TimeBodyLinkPersonImages + Environment.NewLine);
              textPreview.AppendText(URLBodyLinkPersonImages + Environment.NewLine);
              textPreview.AppendText(Environment.NewLine);
              textPreview.AppendText("URL Redirection MultiFanart:" + TimeBodyLinkMultiFanart + Environment.NewLine);
              textPreview.AppendText(URLBodyLinkMultiFanart + Environment.NewLine);
              textPreview.AppendText(Environment.NewLine);
              textPreview.AppendText("URL Redirection Trailer:" + TimeBodyLinkTrailer + Environment.NewLine);
              textPreview.AppendText(URLBodyLinkTrailer + Environment.NewLine);

              textPreview.AppendText(Environment.NewLine);
              textPreview.AppendText(Environment.NewLine);
              textPreview.SelectionFont = new Font("Arial", (float)9.75, FontStyle.Bold | FontStyle.Underline);
              textPreview.SelectedText += totalruntime + Environment.NewLine;

              System.IO.File.Delete(textConfig.Text + ".tmp");
        }
示例#11
0
文件: Grab.cs 项目: drtak34/my-films
 public GrabDetail(int id, string displayName, string grabName, DetailType type, Grabber_URLClass.Grabber_Output outputmapping)
 {
     Id = id;
       DisplayName = displayName;
       GrabName = grabName;
       Type = type;
       OutputMapping = outputmapping;
 }
示例#12
0
文件: Grab.cs 项目: drtak34/my-films
        public ArrayList ReturnURL(string strSearch, string strConfigFile, int strPage, bool alwaysAsk, string strMediaPath)
        {
            string strFileBasedReader = string.Empty;
              string strURLFile = string.Empty;
              string strDBName = string.Empty;
              string cleanup = string.Empty;
              var doc = new XmlDocument();
              doc.Load(strConfigFile);
              XmlNode n = doc.ChildNodes[1].FirstChild;
              try { strDBName = XmlConvert.DecodeName(n.SelectSingleNodeFast("DBName").InnerText); }
              catch { strDBName = "ERROR"; }
              try { strURLFile = XmlConvert.DecodeName(n.SelectSingleNodeFast("URLSearch/URL").InnerText); }
              catch { strURLFile = ""; }
              try { strFileBasedReader = XmlConvert.DecodeName(n.SelectSingleNodeFast("FileBasedReader").InnerText); }
              catch { strFileBasedReader = "false"; }
              try { cleanup = XmlConvert.DecodeName(n.SelectSingleNodeFast("SearchCleanup").InnerText); }
              catch (Exception) { cleanup = string.Empty; }

              if (strFileBasedReader == "true" || strSearch.Contains("\\")) // if a mediapath is given and file name is part of the search expression... assume it's nfo/xml/xbmc reader request and return the proper file to read in details
              {
            #region read from file - mediapath

            if (string.IsNullOrEmpty(strMediaPath) && strSearch.Contains("\\")) strMediaPath = strSearch;

            elements.Clear();
            if (!string.IsNullOrEmpty(strURLFile))
            {
              try
              {
            string directory = Path.GetDirectoryName(strMediaPath); // get directory name of media file
            string filename = Path.GetFileNameWithoutExtension(strMediaPath); // get filename without extension
            //strSearch = GrabUtil.encodeSearch(strSearch);
            foreach (var file in Directory.GetFiles(directory, strURLFile.Replace("#Filename#", filename), SearchOption.TopDirectoryOnly))   // search exact match
            {
              string fileShortname = Path.GetFileName(file);
              var url = new IMDBUrl(file, fileShortname, strDBName, n, "1", "", "", "", "", "", "", "", "");
              LogMyFilms.Debug("ReturnURL() - Found and adding nfo file '" + fileShortname + "', fullpath = '" + file + "'");
              elements.Add(url);
            }
            if (elements.Count == 0) // if no results found, try searching with cleaned filename
            {
              foreach (var file in Directory.GetFiles(directory, strURLFile.Replace("#Filename#", GrabUtil.CleanupSearch(filename, cleanup)), SearchOption.TopDirectoryOnly))   // cleanup filename for better search results
              {
                string fileShortname = Path.GetFileName(file);
                var url = new IMDBUrl(file, fileShortname, strDBName, n, "1", "", "", "", "", "", "", "", "");
                LogMyFilms.Debug("ReturnURL() - Found and adding nfo file '" + fileShortname + "', fullpath = '" + file + "'");
                elements.Add(url);
              }
            }
              }
              catch (Exception e)
              {
            LogMyFilms.DebugException("ReturnURL() - Catched Exception: " + e.Message, e);
              }
            }
            #endregion
            return elements;
              }

              // if no local grabbing, do web grabbing:
              if (strPage == -1)
              {
            // First run, finding the key starting page number
            //Loading the configuration file
            //XmlDocument doc = new XmlDocument();
            //doc.Load(strConfigFile);
            //XmlNode n = doc.ChildNodes[1].FirstChild;
            //Gets Key to the first page if it exists (not required)
            try
            { strPage = Convert.ToInt16(XmlConvert.DecodeName(n.SelectSingleNodeFast("URLSearch/KeyStartPage").InnerText)); }
            catch
            { strPage = 1; }
              }
              var grab = new Grabber_URLClass();
              Int16 wIndex;
              do
              {
            if (strSearch.LastIndexOf(".", System.StringComparison.Ordinal) == strSearch.Length - 1)
              strSearch = strSearch.Substring(0, strSearch.Length - 1);
            else
              break;
              } while (true);
              grab.FindMovies(strSearch, strConfigFile, strPage, alwaysAsk, out elements, out wIndex);
              if (wIndex >= 0)
              {
            var wurl = (IMDBUrl)elements[wIndex];
            elements.Clear();
            elements.Add(wurl);
              }
              return elements;
        }