Inheritance: IMDB.IProgress
Example #1
0
 public bool OnDetailsNotFound(IMDBFetcher fetcher)
 {
   if (_progress != null)
   {
     return _progress.OnDetailsNotFound(fetcher);
   }
   return false;
 }
Example #2
0
 public bool OnDetailsNotFound(IMDBFetcher fetcher)
 {
   if (_scanning)
   {
     _conflictFiles.Add(fetcher.Movie);
     return false;
   }
   // show dialog...
   GUIDialogOK pDlgOk = (GUIDialogOK) GUIWindowManager.GetWindow((int) Window.WINDOW_DIALOG_OK);
   // show dialog...
   pDlgOk.SetHeading(195);
   pDlgOk.SetLine(1, fetcher.MovieName);
   pDlgOk.SetLine(2, string.Empty);
   pDlgOk.DoModal(GUIWindowManager.ActiveWindow);
   return false;
 }
Example #3
0
    public bool OnSelectMovie(IMDBFetcher fetcher, out int selectedMovie)
    {
      if (_scanning)
      {
        _conflictFiles.Add(fetcher.Movie);
        selectedMovie = -1;
        return false;
      }
      GUIDialogSelect pDlgSelect = (GUIDialogSelect) GUIWindowManager.GetWindow((int) Window.WINDOW_DIALOG_SELECT);
      // more then 1 movie found
      // ask user to select 1
      string filename = string.Empty;

      if (!string.IsNullOrEmpty(_selectedFilename))
      {
        if (_selectedFilename.ToUpperInvariant().Contains(@"VIDEO_TS\VIDEO_TS.IFO"))
        {
          filename = _selectedFilename.ToUpperInvariant().Replace(@"\VIDEO_TS\VIDEO_TS.IFO", string.Empty);
          int iIndex = 0;
          iIndex = filename.LastIndexOf(@"\");
          filename = filename.Substring(iIndex + 1);
        }
        else if (_selectedFilename.ToUpperInvariant().Contains(@"BDMV\INDEX.BDMV"))
        {
          filename = _selectedFilename.ToUpperInvariant().Replace(@"\BDMV\INDEX.BDMV", string.Empty);
          int iIndex = 0;
          iIndex = filename.LastIndexOf(@"\");
          filename = filename.Substring(iIndex + 1);
        }
        else
        {
          filename = Path.GetFileNameWithoutExtension(_selectedFilename);
          Util.Utils.RemoveStackEndings(ref filename);
        }
      }

      string strHeading = GUILocalizeStrings.Get(196);

      if (!string.IsNullOrEmpty(filename))
      {
        GUIPropertyManager.SetProperty("#selecteditem", filename);
      }

      pDlgSelect.SetHeading(strHeading);
      pDlgSelect.Reset();

      for (int i = 0; i < fetcher.Count; ++i)
      {
        pDlgSelect.Add(fetcher[i].Title);
      }
      
      pDlgSelect.EnableButton(true);
      pDlgSelect.SetButtonLabel(413); // manual
      pDlgSelect.DoModal(GUIWindowManager.ActiveWindow);
      // and wait till user selects one
      selectedMovie = pDlgSelect.SelectedLabel;
      
      if (pDlgSelect.IsButtonPressed)
      {
        return true;
      }
      if (selectedMovie == -1)
      {
        return false;
      }
      return true;
    }
Example #4
0
 public bool OnDetailsEnd(IMDBFetcher fetcher)
 {
   GUIDialogProgress pDlgProgress =
     (GUIDialogProgress) GUIWindowManager.GetWindow((int) Window.WINDOW_DIALOG_PROGRESS);
   if ((pDlgProgress != null) && (pDlgProgress.IsInstance(fetcher)))
   {
     pDlgProgress.Close();
   }
   return true;
 }
Example #5
0
 public bool OnActorsStarted(IMDBFetcher fetcher)
 {
   GUIDialogProgress pDlgProgress =
     (GUIDialogProgress) GUIWindowManager.GetWindow((int) Window.WINDOW_DIALOG_PROGRESS);
   pDlgProgress.SetObject(fetcher);
   pDlgProgress.DoModal(GUIWindowManager.ActiveWindow);
   if (pDlgProgress.IsCanceled)
   {
     return false;
   }
   return true;
 }
Example #6
0
    protected override void OnShowContextMenu()
    {
      GUIListItem item = facadeLayout.SelectedListItem;
      int itemNo = facadeLayout.SelectedListItemIndex;
      GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU);
      
      if (dlg == null)
      {
        return;
      }

      dlg.Reset();
      dlg.SetHeading(498); // menu

      if (item == null)
      {
        dlg.AddLocalizedString(868); // Reset virtual directory
      }
      else if (item.IsRemote || (item.IsFolder) && (item.Label == "..") && _virtualDirectory.IsShareOfflineDetected())
      {
        dlg.AddLocalizedString(868); // Force reset virtual directory if user want to refresh offline share
      }
      else if (item.IsRemote || (item.IsFolder) && (item.Label == ".."))
      {
        return;
      }
      else
      {
        IMDBMovie movie = item.AlbumInfoTag as IMDBMovie;

        if (!facadeLayout.Focus)
        {
          // Menu button context menuu
          if (!_virtualDirectory.IsRemote(_currentFolder))
          {
            dlg.AddLocalizedString(102); //Scan
            dlg.AddLocalizedString(368); //IMDB
          }
        }
        else
        {
          // DVD & files
          if ((Path.GetFileName(item.Path) != string.Empty) || Util.Utils.IsDVD(item.Path))
          {
            // DVD disc drive
            if (Util.Utils.IsDVD(item.Path))
            {
              if (File.Exists(item.Path + @"\VIDEO_TS\VIDEO_TS.IFO") ||
                  File.Exists(item.Path + @"\BDMV\index.bdmv"))
              {
                dlg.AddLocalizedString(341); //play
              }
              else
              {
                dlg.AddLocalizedString(926); //Queue
                dlg.AddLocalizedString(102); //Scan
              }

              dlg.AddLocalizedString(368); //IMDB
            }
            // Folder
            else if (item.IsFolder)
            {
              bool useMediaInfo = false;

              if (VirtualDirectory.IsImageFile(Path.GetExtension(item.Path)))
              {
                dlg.AddLocalizedString(208); //play
                useMediaInfo = true;
              }

              if (!VirtualDirectory.IsImageFile(Path.GetExtension(item.Path)))
              {
                // Simple folder
                if (!item.IsBdDvdFolder)
                {
                  dlg.AddLocalizedString(1204); // Play All in selected folder
                  dlg.AddLocalizedString(926); //Queue
                  dlg.AddLocalizedString(102); //Scan 
                  dlg.AddLocalizedString(1280); // Scan using nfo files
                }
                // DVD folder
                else if (item.IsBdDvdFolder)
                {
                  useMediaInfo = true;
                  dlg.AddLocalizedString(208); //play             
                  dlg.AddLocalizedString(926); //Queue
                  dlg.AddLocalizedString(368); //IMDB
                  
                  if (movie != null && !movie.IsEmpty)
                  {
                    if (item.IsPlayed)
                    {
                      {
                        dlg.AddLocalizedString(830); //Reset watched status for DVD folder
                      }
                    }
                    else
                    {
                      dlg.AddLocalizedString(1260); // Set watched status
                    }
                  }
                }
              }

              if (!IsFolderPinProtected(item.Path) && _fileMenuEnabled)
              {
                dlg.AddLocalizedString(500); // FileMenu            
              }

              if (useMediaInfo)
              {
                dlg.AddLocalizedString(1264); //Media info
              }
            }
            else
            {
              dlg.AddLocalizedString(208); //Play
              dlg.AddLocalizedString(926); //Queue
              dlg.AddLocalizedString(368); //IMDB

              if (item.IsPlayed)
              {
                dlg.AddLocalizedString(830); //Reset watched status
              }
              else
              {
                dlg.AddLocalizedString(1260); // Set watched status
              }

              if (!IsFolderPinProtected(item.Path) && !item.IsRemote && _fileMenuEnabled)
              {
                dlg.AddLocalizedString(500); // FileMenu
              }
              dlg.AddLocalizedString(1264); //Media info
            }
          }
          else if (Util.Utils.IsNetwork(item.Path)) // Process network root with drive letter
          {
            dlg.AddLocalizedString(1204); // Play All in selected folder
          }
        }
        if (!_mapSettings.Stack)
        {
          dlg.AddLocalizedString(346); //Stack
        }
        else
        {
          dlg.AddLocalizedString(347); //Unstack
        }

        #region Eject/Load

        // CD/DVD/BD
        if (Util.Utils.getDriveType(item.Path) == 5)
        {
          if (item.Path != null)
          {
            var driveInfo = new DriveInfo(Path.GetPathRoot(item.Path));

            // There is no easy way in NET to detect open tray so we will check
            // if media is inside (load will be visible also in case that tray is closed but
            // media is not loaded)
            if (!driveInfo.IsReady)
            {
              dlg.AddLocalizedString(607); //Load  
            }

            dlg.AddLocalizedString(654); //Eject  
          }
        }
        
        // Removable/USB HDD
        if (Util.Utils.IsRemovable(item.Path) || Util.Utils.IsUsbHdd(item.Path))
        {
          dlg.AddLocalizedString(831);
        }

        #endregion

        dlg.AddLocalizedString(1299); // Refresh current directory

        if (_virtualDirectory.IsShareOfflineDetected())
        {
          dlg.AddLocalizedString(868); // Force reset virtual directory if user want to refresh offline share
        }
      }

      dlg.AddLocalizedString(1262); // Update grabber scripts
      dlg.AddLocalizedString(1307); // Update internal grabber scripts
      dlg.AddLocalizedString(1263); // Set default grabber

      if (!item.IsFolder)
      {
        dlg.AddLocalizedString(1984); // Refresh thumb
        if (!_hideWatchedFiles)
        {
          dlg.AddLocalizedString(2498); // Hide watched movies
        }
        else
        {
          dlg.AddLocalizedString(2499); // Unhide watched movies
        }
      }

      if (item.IsFolder && item.Label != "..")
      {
        dlg.AddLocalizedString(1995); // Create 4x4 folder.jpg
        if (_refreshMediaInfoThread != null && _refreshMediaInfoThread.IsAlive)
        {
          dlg.AddLocalizedString(2161); // Abort Update MediaInfo thread in the folder
        }
        else
        {
          dlg.AddLocalizedString(2160); // Update MediaInfo in the folder
        }
      }

      dlg.DoModal(GetID);

      if (dlg.SelectedId == -1)
      {
        return;
      }
      switch (dlg.SelectedId)
      {
        case 368: // IMDB
          OnInfo(itemNo);
          break;

        case 208: // play
          _playClicked = true;
          OnClick(itemNo);
          break;

        case 926: // add to playlist
          OnQueueItem(itemNo);
          break;

        case 136: // show playlist
          GUIWindowManager.ActivateWindow((int)Window.WINDOW_VIDEO_PLAYLIST);
          break;

        case 607: // Load (only CDROM)
          Util.Utils.CloseCDROM(Path.GetPathRoot(item.Path));
          break;

        case 654: // Eject
          if (Util.Utils.getDriveType(item.Path) != 5)
          {
            Util.Utils.EjectCDROM();
          }
          else
          {
            Util.Utils.EjectCDROM(Path.GetPathRoot(item.Path));
          }

          LoadDirectory(string.Empty);
          break;

        case 341: //Play dvd
          OnPlayDVD(item.Path, GetID);
          break;

        case 346: //Stack
          _mapSettings.Stack = true;
          LoadDirectory(_currentFolder);
          UpdateButtonStates();
          SaveFolderSettings(_currentFolder);
          break;

        case 347: //Unstack
          _mapSettings.Stack = false;
          LoadDirectory(_currentFolder);
          UpdateButtonStates();
          SaveFolderSettings(_currentFolder);
          break;

        case 102: //Scan
          if (_doNotUseDatabase)
          {
            GUIDialogOK dlgOk = (GUIDialogOK)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_OK);
            dlgOk.SetHeading(string.Empty);
            dlgOk.SetLine(1, GUILocalizeStrings.Get(416)); // Not available
            dlgOk.DoModal(GUIWindowManager.ActiveWindow);
            return;
          }

          if (facadeLayout.Focus)
          {
            if (item.IsFolder)
            {
              if (item.Label == "..")
              {
                return;
              }
              if (item.IsRemote)
              {
                return;
              }
            }
          }

          if (!_virtualDirectory.RequestPin(item.Path))
          {
            return;
          }
          
          int currentIndex = facadeLayout.SelectedListItemIndex;
          ArrayList scanNfoFiles = new ArrayList();
          GetNfoFiles(item.Path, ref scanNfoFiles);

          if (_useOnlyNfoScraper)
          {
            IMDBFetcher scanFetcher = new IMDBFetcher(this);
            scanFetcher.FetchNfo(scanNfoFiles, true, false);
            // Send global message that movie is refreshed/scanned
            GUIMessage scanNfoMsg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_VIDEOINFO_REFRESH, 0, 0, 0, 0, 0, null);
            GUIWindowManager.SendMessage(scanNfoMsg);
            LoadDirectory(_currentFolder);
            facadeLayout.SelectedListItemIndex = currentIndex;
          }
          else
          {
            // Try nfo files first
            IMDBFetcher scanFetcher = new IMDBFetcher(this);
            scanFetcher.FetchNfo(scanNfoFiles, true, false);
            // Then the rest
            ArrayList availablePaths = new ArrayList();
            availablePaths.Add(item.Path);
            IMDBFetcher.ScanIMDB(this, availablePaths, _isFuzzyMatching, true, _getActors, false);
            // Send global message that movie is refreshed/scanned
            GUIMessage scanMsg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_VIDEOINFO_REFRESH, 0, 0, 0, 0, 0, null);
            GUIWindowManager.SendMessage(scanMsg);
            LoadDirectory(_currentFolder);
            facadeLayout.SelectedListItemIndex = currentIndex;
          }
          break;

        case 1280: //Scan using nfo files
          if (_doNotUseDatabase)
          {
            GUIDialogOK dlgOk = (GUIDialogOK)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_OK);
            dlgOk.SetHeading(string.Empty);
            dlgOk.SetLine(1, GUILocalizeStrings.Get(416)); // Not available
            dlgOk.DoModal(GUIWindowManager.ActiveWindow);
            return;
          }

          if (facadeLayout.Focus)
          {
            if (item.IsFolder)
            {
              if (item.Label == "..")
              {
                return;
              }
              if (item.IsRemote)
              {
                return;
              }
            }
          }

          if (!_virtualDirectory.RequestPin(item.Path))
          {
            return;
          }
          
          currentIndex = facadeLayout.SelectedListItemIndex;
          ArrayList nfoFiles = new ArrayList();
          GetNfoFiles(item.Path, ref nfoFiles);
          IMDBFetcher fetcher = new IMDBFetcher(this);
          fetcher.FetchNfo(nfoFiles, true, false);
          // Send global message that movie is refreshed/scanned
          GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_VIDEOINFO_REFRESH, 0, 0, 0, 0, 0, null);
          GUIWindowManager.SendMessage(msg);
          LoadDirectory(_currentFolder);
          facadeLayout.SelectedListItemIndex = currentIndex;
          break;

        case 830: // Reset watched status
          SetMovieWatchStatus(item.Path, item.IsFolder, false);
          int selectedIndex = facadeLayout.SelectedListItemIndex;
          LoadDirectory(_currentFolder);
          UpdateButtonStates();
          facadeLayout.SelectedListItemIndex = selectedIndex;
          break;

        case 1260: // Set watched status
          SetMovieWatchStatus(item.Path, item.IsFolder, true);
          selectedIndex = facadeLayout.SelectedListItemIndex;
          LoadDirectory(_currentFolder);
          UpdateButtonStates();
          facadeLayout.SelectedListItemIndex = selectedIndex;
          break;

        case 500: // File menu
          {
            ShowFileMenu(false);
          }
          break;

        case 831:
          string message = string.Empty;
          
          if (Util.Utils.IsUsbHdd(item.Path) || Util.Utils.IsRemovableUsbDisk(item.Path))
          {
            if (!RemovableDriveHelper.EjectDrive(item.Path, out message))
            {
              GUIDialogOK pDlgOK = (GUIDialogOK)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_OK);
              pDlgOK.SetHeading(831);
              pDlgOK.SetLine(1, GUILocalizeStrings.Get(832));
              pDlgOK.SetLine(2, string.Empty);
              pDlgOK.SetLine(3, message);
              pDlgOK.DoModal(GUIWindowManager.ActiveWindow);
            }
            else
            {
              GUIDialogOK pDlgOK = (GUIDialogOK)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_OK);
              pDlgOK.SetHeading(831);
              pDlgOK.SetLine(1, GUILocalizeStrings.Get(833));
              pDlgOK.DoModal(GUIWindowManager.ActiveWindow);
            }
          }
          else if (!RemovableDriveHelper.EjectMedia(item.Path, out message))
          {
            GUIDialogOK pDlgOK = (GUIDialogOK)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_OK);
            pDlgOK.SetHeading(831);
            pDlgOK.SetLine(1, GUILocalizeStrings.Get(832));
            pDlgOK.SetLine(2, string.Empty);
            pDlgOK.SetLine(3, message);
            pDlgOK.DoModal(GUIWindowManager.ActiveWindow);
          }
          else
          {
            GUIDialogOK pDlgOK = (GUIDialogOK)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_OK);
            pDlgOK.SetHeading(831);
            pDlgOK.SetLine(1, GUILocalizeStrings.Get(833));
            pDlgOK.DoModal(GUIWindowManager.ActiveWindow);
          }
          break;

        case 1204: // Play all
          {
            if (!_virtualDirectory.RequestPin(item.Path))
            {
              return;
            }
            OnPlayAll(item.Path);
          }
          break;

        case 1299: // Refresh current directory
          {
            if (facadeLayout.ListLayout.ListItems.Count > 0 && !string.IsNullOrEmpty(_currentFolder))
            {
              facadeLayout.SelectedListItemIndex = 0;
              LoadDirectory(_currentFolder, false);
            }
          }
          break;

        case 868: // Reset V.directory
          {
            ResetShares();

            if (_virtualDirectory.DefaultShare != null && _virtualDirectory.DefaultShare.Path != string.Empty)
            {
              LoadDirectory(_virtualDirectory.DefaultShare.Path, false);
            }
            else
            {
              LoadDirectory(string.Empty, false);
            }
          }
          break;

        case 1262: // Update grabber scripts
          UpdateGrabberScripts(false);
          break;
        case 1307: // Update internal grabber scripts
          UpdateGrabberScripts(true);
          break;
        case 1263: // Set deault grabber script
          SetDefaultGrabber();
          break;
        case 1984: // Refresh video thumb
          Log.Debug("Thumb refresh from context menu: {0}", item.Path);
          if (Util.Utils.FileExistsInCache(item.Path))
          {
            string strThumbPath = Util.Utils.GetVideosThumbPathname(item.Path);

            bool success = Util.VideoThumbCreator.CreateVideoThumb(item.Path, strThumbPath, true, true);
            if (success)
            {
              Log.Debug("Refresh success!");
              if (facadeLayout.ListLayout.ListItems.Count > 0 && !string.IsNullOrEmpty(_currentFolder))
              {
                selectedIndex = facadeLayout.SelectedListItemIndex;
                LoadDirectory(_currentFolder, false);
                facadeLayout.SelectedListItemIndex = selectedIndex;
              }
            }
          }

          break;
        case 2498: // Hide watched movies
          Log.Debug("GUIVideoFiles: Hide watched movies");
          _hideWatchedFiles = true;
          LoadDirectory(_currentFolder);
          UpdateButtonStates();
          break;
        case 2499: // Unhide watched movies
          Log.Debug("GUIVideoFiles: Unhide watched movies");
          _hideWatchedFiles = false;
          LoadDirectory(_currentFolder);
          UpdateButtonStates();
          break;
        case 1995: // Create 4x4 folder.jpg
          Log.Debug("Create folder.jpg from context menu: {0}", item.Path);
          CreateFolderThumb(item, true);
          break;
        case 1264: // Get media info (refresh mediainfo and duration)
          RefreshMediaInfo(item);
          break;

        case 2160: // Update mediainfo in all files in the folder
          UpdateMediaInfoInFolder(item);
          break;

        case 2161: // Abort update mediainfo thread in all files in the folder
          if (_refreshMediaInfoThread.IsAlive)
          {
            _refreshMediaInfoThreadAbort = true;
          }
          break;
      }
    }
