Example #1
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 GrabberUrlClass();
   try
   {
     listUrl = grab.ReturnURL(personname, wscript, 1, false, "");
   }
   catch (Exception ex)
   {
     LogMyFilms.Error(ex, "FindActor() - exception = '" + ex.Message + "'");
   }
   return listUrl;
 }
Example #2
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;

              GrabberUrlClass grab = new GrabberUrlClass();
              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 = (GrabberUrlClass.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;
              }
        }
Example #3
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.GrabberUrlClass();
      GrabberUrlClass.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.Error(ex, "grabb_Internet_Details_Search() - exception = '" + ex.Message + "'");
          }
          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.GrabberUrlClass.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.GrabberUrlClass.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 = (GrabberUrlClass.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();
    }