示例#1
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();
    }
示例#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
        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");
        }