Example #7
0
 public bool OnDisableCancel(IMDBFetcher fetcher)
 {
   GUIDialogProgress pDlgProgress =
     (GUIDialogProgress) GUIWindowManager.GetWindow((int) Window.WINDOW_DIALOG_PROGRESS);
   if (pDlgProgress.IsInstance(fetcher))
   {
     pDlgProgress.DisableCancel(true);
   }
   return true;
 }
Example #8
0
    // Scan for new movies for selected folder in configuration
    protected override void OnSearchNew()
    {
      int maximumShares = 128;
      ArrayList availablePaths = new ArrayList();
      bool _useOnlyNfoScraper = false;

      using (Profile.Settings xmlreader = new MPSettings())
      {
        _useOnlyNfoScraper = xmlreader.GetValueAsBool("moviedatabase", "useonlynfoscraper", false);

        for (int index = 0; index < maximumShares; index++)
        {
          string sharePath = String.Format("sharepath{0}", index);
          string shareDir = xmlreader.GetValueAsString("movies", sharePath, "");
          string shareScan = String.Format("sharescan{0}", index);
          bool shareScanData = xmlreader.GetValueAsBool("movies", shareScan, true);

          if (shareScanData && shareDir != string.Empty)
          {
            availablePaths.Add(shareDir);
          }
        }

        if (!_useOnlyNfoScraper)
        {
          IMDBFetcher.ScanIMDB(this, availablePaths, true, true, true, false);
        }
        else
        {
          ArrayList nfoFiles = new ArrayList();
          
          foreach (string availablePath in availablePaths)
          {
            GetNfoFiles(availablePath, ref nfoFiles);
          }
          
          IMDBFetcher fetcher = new IMDBFetcher(this);
          fetcher.FetchNfo(nfoFiles, true, false);
        }
        // Send global message that movie is refreshed/scanned
        GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_VIDEOINFO_REFRESH, 0, 0, 0, 0, 0, null);
        GUIWindowManager.SendMessage(msg);
        currentSelectedItem = facadeLayout.SelectedListItemIndex;

        if (currentSelectedItem > 0)
        {
          currentSelectedItem--;
        }

        LoadDirectory(currentFolder);

        if (currentSelectedItem >= 0)
        {
          GUIControl.SelectItemControl(GetID, facadeLayout.GetID, currentSelectedItem);
        }
      }
    }
