StartScan() 공개 메소드

Starts scanning the given path.
public StartScan ( string path, int previewCount ) : void
path string The path to the video to scan.
previewCount int The number of preview images to make.
리턴 void
예제 #1
0
        static void Main(string[] args) {
            instance = new HandBrakeInstance();
            instance.Initialize(verbosity: 1);
            instance.ScanCompleted += instance_ScanCompleted;
            instance.StartScan(SourceFile, previewCount: 10);

            Console.ReadLine();
        }
예제 #2
0
		public void ScanNextJob()
		{
			EncodeJobViewModel jobVM = itemsToScan[currentJobIndex];

			var onDemandInstance = new HandBrakeInstance();
			onDemandInstance.Initialize(Config.LogVerbosity);
			onDemandInstance.ScanProgress += (o, e) =>
				{
					lock (this.currentJobIndexLock)
					{
						this.currentJobProgress = e.Progress;
						this.RaisePropertyChanged(() => this.Progress);
					}
				};
			onDemandInstance.ScanCompleted += (o, e) =>
				{
					jobVM.HandBrakeInstance = onDemandInstance;

					if (onDemandInstance.Titles.Count > 0)
					{
						Title titleToEncode = Utilities.GetFeatureTitle(onDemandInstance.Titles, onDemandInstance.FeatureTitle);

						jobVM.Job.Title = titleToEncode.TitleNumber;
						jobVM.Job.Length = titleToEncode.Duration;
						jobVM.Job.ChapterStart = 1;
						jobVM.Job.ChapterEnd = titleToEncode.Chapters.Count;
					}

					lock (this.currentJobIndexLock)
					{
						this.currentJobIndex++;
						this.currentJobProgress = 0;
						this.RaisePropertyChanged(() => this.Progress);

						if (this.ScanFinished)
						{
							DispatchService.BeginInvoke(() =>
							{
								this.CancelCommand.Execute(null);
							});
						}
						else
						{
							this.ScanNextJob();
						}
					}
				};

			onDemandInstance.StartScan(jobVM.Job.SourcePath, Config.PreviewCount, 0);
		}
예제 #3
0
        private void RunJob(string jobName)
        {
            this.resetEvent.Reset();

            EncodeJob job = EncodeJobsPersist.GetJob("Normal");

            if (job.SourceType == SourceType.VideoFolder)
            {
                job.SourcePath = Path.Combine(Environment.CurrentDirectory, Path.GetFileName(job.SourcePath));
            }

            if (job.SourceType == SourceType.File)
            {
                job.SourcePath = Path.Combine(Environment.CurrentDirectory, Path.GetFileName(job.SourcePath));
            }

            string extension;
            if (job.EncodingProfile.OutputFormat == OutputFormat.Mkv)
            {
                extension = ".mkv";
            }
            else
            {
                extension = ".mp4";
            }

            job.OutputPath = Path.Combine(OutputVideoDirectory, jobName + extension);

            var instance = new HandBrakeInstance();
            instance.Initialize(0);
            instance.ScanCompleted += (sender, e) =>
            {
                this.resetEvent.Set();
            };

            instance.StartScan(job.SourcePath, 10);
            this.resetEvent.WaitOne();

            this.resetEvent.Reset();
            instance.EncodeCompleted += (sender, e) =>
            {
                Assert.IsFalse(e.Error);
                this.resetEvent.Set();
            };

            instance.StartEncode(job);
            this.resetEvent.WaitOne();

            Assert.IsTrue(File.Exists(job.OutputPath));

            var fileInfo = new FileInfo(job.OutputPath);
            Assert.IsTrue(fileInfo.Length > 1024);
        }