Beispiel #1
0
        /// <summary>
        /// Scan progress is shown in progress bar. Results are shown in listview as they are processed.
        /// </summary>
        private void scan_ProgressChange(object sender, ProgressChangedEventArgs e)
        {
            if (!scanRunning)
            {
                this.Progress        = 0;
                this.ProgressMessage = string.Empty;
                return;
            }

            // Get process
            ScanProcess process = (ScanProcess)sender;
            string      info    = (string)e.UserState;

            // Get progress bar message based on scan type
            string msg = process.Description();

            if (e.ProgressPercentage == 100)
            {
                msg += " - Complete";
            }
            else if (process != ScanProcess.FileCollect && process != ScanProcess.Directory)
            {
                msg += " - Processing File '" + System.IO.Path.GetFileName(info) + "'";
            }

            UpdateProgressSafe(e.ProgressPercentage, msg);
        }
Beispiel #2
0
 /// <summary>
 /// Triggers ItemsInitialized event
 /// </summary>
 public void OnItemsInitialized(ScanProcess process, List <OrgItem> items)
 {
     if (ItemsInitialized != null)
     {
         ItemsInitialized(process, new ItemsInitializedArgs(items));
     }
 }
Beispiel #3
0
 /// <summary>
 /// Triggers ProgressChange event
 /// </summary>
 public void OnProgressChange(ScanProcess process, string info, int percent)
 {
     if (ProgressChange != null && !scanCanceled)
     {
         ProgressChange(process, new ProgressChangedEventArgs(percent, info));
     }
 }
Beispiel #4
0
        /// <summary>
        /// Returns wether a choice was made and changes the file path
        /// </summary>
        /// <param name="filePath"></param>
        /// <returns>True if playback should continue, False if user cancelled.</returns>
        private bool DoFeatureSelection(ref string filePath)
        {
            try
            {
                // If we have chosen a specific playlist, build the path directly without scanning the complete structure again
                if (_manualTitleSelection != null && !string.IsNullOrEmpty(_playlistFolder))
                {
                    filePath = Path.Combine(_playlistFolder, _manualTitleSelection.Name);
                    GetChapters(_manualTitleSelection);
                    _manualTitleSelection = null;
                    return(true);
                }

                ScanProcess  scanner = ScanWorker;
                IAsyncResult result  = scanner.BeginInvoke(filePath, null, scanner);
                result.AsyncWaitHandle.WaitOne();
                BDInfoExt bluray = scanner.EndInvoke(result);

                // Store all playlist files for title selection
                _bdTitles = bluray.PlaylistFiles.Values.Where(p => p.IsValid && !p.HasLoops).Distinct().ToList();
                int counter = 0;
                _bdTitleNames   = _bdTitles.Select(t => FormatTitle(t, ++counter)).ToArray();
                _playlistFolder = bluray.DirectoryPLAYLIST.FullName;

                List <TSPlaylistFile> allPlayLists = _bdTitles.OrderByDescending(p => p.TotalLength).ToList();

                // Feature selection logic
                TSPlaylistFile listToPlay;
                if (allPlayLists.Count == 0)
                {
                    BDPlayerBuilder.LogInfo("No valid playlists found, use default INDEX.BDMV.");
                    return(true);
                }
                if (allPlayLists.Count == 1)
                {
                    // if we have only one playlist to show just move on
                    BDPlayerBuilder.LogInfo("Found one valid playlist {0}.", allPlayLists[0].Name);
                    listToPlay = allPlayLists[0];
                }
                else
                {
                    // Show selection dialog
                    BDPlayerBuilder.LogInfo("Found {0} playlists, title selection available.", allPlayLists.Count);

                    // first make an educated guess about what the real features are (more than one chapter, no loops and longer than one hour)
                    // todo: make a better filter on the playlists containing the real features
                    List <TSPlaylistFile> playLists = allPlayLists.Where(p => (p.Chapters.Count > 1 || p.TotalLength >= MINIMAL_FULL_FEATURE_LENGTH) && !p.HasLoops).ToList();

                    // if the filter yields zero results just list all playlists
                    if (playLists.Count == 0)
                    {
                        playLists = allPlayLists;
                    }

                    listToPlay = playLists[0];
                }

                BDPlayerBuilder.LogInfo("Using playlist {0}.", listToPlay.Name);
                for (int idx = 0; idx < _bdTitles.Count; idx++)
                {
                    if (_bdTitles[idx] != listToPlay)
                    {
                        continue;
                    }
                    _currentTitleName = _bdTitleNames[idx];
                    break;
                }

                GetChapters(listToPlay);

                // Combine the chosen file path (playlist)
                filePath = Path.Combine(bluray.DirectoryPLAYLIST.FullName, listToPlay.Name);
                return(true);
            }
            catch (Exception e)
            {
                BDPlayerBuilder.LogError("Exception while reading bluray structure {0} {1}", e.Message, e.StackTrace);
                return(true);
            }
        }
Beispiel #5
0
 /// <summary>
 /// Triggers ProgressChange event
 /// </summary>
 public void OnProgressChange(ScanProcess process, string info, int percent)
 {
     if (ProgressChange != null && !scanCanceled)
         ProgressChange(process, new ProgressChangedEventArgs(percent, info));
 }
Beispiel #6
0
 /// <summary>
 /// Triggers ItemsInitialized event
 /// </summary>
 public void OnItemsInitialized(ScanProcess process, List<OrgItem> items)
 {
     if (ItemsInitialized != null)
         ItemsInitialized(process, new ItemsInitializedArgs(items));
 }