Example #9
0
 public bool OnRequestMovieTitle(IMDBFetcher fetcher, out string movieName)
 {
   if (_scanning)
   {
     _conflictFiles.Add(fetcher.Movie);
     movieName = string.Empty;
     return false;
   }
   movieName = fetcher.MovieName;
   if (VirtualKeyboard.GetKeyboard(ref movieName, GetID))
   {
     if (movieName == string.Empty)
     {
       return false;
     }
     return true;
   }
   movieName = string.Empty;
   return false;
 }
Example #10
0
 public static bool FetchMovieActors(IMDB.IProgress progress, IMDBMovie details)
 {
   IMDBFetcher fetcher = new IMDBFetcher(progress);
   fetcher._movieDetails = details;
   return fetcher.FetchActors();
 }
Example #11
0
    /// <summary>
    /// Downloads actor info.
    /// Movie details can be empty (it is used to help update role for movie if role is empty)
    /// </summary>
    /// <param name="progress"></param>
    /// <param name="details"></param>
    /// <param name="actor"></param>
    /// <param name="actorId"></param>
    public static IMDBActor FetchMovieActor(IMDB.IProgress progress, IMDBMovie details, string actor, int actorId)
    {
      if (actor == string.Empty)
        return null;
      
      IMDBFetcher fetcher = new IMDBFetcher(progress);
      fetcher._movieDetails = details;
      // Find actor
      IMDB imdb = new IMDB();

      // Don't search for actor if name is IMDBactorId (little speed up)
      if (!VideoDatabase.CheckActorImdbId(actor))
      {
        imdb = fetcher.FindActor(actor);

        // Check for results
        if (imdb.Count > 0)
        {
          int i = 0;

          // If more than 1, invoke selection
          if (imdb.Count > 1)
          {
            if (!fetcher.OnSelectActor(fetcher, out i))
            {
              return null;
            }
          }
          // Fetch actor details
          return fetcher.FetchActorDetails(actor, actorId, i);
        }
      }
      else // Direct get actor details (by actorImdbId) as name
      {
        fetcher._imdb.SetIMDBActor("http://www.imdb.com/name/" + actor, actor);
        return fetcher.FetchActorDetails(actor, actorId, 0);
      }
      return null;
    }
