Example #1
0
        private void goButton_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(input.Filename) || string.IsNullOrEmpty(output.Filename) || string.IsNullOrEmpty(cuts.Filename))
            {
                MessageBox.Show("Can't create job: input not configured.", "Can't create job", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if (!output.Filename.ToLower(System.Globalization.CultureInfo.InvariantCulture).EndsWith(Path.GetExtension(input.Filename).ToLower(System.Globalization.CultureInfo.InvariantCulture)))
            {
                MessageBox.Show("Can't create job: input and output have different types.", "Can't create job", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            Cuts c = null;

            try
            {
                c = FilmCutter.ReadCutsFromFile(cuts.Filename);
            }
            catch (Exception)
            {
                MessageBox.Show("Error reading cutlist. Is it the correct format?", "Error reading cutlist", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            string prefix = getAcceptableFilename(output.Filename, c.AllCuts.Count * 2);

            string[] tempfiles = generateNumberedFilenames(prefix, Path.GetExtension(output.Filename), c.AllCuts.Count * 2);

            AudioSplitJob split = new AudioSplitJob(input.Filename, prefix, c);

            for (int i = 1; i < tempfiles.Length; i += 2)
            {
                split.FilesToDelete.Add(tempfiles[i]);
            }

            int length = tempfiles.Length / 2;

            if (tempfiles.Length % 2 != 0)
            {
                length++;
            }
            string[] evens = new string[length];
            for (int i = 0; i < evens.Length; i++)
            {
                evens[i] = tempfiles[2 * i];
            }

            AudioJoinJob join = new AudioJoinJob(evens, output.Filename);

            join.FilesToDelete.AddRange(evens);
            // generate the join commandline later

            join.ClipLength = TimeSpan.FromSeconds((double)c.TotalFrames / c.Framerate);

            info.Jobs.addJobsWithDependencies(new SequentialChain(split, join));
            this.Dispose();
        }
Example #2
0
        private void goButton_Click(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(input.Filename) || string.IsNullOrEmpty(output.Filename) || string.IsNullOrEmpty(cuts.Filename))
            {
                MessageBox.Show("Can't create job: input not configured.", "Can't create job", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            if (!output.Filename.ToLower().EndsWith(Path.GetExtension(input.Filename).ToLower()))
            {
                MessageBox.Show("Can't create job: input and output have different types.", "Can't create job", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            Cuts c = null;
            try
            {
                c = FilmCutter.ReadCutsFromFile(cuts.Filename);
            }
            catch (Exception)
            {
                MessageBox.Show("Error reading cutlist. Is it the correct format?", "Error reading cutlist", MessageBoxButtons.OK, MessageBoxIcon.Error);
                return;
            }

            string prefix = getAcceptableFilename(output.Filename, c.AllCuts.Count*2);
            string[] tempfiles = generateNumberedFilenames(prefix, Path.GetExtension(output.Filename), c.AllCuts.Count * 2);

            AudioSplitJob split = new AudioSplitJob(input.Filename, prefix, c);
            for (int i = 1; i < tempfiles.Length; i += 2)
                split.FilesToDelete.Add(tempfiles[i]);

            int length = tempfiles.Length / 2;
            if (tempfiles.Length % 2 != 0)
                length++;
            string[] evens = new string[length];
            for (int i = 0; i < evens.Length; i++)
                evens[i] = tempfiles[2 * i];

            AudioJoinJob join = new AudioJoinJob(evens, output.Filename);
            join.FilesToDelete.AddRange(evens);
            // generate the join commandline later

            join.ClipLength = TimeSpan.FromSeconds((double)c.TotalFrames / c.Framerate);

            info.Jobs.addJobsWithDependencies(new SequentialChain(split, join));
            this.Dispose();
        }