Ejemplo n.º 1
0
        static void Main( string[] args )
        {
            if( args.Length != 3 )
            {
                System.Console.WriteLine( "[sourcePath] [searchFilter] [destinationPath]" );
                return;
            }

            source      = new DirectoryInfo( args[0] );
            Filter      = args[1];
            destination = new DirectoryInfo( args[2] );

            using( DatabaseDataContext db = new DatabaseDataContext() )
            {
                db.Test_InsertDemoData("\\Lib");

                foreach( FileInfo file in GetFiles( source ) )
                {
                    IJob  job   = new Job( );
                    IStep step1 = new Step();

                    CutVideoFramePlugin still = new CutVideoFramePlugin();
                    TranscodeTwoPassh264Plugin transcode = new TranscodeTwoPassh264Plugin();

                    still.SourceFilePath      = file.FullName;
                    still.DestinationFilePath = Path.Combine( destination.FullName, Path.Combine(file.Name, ".png") );

                    transcode.SourceFilePath      = file.FullName;
                    transcode.DestinationFilePath = Path.Combine(destination.FullName, file.Name);
                    transcode.VideoBitrate        = ( 1024 - 128 ) * 1024;
                    transcode.AudioBitrate        = 128 * 1024;

                    step1.Add(still);
                    step1.Add(transcode);

                    job.Add(step1);

                    System.Console.WriteLine( file.FullName + ", added");

                    db.Job_Insert(job.StatusID, job.JobXML.ToString());
                }
            }
        }
        public void TestOctopusTranscode()
        {
            using (DatabaseDataContext db = new DatabaseDataContext())
            {
                db.Test_InsertDemoData(Regex.Replace(Environment.CurrentDirectory, @"src\\(?:demo|test)\\(?:plugins\\)?[\w.\-]+\\bin\\(?:Debug|Release)$", "bin\\plugins\\"));

                using (IControllerEngine controllerEngine = new ControllerEngine(true))
                {
                    var job = new Job();
                    var step = new Step();

                    step.Add(CreatePlugin());
                    job.Add(step);

                    db.Job_Insert( job.StatusID, job.JobXML.ToString());

                    Timing.WaitUntil(() => db.Job_GetUnfinishedJobs().ToList().Count == 1, 10 * 1000, "Wait til job has been added");
                    Timing.WaitUntil(() => db.Job_GetUnfinishedJobs().ToList().Count == 0, 120 * 1000, "Wait til job has completed");
                }
            }
        }