Example #12
0
    /// <summary>
    /// Download IMDB info for a movie. For existing movie using IMDBid from database.
    /// </summary>
    public static bool RefreshIMDB(IMDB.IProgress progress, ref IMDBMovie currentMovie, bool fuzzyMatching,
                                   bool getActors, bool addToDatabase)
    {
      if (currentMovie.Title != string.Empty || currentMovie.SearchString != string.Empty)
      {
        Log.Info("RefreshIMDB() - Refreshing MovieInfo for {0}-{1}", currentMovie.Title, currentMovie.SearchString);
      }

      string strMovieName = currentMovie.SearchString;
      string strFileName = string.Empty;
      string path = currentMovie.Path;
      string filename = currentMovie.File;
      _foldercheck = Util.Utils.IsFolderDedicatedMovieFolder(path);

      if (path != string.Empty)
      {
        if (path.EndsWith(@"\"))
        {
          path = path.Substring(0, path.Length - 1);
          currentMovie.Path = path;
        }
        if (filename.StartsWith(@"\"))
        {
          filename = filename.Substring(1);
          currentMovie.File = filename;
        }
        strFileName = path + @"\" + filename;
      }
      else
      {
        strFileName = filename;
      }
      if ((strMovieName == string.Empty) || (strMovieName == Strings.Unknown))
      {
        strMovieName = currentMovie.Title;
        if ((strMovieName == string.Empty) || (strMovieName == Strings.Unknown))
        {
          if (strFileName == string.Empty)
          {
            return true;
          }
          if (Util.Utils.IsDVD(strFileName))
          {
            // DVD
            string strDrive = strFileName.Substring(0, 2);
            currentMovie.DVDLabel = Util.Utils.GetDriveName(strDrive);
            strMovieName = currentMovie.DVDLabel;
          }
          else if (strFileName.ToUpper().IndexOf(@"\VIDEO_TS\VIDEO_TS.IFO") >= 0)
          {
            // DVD folder
            string dvdFolder = strFileName.Substring(0, strFileName.ToUpper().IndexOf(@"\VIDEO_TS\VIDEO_TS.IFO"));
            currentMovie.DVDLabel = Path.GetFileName(dvdFolder);
            strMovieName = currentMovie.DVDLabel;
          }
          else if (strFileName.ToUpper().IndexOf(@"\BDMV\INDEX.BDMV") >= 0)
          {
            // BD folder
            string bdFolder = strFileName.Substring(0, strFileName.ToUpper().IndexOf(@"\BDMV\INDEX.BDMV"));
            currentMovie.DVDLabel = Path.GetFileName(bdFolder);
            strMovieName = currentMovie.DVDLabel;
          }
          else
          {
            // Movie - Folder title and new ->remove CDx from name
            using (Settings xmlreader = new MPSettings())
            {
              bool preferFileName = xmlreader.GetValueAsBool("moviedatabase", "preferfilenameforsearch", false);
              if (_foldercheck && !preferFileName)
              {
                strMovieName = Path.GetFileName(Path.GetDirectoryName(strFileName));
              }
              else
              {
                strMovieName = Path.GetFileNameWithoutExtension(strFileName);
              }
              // Test pattern (CD, DISC(K), Part, X-Y...) and remove it from filename
              var pattern = Util.Utils.StackExpression();
              for (int i = 0; i < pattern.Length; i++)
              {
                if (_foldercheck == false && pattern[i].IsMatch(strMovieName))
                {
                  strMovieName = pattern[i].Replace(strMovieName, "");
                }
              }
            }
          }
        }
        if ((strMovieName == string.Empty) || (strMovieName == Strings.Unknown))
        {
          return true;
        }
      }
      if (currentMovie.ID == -1 && addToDatabase)
      {
        currentMovie.ID = VideoDatabase.AddMovieFile(strFileName);
      }
      
      currentMovie.SearchString = strMovieName;
      
      if (currentMovie.ID >= 0 || !addToDatabase)
      {
        if (!Win32API.IsConnectedToInternet())
        {
          return false;
        }
        IMDBFetcher fetcher = new IMDBFetcher(progress);
        fetcher.Movie = currentMovie;
        fetcher._getActors = getActors;
        int selectedMovie = -1;
        do
        {
          if (!fetcher.Fetch(strMovieName))
          {
            return false;
          }
          if (fuzzyMatching)
          {
            IMDB tmpImdb = new IMDB();
            selectedMovie = fetcher.FuzzyMatch(tmpImdb.GetSearchString(fetcher.MovieName));
            if (selectedMovie == -1 && fetcher.Count > 0)
            {
              if (!fetcher.OnSelectMovie(fetcher, out selectedMovie))
              {
                return false;
              }
              if (selectedMovie == -1)
              {
                if (!fetcher.OnRequestMovieTitle(fetcher, out strMovieName))
                {
                  return false;
                }
                if (strMovieName == string.Empty)
                {
                  return false;
                }
              }
            }
            else if (selectedMovie == -1)
            {
              if (!fetcher.OnMovieNotFound(fetcher))
              {
                return false;
              }
              if (!fetcher.OnRequestMovieTitle(fetcher, out strMovieName))
              {
                return false;
              }
              if (strMovieName == string.Empty)
              {
                return false;
              }
            }
          }
          else
          {
            if (fetcher.Count > 0)
            {
              // EPG - one result, get movie without ask
              if (fetcher.Count == 1 && !addToDatabase)
              {
                selectedMovie = 0;
                break;
              }
              
              int iMoviesFound = fetcher.Count;
              //GEMX 28.03.08: There should always be a choice to enter the movie manually 
              //               in case the 1 and only found name is wrong
              if (iMoviesFound > 0)
              {
                if (!fetcher.OnSelectMovie(fetcher, out selectedMovie))
                {
                  return false;
                }
                
                if (selectedMovie < 0)
                {
                  
                  if (!fetcher.OnRequestMovieTitle(fetcher, out strMovieName))
                  {
                    return false;
                  }
                  
                  if (strMovieName == string.Empty)
                  {
                    return false;
                  }
                }
              }
            }
            else
            {
              if (!fetcher.OnMovieNotFound(fetcher))
              {
                return false;
              }
              
              if (!fetcher.OnRequestMovieTitle(fetcher, out strMovieName))
              {
                return false;
              }
              
              if (strMovieName == string.Empty)
              {
                return false;
              }
            }
          }
        } while (selectedMovie < 0);
        
        if (!fetcher.FetchDetails(selectedMovie, ref currentMovie, addToDatabase))
        {
          return false;
        }
        
        IMDBMovie movieDetails = fetcher.Movie;

        if (movieDetails != null)
        {
          Log.Info("RefreshIMDB() - Found movie and added info for: {0} (Year: {1})",
                   movieDetails.Title, movieDetails.Year);

          movieDetails.SearchString = strMovieName;
          currentMovie = movieDetails;
          return true;
        }
        
        if (fetcher.Movie == null)
        {
          fetcher.Movie = currentMovie;
        }
        
        return fetcher.OnDetailsNotFound(fetcher);
      }
      return false;
    }
Example #13
0
 public bool OnSelectActor(IMDBFetcher fetcher, out int selected)
 {
   if (_progress != null)
   {
     return _progress.OnSelectActor(fetcher, out selected);
   }
   selected = -1;
   return false;
 }
Example #14
0
 public bool OnRequestMovieTitle(IMDBFetcher fetcher, out string movieName)
 {
   if (_progress != null)
   {
     return _progress.OnRequestMovieTitle(fetcher, out movieName);
   }
   movieName = string.Empty;
   return false;
 }
 public bool OnRequestMovieTitle(IMDBFetcher fetcher, out string movieName)
 {
   // won't occure
   movieName = "";
   return true;
 }
Example #16
0
    public bool OnSelectMovie(IMDBFetcher fetcher, out int selectedMovie)
    {
      if (_scanning)
      {
        _conflictFiles.Add(fetcher.Movie);
        selectedMovie = -1;
        return false;
      }
      GUIDialogSelect pDlgSelect = (GUIDialogSelect)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_SELECT);
      // more then 1 movie found
      // ask user to select 1
      pDlgSelect.Reset();
      pDlgSelect.SetHeading(196); //select movie
      for (int i = 0; i < fetcher.Count; ++i)
      {
        pDlgSelect.Add(fetcher[i].Title);
      }
      pDlgSelect.EnableButton(true);
      pDlgSelect.SetButtonLabel(413); // manual
      pDlgSelect.DoModal(GUIWindowManager.ActiveWindow);

      // and wait till user selects one
      selectedMovie = pDlgSelect.SelectedLabel;
      if (pDlgSelect.IsButtonPressed)
      {
        return true;
      }
      if (selectedMovie == -1)
      {
        return false;
      }
      return true;
    }
 public bool OnSelectMovie(IMDBFetcher fetcher, out int selectedMovie)
 {
   // won't occure
   selectedMovie = 0;
   return true;
 }
Example #18
0
    protected override void OnShowContextMenu()
    {
      GUIListItem item = facadeLayout.SelectedListItem;
      int itemNo = facadeLayout.SelectedListItemIndex;
      GUIDialogMenu dlg = (GUIDialogMenu)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_MENU);
      
      if (dlg == null)
      {
        return;
      }

      dlg.Reset();
      dlg.SetHeading(498); // menu

      if (item == null)
      {
        dlg.AddLocalizedString(868); // Reset virtual directory
      }
      else if (item.IsRemote || (item.IsFolder) && (item.Label == ".."))
      {
        return;
      }
      else
      {
        IMDBMovie movie = item.AlbumInfoTag as IMDBMovie;

        if (!facadeLayout.Focus)
        {
          // Menu button context menuu
          if (!_virtualDirectory.IsRemote(_currentFolder))
          {
            dlg.AddLocalizedString(102); //Scan
            dlg.AddLocalizedString(368); //IMDB
          }
        }
        else
        {
          // DVD & files
          if ((Path.GetFileName(item.Path) != string.Empty) || Util.Utils.IsDVD(item.Path))
          {
            // DVD disc drive
            if (Util.Utils.IsDVD(item.Path))
            {
              if (File.Exists(item.Path + @"\VIDEO_TS\VIDEO_TS.IFO") ||
                  File.Exists(item.Path + @"\BDMV\index.bdmv"))
              {
                dlg.AddLocalizedString(341); //play
              }
              else
              {
                dlg.AddLocalizedString(926); //Queue
                dlg.AddLocalizedString(102); //Scan
              }

              dlg.AddLocalizedString(368); //IMDB
              dlg.AddLocalizedString(654); //Eject
            }
            // Folder
            else if (item.IsFolder)
            {
              bool useMediaInfo = false;

              if (VirtualDirectory.IsImageFile(Path.GetExtension(item.Path)))
              {
                dlg.AddLocalizedString(208); //play
                useMediaInfo = true;
              }

              if (!VirtualDirectory.IsImageFile(Path.GetExtension(item.Path)))
              {
                // Simple folder
                if (!item.IsBdDvdFolder)
                {
                  dlg.AddLocalizedString(1204); // Play All in selected folder
                  dlg.AddLocalizedString(926); //Queue
                  dlg.AddLocalizedString(102); //Scan 
                  dlg.AddLocalizedString(1280); // Scan using nfo files
                }
                // DVD folder
                else if (item.IsBdDvdFolder)
                {
                  useMediaInfo = true;
                  dlg.AddLocalizedString(208); //play             
                  dlg.AddLocalizedString(926); //Queue
                  dlg.AddLocalizedString(368); //IMDB
                  
                  if (movie != null && !movie.IsEmpty)
                  {
                    if (item.IsPlayed)
                    {
                      {
                        dlg.AddLocalizedString(830); //Reset watched status for DVD folder
                      }
                    }
                    else
                    {
                      dlg.AddLocalizedString(1260); // Set watched status
                    }
                  }
                }
              }

              if (Util.Utils.getDriveType(item.Path) == 5)
              {
                dlg.AddLocalizedString(654); //Eject            
              }

              if (!IsFolderPinProtected(item.Path) && _fileMenuEnabled)
              {
                dlg.AddLocalizedString(500); // FileMenu            
              }

              if (useMediaInfo)
              {
                dlg.AddLocalizedString(1264); //Media info
              }
            }
            else
            {
              dlg.AddLocalizedString(208); //Play
              dlg.AddLocalizedString(926); //Queue
              dlg.AddLocalizedString(368); //IMDB

              if (item.IsPlayed)
              {
                dlg.AddLocalizedString(830); //Reset watched status
              }
              else
              {
                dlg.AddLocalizedString(1260); // Set watched status
              }

              if (!IsFolderPinProtected(item.Path) && !item.IsRemote && _fileMenuEnabled)
              {
                dlg.AddLocalizedString(500); // FileMenu
              }
              dlg.AddLocalizedString(1264); //Media info
            }
          }
          else if (Util.Utils.IsNetwork(item.Path)) // Process network root with drive letter
          {
            dlg.AddLocalizedString(1204); // Play All in selected folder
          }
        }
        if (!_mapSettings.Stack)
        {
          dlg.AddLocalizedString(346); //Stack
        }
        else
        {
          dlg.AddLocalizedString(347); //Unstack
        }
        if (Util.Utils.IsRemovable(item.Path))
        {
          dlg.AddLocalizedString(831);
        }

        dlg.AddLocalizedString(1299); // Refresh current directory
        dlg.AddLocalizedString(1262); // Update grabber scripts
        dlg.AddLocalizedString(1307); // Update internal grabber scripts
        dlg.AddLocalizedString(1263); // Set default grabber
      }

      dlg.DoModal(GetID);

      if (dlg.SelectedId == -1)
      {
        return;
      }
      switch (dlg.SelectedId)
      {
        case 368: // IMDB
          OnInfo(itemNo);
          break;

        case 208: // play
          _playClicked = true;
          OnClick(itemNo);
          break;

        case 926: // add to playlist
          OnQueueItem(itemNo);
          break;

        case 136: // show playlist
          GUIWindowManager.ActivateWindow((int)Window.WINDOW_VIDEO_PLAYLIST);
          break;

        case 654: // Eject
          if (Util.Utils.getDriveType(item.Path) != 5)
          {
            Util.Utils.EjectCDROM();
          }
          else
          {
            Util.Utils.EjectCDROM(Path.GetPathRoot(item.Path));
          }
          LoadDirectory(string.Empty);
          break;

        case 341: //Play dvd
          OnPlayDVD(item.Path, GetID);
          break;

        case 346: //Stack
          _mapSettings.Stack = true;
          LoadDirectory(_currentFolder);
          UpdateButtonStates();
          break;

        case 347: //Unstack
          _mapSettings.Stack = false;
          LoadDirectory(_currentFolder);
          UpdateButtonStates();
          break;

        case 102: //Scan
          if (_doNotUseDatabase)
          {
            GUIDialogOK dlgOk = (GUIDialogOK)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_OK);
            dlgOk.SetHeading(string.Empty);
            dlgOk.SetLine(1, GUILocalizeStrings.Get(416)); // Not available
            dlgOk.DoModal(GUIWindowManager.ActiveWindow);
            return;
          }

          if (facadeLayout.Focus)
          {
            if (item.IsFolder)
            {
              if (item.Label == "..")
              {
                return;
              }
              if (item.IsRemote)
              {
                return;
              }
            }
          }

          if (!_virtualDirectory.RequestPin(item.Path))
          {
            return;
          }
          
          int currentIndex = facadeLayout.SelectedListItemIndex;

          if (_useOnlyNfoScraper)
          {
            ArrayList scanNfoFiles = new ArrayList();
            GetNfoFiles(item.Path, ref scanNfoFiles);
            IMDBFetcher scanFetcher = new IMDBFetcher(this);
            scanFetcher.FetchNfo(scanNfoFiles, true, false);
            // Send global message that movie is refreshed/scanned
            GUIMessage scanNfoMsg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_VIDEOINFO_REFRESH, 0, 0, 0, 0, 0, null);
            GUIWindowManager.SendMessage(scanNfoMsg);
            LoadDirectory(_currentFolder);
            facadeLayout.SelectedListItemIndex = currentIndex;
          }
          else
          {
            ArrayList availablePaths = new ArrayList();
            availablePaths.Add(item.Path);
            IMDBFetcher.ScanIMDB(this, availablePaths, _isFuzzyMatching, _scanSkipExisting, _getActors, false);
            // Send global message that movie is refreshed/scanned
            GUIMessage scanMsg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_VIDEOINFO_REFRESH, 0, 0, 0, 0, 0, null);
            GUIWindowManager.SendMessage(scanMsg);
            LoadDirectory(_currentFolder);
            facadeLayout.SelectedListItemIndex = currentIndex;
          }
          break;

        case 1280: //Scan using nfo files
          if (_doNotUseDatabase)
          {
            GUIDialogOK dlgOk = (GUIDialogOK)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_OK);
            dlgOk.SetHeading(string.Empty);
            dlgOk.SetLine(1, GUILocalizeStrings.Get(416)); // Not available
            dlgOk.DoModal(GUIWindowManager.ActiveWindow);
            return;
          }

          if (facadeLayout.Focus)
          {
            if (item.IsFolder)
            {
              if (item.Label == "..")
              {
                return;
              }
              if (item.IsRemote)
              {
                return;
              }
            }
          }

          if (!_virtualDirectory.RequestPin(item.Path))
          {
            return;
          }
          
          currentIndex = facadeLayout.SelectedListItemIndex;
          ArrayList nfoFiles = new ArrayList();
          GetNfoFiles(item.Path, ref nfoFiles);
          IMDBFetcher fetcher = new IMDBFetcher(this);
          fetcher.FetchNfo(nfoFiles, true, false);
          // Send global message that movie is refreshed/scanned
          GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_VIDEOINFO_REFRESH, 0, 0, 0, 0, 0, null);
          GUIWindowManager.SendMessage(msg);
          LoadDirectory(_currentFolder);
          facadeLayout.SelectedListItemIndex = currentIndex;
          break;

        case 830: // Reset watched status
          SetMovieWatchStatus(item.Path, item.IsFolder, false);
          int selectedIndex = facadeLayout.SelectedListItemIndex;
          LoadDirectory(_currentFolder);
          UpdateButtonStates();
          facadeLayout.SelectedListItemIndex = selectedIndex;
          break;

        case 1260: // Set watched status
          SetMovieWatchStatus(item.Path, item.IsFolder, true);
          selectedIndex = facadeLayout.SelectedListItemIndex;
          LoadDirectory(_currentFolder);
          UpdateButtonStates();
          facadeLayout.SelectedListItemIndex = selectedIndex;
          break;

        case 500: // File menu
          {
            ShowFileMenu(false);
          }
          break;

        case 831:
          string message;

          if (!RemovableDriveHelper.EjectDrive(item.Path, out message))
          {
            GUIDialogOK pDlgOK = (GUIDialogOK)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_OK);
            pDlgOK.SetHeading(831);
            pDlgOK.SetLine(1, GUILocalizeStrings.Get(832));
            pDlgOK.SetLine(2, string.Empty);
            pDlgOK.SetLine(3, message);
            pDlgOK.DoModal(GUIWindowManager.ActiveWindow);
          }
          else
          {
            GUIDialogOK pDlgOK = (GUIDialogOK)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_OK);
            pDlgOK.SetHeading(831);
            pDlgOK.SetLine(1, GUILocalizeStrings.Get(833));
            pDlgOK.DoModal(GUIWindowManager.ActiveWindow);
          }
          break;

        case 1204: // Play all
          {
            if (!_virtualDirectory.RequestPin(item.Path))
            {
              return;
            }
            OnPlayAll(item.Path);
          }
          break;

        case 1299: // Refresh current directory
          {
            if (facadeLayout.ListLayout.ListItems.Count > 0 && !string.IsNullOrEmpty(_currentFolder))
            {
              facadeLayout.SelectedListItemIndex = 0;
              LoadDirectory(_currentFolder, false);
            }
          }
          break;

        case 868: // Reset V.directory
          {
            ResetShares();

            if (_virtualDirectory.DefaultShare != null && _virtualDirectory.DefaultShare.Path != string.Empty)
            {
              LoadDirectory(_virtualDirectory.DefaultShare.Path, false);
            }
            else
            {
              LoadDirectory(string.Empty, false);
            }
          }
          break;

        case 1262: // Update grabber scripts
          UpdateGrabberScripts(false);
          break;
        case 1307: // Update internal grabber scripts
          UpdateGrabberScripts(true);
          break;
        case 1263: // Set deault grabber script
          SetDefaultGrabber();
          break;
        case 1264: // Get media info (refresh mediainfo and duration)
          if (item != null)
          {
            string file = item.Path;
            SelectDVDHandler sdh = new SelectDVDHandler();
            SelectBDHandler bdh = new SelectBDHandler();

            if (sdh.IsDvdDirectory(item.Path))
            {
              if (File.Exists(item.Path + @"\VIDEO_TS\VIDEO_TS.IFO"))
              {
                file = file + @"\VIDEO_TS\VIDEO_TS.IFO";
              }
            }

            if (bdh.IsBDDirectory(item.Path))
            {
              if (File.Exists(item.Path + @"\BDMV\INDEX.BDMV"))
              {
                file = file + @"\BDMV\INDEX.BDMV";
              }
            }

            ArrayList files = new ArrayList();
            files = AddFileToDatabase(file);
            MovieDuration(files, true);
            int movieId = VideoDatabase.GetMovieId(file);
            IMDBMovie mInfo = new IMDBMovie();
            mInfo.SetMediaInfoProperties(file, true);
            mInfo.SetDurationProperty(movieId);
            IMDBMovie.SetMovieData(item);
            SelectCurrentItem();
          }
          break;
      }
    }
