Skip to content

Commit

Permalink
some adjustments to the progress
Browse files Browse the repository at this point in the history
  • Loading branch information
Venipa committed Jul 5, 2019
1 parent 8d6fadf commit 29b27a8
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions CoubDownload-Bridge/Commands/DownloadCommand.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ public string Execute(DownloadArgs args)
}));
return "async processing...";
}
var overallProgress = new ProgressBar(PbStyle.SingleLine, args.audio != true ? 3 : 2, 20, '█');
overallProgress.Refresh(0, "Overall Progress");
if (args.download.Length == 0)
{
return "Invalid ID";
Expand Down Expand Up @@ -79,9 +81,7 @@ public string Execute(DownloadArgs args)
var resultOutput = Path.Combine(outputPath, $"{CoubId}.mp4");
var resultOutputAudio = Path.Combine(outputPath, $"{CoubId}.mp3");

Console.WriteLine();

var withPercentage = new ProgressBar(PbStyle.SingleLine, 100, 16, '█');
var withPercentage = new ProgressBar(PbStyle.SingleLine, 100, 20, '█');
var currentType = CoubDownloadType.Video;
wc.DownloadProgressChanged += (s, e) =>
{
Expand All @@ -104,11 +104,15 @@ public string Execute(DownloadArgs args)
dlVideo[0] = dlVideo[1] = 0;
}
File.WriteAllBytes(videoInput, dlVideo);

overallProgress.Next("Overall Progress");
}
//wc.DownloadFile(video, Path.Combine(tempPath, videoInput));
currentType = CoubDownloadType.Audio;
withPercentage = new ProgressBar(PbStyle.SingleLine, 100, 20, '█');
wc.DownloadFileTaskAsync(audio, Path.Combine(tempPath, audioInput)).Wait();
wc.Dispose();
overallProgress.Next("Overall Progress");
var ffmpeg = new Engine(this.ffmpegPath);
if (args.audio == true)
{
Expand All @@ -124,7 +128,7 @@ public string Execute(DownloadArgs args)
}
return resultOutputAudio;
}
withPercentage = new ProgressBar(PbStyle.SingleLine, 100, 16, '█');
withPercentage = new ProgressBar(PbStyle.SingleLine, 100, 20, '█');
withPercentage.Refresh(0, "Converting");
ffmpeg.Progress += (s, e) =>
{
Expand Down Expand Up @@ -156,10 +160,15 @@ public string Execute(DownloadArgs args)
File.Delete(videoInput);
File.Delete(audioInput);
} catch { }
if(App.Config.copyFileToClipboard)
overallProgress.Next("Overall Progress");
if (App.Config.copyFileToClipboard)
{
System.Windows.Forms.Clipboard.SetText(resultOutput);
}
if (!App.Config.silentWebProcessing)
{
Task.Delay(1500).Wait();
}
return resultOutput;
}
}
Expand Down

0 comments on commit 29b27a8

Please sign in to comment.