<commit_before>﻿using System;
using System.Configuration;
using System.IO;
using Talifun.Commander.Command.Video.AudioFormats;
using Talifun.Commander.Command.Video.Configuration;
using Talifun.Commander.Command.Video.Containers;
using Talifun.Commander.Command.Video.VideoFormats;
using Talifun.Commander.Executor.CommandLine;
using Talifun.Commander.Executor.FFMpeg;

namespace Talifun.Commander.Command.Video
{
	public class FlvCommand : ICommand<IContainerSettings>
    {
        #region ICommand<FLVCommand,FLVSettings> Members

		public bool Run(IContainerSettings settings, AppSettingsSection appSettings, FileInfo inputFilePath, DirectoryInfo outputDirectoryPath, out FileInfo outPutFilePath, out string output)
        {
            var fileName = Path.GetFileNameWithoutExtension(inputFilePath.Name) + "." + settings.FileNameExtension;
            outPutFilePath = new FileInfo(Path.Combine(outputDirectoryPath.FullName, fileName));
            if (outPutFilePath.Exists)
            {
                outPutFilePath.Delete();
            }

			var fFMpegCommandArguments = string.Format("-i \"{0}\" {1} {2} \"{3}\"", inputFilePath.FullName, settings.Video.GetOptionsForFirstPass(), settings.Audio.GetOptions(), outPutFilePath.FullName);
            var flvTool2CommandArguments = string.Format("-U \"{0}\"", outPutFilePath.FullName);

            var workingDirectory = outputDirectoryPath.FullName;
            var fFMpegCommandPath = appSettings.Settings[VideoConversionConfiguration.Instance.FFMpegPathSettingName].Value;
            var flvTool2CommandPath = appSettings.Settings[VideoConversionConfiguration.Instance.FlvTool2PathSettingName].Value;
 
            var result = false;
            var encodeOutput = string.Empty;
            var metaDataOutput = string.Empty;

            var ffmpegHelper = new FfMpegCommandLineExecutor();
            result = ffmpegHelper.Execute(workingDirectory, fFMpegCommandPath, fFMpegCommandArguments, out encodeOutput);
            output = encodeOutput;

            if (result)
            {
                var commandLineExecutor = new CommandLineExecutor();
                result = commandLineExecutor.Execute(workingDirectory, flvTool2CommandPath, flvTool2CommandArguments, out metaDataOutput);
                output += Environment.NewLine + metaDataOutput;
            }

            return result;
        }

        #endregion
    }
}
<commit_msg>Include watermark for flv containers<commit_after>﻿using System;
using System.Configuration;
using System.IO;
using Talifun.Commander.Command.Video.AudioFormats;
using Talifun.Commander.Command.Video.Configuration;
using Talifun.Commander.Command.Video.Containers;
using Talifun.Commander.Command.Video.VideoFormats;
using Talifun.Commander.Executor.CommandLine;
using Talifun.Commander.Executor.FFMpeg;

namespace Talifun.Commander.Command.Video
{
	public class FlvCommand : ICommand<IContainerSettings>
    {
        #region ICommand<FLVCommand,FLVSettings> Members

		public bool Run(IContainerSettings settings, AppSettingsSection appSettings, FileInfo inputFilePath, DirectoryInfo outputDirectoryPath, out FileInfo outPutFilePath, out string output)
        {
            var fileName = Path.GetFileNameWithoutExtension(inputFilePath.Name) + "." + settings.FileNameExtension;
            outPutFilePath = new FileInfo(Path.Combine(outputDirectoryPath.FullName, fileName));
            if (outPutFilePath.Exists)
            {
                outPutFilePath.Delete();
            }

			var fFMpegCommandArguments = string.Format("-i \"{0}\" {1} {2} {3} \"{4}\"", inputFilePath.FullName, settings.Video.GetOptionsForFirstPass(), settings.Audio.GetOptions(), settings.Watermark.GetOptions(), outPutFilePath.FullName);
            var flvTool2CommandArguments = string.Format("-U \"{0}\"", outPutFilePath.FullName);

            var workingDirectory = outputDirectoryPath.FullName;
            var fFMpegCommandPath = appSettings.Settings[VideoConversionConfiguration.Instance.FFMpegPathSettingName].Value;
            var flvTool2CommandPath = appSettings.Settings[VideoConversionConfiguration.Instance.FlvTool2PathSettingName].Value;
 
            var result = false;
            var encodeOutput = string.Empty;
            var metaDataOutput = string.Empty;

            var ffmpegHelper = new FfMpegCommandLineExecutor();
            result = ffmpegHelper.Execute(workingDirectory, fFMpegCommandPath, fFMpegCommandArguments, out encodeOutput);
            output = encodeOutput;

            if (result)
            {
                var commandLineExecutor = new CommandLineExecutor();
                result = commandLineExecutor.Execute(workingDirectory, flvTool2CommandPath, flvTool2CommandArguments, out metaDataOutput);
                output += Environment.NewLine + metaDataOutput;
            }

            return result;
        }

        #endregion
    }
}

{'fraction_non_alphanumeric': 0.08646770237121831, 'fraction_numerical': 0.004292722812755519, 'mean_word_length': 3.3110132158590306, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7311178', 'n_tokens_mistral': 1284, 'n_tokens_neox': 1262, 'n_words': 242}