Example #19
0
    protected override void OnSearchNew()
    {
      if (_doNotUseDatabase)
      {
        GUIDialogOK dlgOk = (GUIDialogOK)GUIWindowManager.GetWindow((int)GUIWindow.Window.WINDOW_DIALOG_OK);
        dlgOk.SetHeading(string.Empty);
        dlgOk.SetLine(1, GUILocalizeStrings.Get(416)); // Not available
        dlgOk.DoModal(GUIWindowManager.ActiveWindow);
        return;
      }

      int maximumShares = 128;
      ArrayList availablePaths = new ArrayList();

      using (Profile.Settings xmlreader = new MPSettings())
      {
        for (int index = 0; index < maximumShares; index++)
        {
          string sharePath = String.Format("sharepath{0}", index);
          string shareDir = xmlreader.GetValueAsString("movies", sharePath, "");
          string shareScan = String.Format("sharescan{0}", index);
          bool shareScanData = xmlreader.GetValueAsBool("movies", shareScan, true);

          if (shareScanData && shareDir != string.Empty)
          {
            availablePaths.Add(shareDir);
          }
        }

        ArrayList nfoFiles = new ArrayList();

        foreach (string availablePath in availablePaths)
        {
          GetNfoFiles(availablePath, ref nfoFiles);
        }

        if (!_useOnlyNfoScraper) // Normal scraper
        {
          // First try nfo files
          IMDBFetcher fetcher = new IMDBFetcher(this);
          fetcher.FetchNfo(nfoFiles, true, false);
          // Then video files without nfo
          IMDBFetcher.ScanIMDB(this, availablePaths, true, true, true, false);
        }
        else
        {
          // Only nfo files
          IMDBFetcher fetcher = new IMDBFetcher(this);
          fetcher.FetchNfo(nfoFiles, true, false);
        }
        
        // Send global message that movie is refreshed/scanned
        GUIMessage msg = new GUIMessage(GUIMessage.MessageType.GUI_MSG_VIDEOINFO_REFRESH, 0, 0, 0, 0, 0, null);
        GUIWindowManager.SendMessage(msg);

        _currentSelectedItem = facadeLayout.SelectedListItemIndex;

        if (_currentSelectedItem > 0)
        {
          _currentSelectedItem--;
        }

        LoadDirectory(_currentFolder);

        if (_currentSelectedItem >= 0)
        {
          GUIControl.SelectItemControl(GetID, facadeLayout.GetID, _currentSelectedItem);
        }
      }
    }
 public bool OnSearchStarting(IMDBFetcher fetcher)
 {
   GUIDialogProgress pDlgProgress =
     (GUIDialogProgress)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_PROGRESS);
   // show dialog that we're busy querying www.imdb.com
   pDlgProgress.Reset();
   pDlgProgress.SetHeading(GUILocalizeStrings.Get(197));
   pDlgProgress.SetLine(1, fetcher.MovieName);
   pDlgProgress.SetLine(2, string.Empty);
   pDlgProgress.SetObject(fetcher);
   pDlgProgress.StartModal(GUIWindowManager.ActiveWindow);
   return true;
 }
