Ejemplo n.º 1
0
        private async void ProcessStdout(string message)
        {
            if (message == null)
            {
                return;
            }

            log.LogInformation($"videoId={VideoId}: {message}");

            Match match;

            if (DestinationRegex.TryMatch(message, out match) ||
                MergingRegex.TryMatch(message, out match) ||
                AlreadyDownloadedRegex.TryMatch(message, out match))
            {
                await UpdateOutputPath(Path.ChangeExtension(match.Groups[1].Value, null));
            }
            else if (ProgressRegex.TryMatch(message, out match))
            {
                if (float.TryParse(match.Groups[1].Value, out float percent))
                {
                    videoDownloader.OnVideoDownloading(VideoId, percent / 100f);
                }

                if (!limitsChecked && double.TryParse(match.Groups[2].Value, out double size))
                {
                    ProcessFileSize(size, match.Groups[3].Value);
                }
            }
        }