Example #1
0
        static void Main(string[] args)
        {
            StreamWriter stdOut = new StreamWriter(Console.OpenStandardOutput());

            if (args.Length == 0)
            {
                stdOut.WriteLine("No DVD path specified on the command line.");
                stdOut.Close();
                return;
            }

            string destination = args[1];

            destination = Path.ChangeExtension(destination, null);

            Encode encoder = new Encode();

            encoder.source      = args[0];
            encoder.destination = destination;
            if (args.Length > 2)
            {
                encoder.profile = args[2];
            }
            encoder.Run();
        }
Example #2
0
        static void Main(string[] args)
        {
            StreamWriter stdOut = new StreamWriter(Console.OpenStandardOutput());
            if (args.Length == 0)
            {
                stdOut.WriteLine ("No DVD path specified on the command line.");
                stdOut.Close();
                return;
            }

            string destination = args[1];
            destination = Path.ChangeExtension(destination, null);

            Encode encoder = new Encode();
            encoder.source = args[0];
            encoder.destination = destination;
            if (args.Length > 2)
            {
                encoder.profile = args[2];
            }
            encoder.Run();
        }
Example #3
0
        public void Run()
        {
            VideoEncoderConfig currentConfig = null;

            try
            {
                currentConfig = VideoEncoderConfig.Load(_configFile);
            }
            catch (Exception ex)
            {
                stdOut.Write("Error reading config file. ");
                stdOut.WriteLine(ex.Message);
                stdOut.Close();
                return;
            }

            if (currentConfig == null)
            {
                stdOut.WriteLine("Unable to read config file.");
                stdOut.Close();
                return;
            }

            ProfileConfig currentProfile = currentConfig.GetProfile(_profile);

            if (currentConfig == null)
            {
                stdOut.WriteLine("Profile not found. " + _profile);
                stdOut.Close();
                return;
            }

            stdOut.WriteLine("Using profile " + _profile);

            if ((currentProfile.overwrite == false) && (Encode.DestinationExists(_destination) == true))
            {
                stdOut.WriteLine("Destination file exists.");
                stdOut.Close();
                return;
            }

            bool result = this.CropDetect(currentConfig.encodeCommand, String.Format(currentProfile.cropDetect, this._source, this._destination));

            if (result == true)
            {
                foreach (string currentPass in currentProfile.passes)
                {
                    result = this.EncodeProcess(currentConfig.encodeCommand, String.Format(currentPass, this._source, this._destination, this._cropCommand));
                    if (result == false)
                    {
                        break;
                    }
                }

                foreach (string currentCleanup in currentProfile.cleanup)
                {
                    result = this.CleanupProcess(String.Format(currentCleanup, this._source, this._destination));
                    if (result == false)
                    {
                        break;
                    }
                }

                if ((currentProfile.fourCC != null) && (currentProfile.fourCC.Length == 4))
                {
                    FixRiff(_destination, currentProfile.fourCC);
                }
            }

            stdOut.Close();
        }