Example #21
0
 public bool OnSearchStarting(IMDBFetcher fetcher)
 {
   GUIDialogProgress pDlgProgress =
     (GUIDialogProgress) GUIWindowManager.GetWindow((int) Window.WINDOW_DIALOG_PROGRESS);
   // show dialog that we're busy querying www.imdb.com
   String heading;
   if (_scanning)
   {
     heading = String.Format("{0}:{1}/{2}", GUILocalizeStrings.Get(197), _scanningFileNumber, _scanningFileTotal);
   }
   else
   {
     heading = GUILocalizeStrings.Get(197);
   }
   pDlgProgress.Reset();
   pDlgProgress.SetHeading(heading);
   pDlgProgress.SetLine(1, fetcher.MovieName);
   pDlgProgress.SetLine(2, string.Empty);
   pDlgProgress.SetObject(fetcher);
   pDlgProgress.StartModal(GUIWindowManager.ActiveWindow);
   return true;
 }
 public bool OnDetailsStarting(IMDBFetcher fetcher)
 {
   GUIDialogProgress pDlgProgress =
     (GUIDialogProgress)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_PROGRESS);
   // show dialog that we're downloading the movie info
   pDlgProgress.Reset();
   pDlgProgress.SetHeading(GUILocalizeStrings.Get(198));
   //pDlgProgress.SetLine(0, strMovieName);
   pDlgProgress.SetLine(1, fetcher.MovieName);
   pDlgProgress.SetLine(2, string.Empty);
   pDlgProgress.SetObject(fetcher);
   pDlgProgress.StartModal(GUIWindowManager.ActiveWindow);
   return true;
 }
