Skip to content

Commit 2bc2be1

Browse files
committed
fix
1 parent 997bf32 commit 2bc2be1

File tree

6 files changed

+42
-42
lines changed

6 files changed

+42
-42
lines changed

MaiChartManager.CLI/Commands/MakeAcbCommand.cs

Lines changed: 33 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ public override async Task<int> ExecuteAsync(CommandContext context, Settings se
5353
if (settings.Sources.Length == 1)
5454
{
5555
var source = settings.Sources[0];
56-
var output = settings.Output ?? Path.ChangeExtension(source, "");
56+
var output = settings.Output ?? Path.ChangeExtension(source, null);
5757
await ConvertSingleFile(source, output, settings);
5858
}
5959
else
@@ -96,39 +96,39 @@ private async Task ConvertMultipleFiles(Settings settings)
9696
{
9797
AnsiConsole.MarkupLine($"[yellow]正在转换 {settings.Sources.Length} 个文件...[/]");
9898

99-
var table = new Table();
100-
table.AddColumn("文件");
101-
table.AddColumn("状态");
102-
103-
foreach (var source in settings.Sources)
104-
{
105-
var output = Path.ChangeExtension(source, "");
106-
107-
try
99+
await AnsiConsole.Progress()
100+
.AutoClear(false)
101+
.Columns(
102+
new TaskDescriptionColumn(),
103+
new SpinnerColumn())
104+
.StartAsync(async ctx =>
108105
{
109-
await Task.Run(() =>
106+
foreach (var source in settings.Sources)
110107
{
111-
Audio.ConvertToMai(
112-
srcPath: source,
113-
savePath: output,
114-
padding: settings.Padding
115-
);
116-
});
117-
118-
table.AddRow(
119-
Path.GetFileName(source),
120-
$"[green]✓ → {Path.GetFileName(output)}.acb[/]"
121-
);
122-
}
123-
catch (Exception ex)
124-
{
125-
table.AddRow(
126-
Path.GetFileName(source),
127-
$"[red]✗ {ex.Message}[/]"
128-
);
129-
}
130-
}
131-
132-
AnsiConsole.Write(table);
108+
var output = Path.ChangeExtension(source, null);
109+
var task = ctx.AddTask($"[green]{Path.GetFileName(source)}[/]");
110+
task.MaxValue = 100;
111+
112+
try
113+
{
114+
task.StartTask();
115+
await Task.Run(() =>
116+
{
117+
Audio.ConvertToMai(
118+
srcPath: source,
119+
savePath: output,
120+
padding: settings.Padding
121+
);
122+
});
123+
124+
task.StopTask();
125+
}
126+
catch (Exception ex)
127+
{
128+
task.Description = $"[red]{Path.GetFileName(source)} - 失败[/]";
129+
task.StopTask();
130+
}
131+
}
132+
});
133133
}
134134
}

MaiChartManager.CLI/Commands/MakeUsmCommand.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,8 @@ await VideoConvert.ConvertVideoToUsm(
150150
}
151151
catch (Exception ex)
152152
{
153+
task.Description = $"[red]{Path.GetFileName(source)} - 失败[/]";
154+
task.Value = 100;
153155
task.StopTask();
154156
AnsiConsole.MarkupLine($"[red]✗ 转换失败 {Path.GetFileName(source)}: {ex.Message}[/]");
155157
}

MaiChartManager.CLI/MaiChartManager.CLI.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222

2323
<ItemGroup>
2424
<PackageReference Include="Spectre.Console.Cli" Version="0.53.0"/>
25+
<PackageReference Include="Unknown6656.Terminal" Version="1.5.434.8968"/>
2526
</ItemGroup>
2627

2728
</Project>

MaiChartManager.CLI/Program.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
1+
using System.Text;
12
using MaiChartManager.CLI.Commands;
23
using Spectre.Console.Cli;
34

5+
Console.OutputEncoding = Encoding.UTF8;
6+
47
var app = new CommandApp();
58

69
app.Configure(config =>

MaiChartManager/Utils/VideoConvert.cs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,6 @@ await FFmpeg.Conversions.New()
3939
}
4040
catch (Exception e)
4141
{
42-
Console.WriteLine(e);
4342
HardwareAcceleration = HardwareAccelerationStatus.Disabled;
4443
}
4544

@@ -60,10 +59,7 @@ await FFmpeg.Conversions.New()
6059
H264Encoder = encoder;
6160
break;
6261
}
63-
catch (Exception e)
64-
{
65-
Console.WriteLine(e);
66-
}
62+
catch (Exception e) { }
6763
}
6864

6965
Console.WriteLine($"H264 encoder: {H264Encoder}");
@@ -263,8 +259,6 @@ private static async Task ConvertToVp9OrH264(VideoConvertOptions options, string
263259
};
264260
}
265261

266-
Console.WriteLine("Conversion command: " + conversion.Build());
267-
268262
await conversion.Start();
269263
}
270264

MaiChartManager/WannaCRI/wannacri/wannacri.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,7 @@ def create_usm():
7777
for packet in usm.stream(mode, encoding=args.encoding):
7878
f.write(packet)
7979

80-
print("Done creating USM file.")
80+
# print("Done creating USM file.")
8181

8282

8383
def extract_usm():
@@ -365,7 +365,7 @@ def main():
365365
help="Specify operation",
366366
)
367367
args, _ = parser.parse_known_args()
368-
print(f"WannaCRI {wannacri.__version__}")
368+
# print(f"WannaCRI {wannacri.__version__}")
369369

370370
OP_DICT[args.operation]()
371371

0 commit comments

Comments
 (0)