예제 #1
0
        public async Task <bool> PutTracksFirst(CancellationToken ct = default)
        {
            if (!TracksAreLoaded())
            {
                return(false);
            }

            string argLine;

            try
            {
                argLine = BuildMkvMergeArgumentLine();
                logger.Trace($"Argument line for mkvmerge for file {handle.FileInfo.FullName}: {argLine}");
            }
            catch (Exception e)
            {
                logger.Fatal(e);
                return(false);
            }

            using var mkvMergeRunner = new ProcessRunner("mkvmerge");
            var successful = await mkvMergeRunner.RunWithArg(argLine, ct);

            if (successful)
            {
                if (settings.OverwriteFile)
                {
                    await MoveFile();
                }
            }
            else
            {
                logger.Fatal($"mkvmerge exited with non zero code: {mkvMergeRunner.Error}");
            }

            return(successful);
        }