Example #23
0
 public bool OnActorInfoStarting(IMDBFetcher fetcher)
 {
   GUIDialogProgress pDlgProgress =
     (GUIDialogProgress) GUIWindowManager.GetWindow((int) Window.WINDOW_DIALOG_PROGRESS);
   // show dialog that we're downloading the actor info
   String heading;
   if (_scanning)
   {
     heading = String.Format("{0}:{1}/{2}", GUILocalizeStrings.Get(986), _scanningFileNumber, _scanningFileTotal);
   }
   else
   {
     heading = GUILocalizeStrings.Get(1302);
   }
   pDlgProgress.Reset();
   pDlgProgress.SetHeading(heading);
   //pDlgProgress.SetLine(0, strMovieName);
   pDlgProgress.SetLine(1, fetcher.ActorName);
   pDlgProgress.SetLine(2, string.Empty);
   pDlgProgress.SetObject(fetcher);
   pDlgProgress.StartModal(GUIWindowManager.ActiveWindow);
   return true;
 }
 public bool OnActorsStarting(IMDBFetcher fetcher)
 {
   // won't occure
   return true;
 }
Example #25
0
 public bool OnActorsEnd(IMDBFetcher fetcher)
 {
   return true;
 }
 public bool OnActorsEnd(IMDBFetcher fetcher)
 {
   // won't occure
   return true;
 }
