Merge pull request #1581 from scagood/patch-1

Remove progress bar in non interactive mode (#1481)
This commit is contained in:
rmcrackan
2026-01-31 23:29:04 -05:00
committed by GitHub
3 changed files with 9 additions and 7 deletions

View File

@@ -40,7 +40,7 @@
<TextBlock
Grid.Column="0"
Text="If you'd like to report this error to an advinistrator:&#xa;&#xa;Step 1: Go to Libation's &quot;issues&quot; page on github&#xa;Step 2: Find your log files&#xa;Setp 3: Click &quot;New issue&quot; button&#xa;Step 4: Drag/drop your log files" />
Text="If you'd like to report this error to an administrator:&#xa;&#xa;Step 1: Go to Libation's &quot;issues&quot; page on github&#xa;Step 2: Find your log files&#xa;Setp 3: Click &quot;New issue&quot; button&#xa;Step 4: Drag/drop your log files" />
<StackPanel
Margin="50,0,0,0"

View File

@@ -20,10 +20,16 @@ namespace LibationCli
protected static TProcessable CreateProcessable<TProcessable>(EventHandler<LibraryBook>? completedAction = null)
where TProcessable : Processable, IProcessable<TProcessable>
{
var progressBar = new ConsoleProgressBar(Console.Out);
var strProc = TProcessable.Create(Configuration.Instance);
LibraryBook? currentLibraryBook = null;
if (Environment.UserInteractive && !Console.IsOutputRedirected && !Console.IsErrorRedirected) {
var progressBar = new ConsoleProgressBar(Console.Out);
strProc.Completed += (_, e) => progressBar.Clear();
strProc.StreamingTimeRemaining += (_, e) => progressBar.RemainingTime = e;
strProc.StreamingProgressChanged += (_, e) => progressBar.Progress = e.ProgressPercentage;
}
strProc.Begin += (o, e) =>
{
currentLibraryBook = e;
@@ -32,7 +38,6 @@ namespace LibationCli
strProc.Completed += (o, e) =>
{
progressBar.Clear();
Console.WriteLine($"{typeof(TProcessable).Name} Completed: {e}");
};
@@ -49,9 +54,6 @@ namespace LibationCli
}
};
strProc.StreamingTimeRemaining += (_, e) => progressBar.RemainingTime = e;
strProc.StreamingProgressChanged += (_, e) => progressBar.Progress = e.ProgressPercentage;
if (strProc is AudioDecodable audDec)
{
audDec.RequestCoverArt += (_,_) =>

View File

@@ -59,7 +59,7 @@
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="label1.Text" xml:space="preserve">
<value>If you'd like to report this error to an advinistrator:
<value>If you'd like to report this error to an administrator:
Step 1: Go to Libation's "issues" page on github
Step 2: Find your log files