Example #27
0
    public bool OnRequestMovieTitle(IMDBFetcher fetcher, out string movieName)
    {
      movieName = string.Empty;

      if (_scanning)
      {
        _conflictFiles.Add(fetcher.Movie);
        movieName = string.Empty;
        return false;
      }

      string filename = string.Empty;
      
      if (!string.IsNullOrEmpty(_selectedFilename))
      {
        try
        {
          if (_selectedFilename.ToUpperInvariant().Contains(@"\VIDEO_TS\VIDEO_TS.IFO"))
          {
            filename = _selectedFilename.ToUpperInvariant().Replace(@"\VIDEO_TS\VIDEO_TS.IFO", string.Empty);
            int iIndex = 0;
            iIndex = filename.LastIndexOf(@"\");
            movieName = filename.Substring(iIndex + 1);
          }
          else if (_selectedFilename.ToUpperInvariant().Contains(@"\BDMV\INDEX.BDMV"))
          {
            filename = _selectedFilename.ToUpperInvariant().Replace(@"\BDMV\INDEX.BDMV", string.Empty);
            int iIndex = 0;
            iIndex = filename.LastIndexOf(@"\");
            movieName = filename.Substring(iIndex + 1);
          }
          else
          {
            movieName = Path.GetFileNameWithoutExtension(_selectedFilename);
            Util.Utils.RemoveStackEndings(ref filename);
          }
        }
        catch (Exception){}
      }
      else
      {
        movieName = fetcher.MovieName;
      }

      if (VirtualKeyboard.GetKeyboard(ref movieName, GetID))
      {
        if (movieName == string.Empty)
        {
          return false;
        }
        return true;
      }

      movieName = string.Empty;
      return false;
    }
 public bool OnDetailsNotFound(IMDBFetcher fetcher)
 {
   Log.Info("IMDB Fetcher: OnDetailsNotFound");
   // show dialog...
   GUIDialogOK pDlgOK = (GUIDialogOK)GUIWindowManager.GetWindow((int)Window.WINDOW_DIALOG_OK);
   // show dialog...
   pDlgOK.SetHeading(195);
   pDlgOK.SetLine(1, fetcher.MovieName);
   pDlgOK.SetLine(2, string.Empty);
   pDlgOK.DoModal(GUIWindowManager.ActiveWindow);
   return false;
 }
Example #29
0
    public bool OnSelectActor(IMDBFetcher fetcher, out int selectedActor)
    {
      GUIDialogSelect pDlgSelect = (GUIDialogSelect) GUIWindowManager.GetWindow((int) Window.WINDOW_DIALOG_SELECT);
      // more then 1 actor found
      // ask user to select 1
      pDlgSelect.SetHeading(GUILocalizeStrings.Get(1310)); //select actor
      pDlgSelect.Reset();
      for (int i = 0; i < fetcher.Count; ++i)
      {
        pDlgSelect.Add(fetcher[i].Title);
      }
      pDlgSelect.EnableButton(false);
      pDlgSelect.DoModal(GUIWindowManager.ActiveWindow);

      // and wait till user selects one
      selectedActor = pDlgSelect.SelectedLabel;
      if (selectedActor != -1)
      {
        return true;
      }
      return false;
    }
Example #30
0
 public bool OnActorsEnd(IMDBFetcher fetcher)
 {
   if (_progress != null)
   {
     return _progress.OnActorsEnd(fetcher);
   }
   return false;
 }