Skip to content

Commit ad0f974

Browse files
committed
fix: 导出 maidata 时没有 pv
1 parent 7e79d8f commit ad0f974

File tree

2 files changed

+5
-9
lines changed

2 files changed

+5
-9
lines changed

MaiChartManager/Controllers/Music/MusicTransferController.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -366,7 +366,7 @@ public async Task ExportAsMaidata(int id, string assetDir, bool ignoreVideo = fa
366366
logger.LogInformation("Temp dir: {tmpDir}", tmpDir.FullName);
367367
var movieUsm = Path.Combine(tmpDir.FullName, "movie.usm");
368368
FileSystem.CopyFile(movieUsmPath, movieUsm, UIOption.OnlyErrorDialogs);
369-
WannaCRI.WannaCRI.UnpackUsm(movieUsm);
369+
WannaCRI.WannaCRI.UnpackUsm(movieUsm, Path.Combine(tmpDir.FullName, "output"));
370370
var outputIvfFile = Directory.EnumerateFiles(Path.Combine(tmpDir.FullName, @"output\movie.usm\videos")).FirstOrDefault();
371371
if (outputIvfFile is not null)
372372
{

MaiChartManager/WannaCRI/WannaCRI.cs

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ static WannaCRI()
1111
PythonEngine.PythonPath = $"{Path.Combine(StaticSettings.exeDir, "WannaCRI")};{Path.Combine(StaticSettings.exeDir, "Python")}";
1212
}
1313

14-
private static void RunWannaCRIWithArgs(string[] args, string workDir)
14+
private static void RunWannaCRIWithArgs(params string[] args)
1515
{
1616
PythonEngine.Initialize();
1717
using (Py.GIL())
@@ -45,10 +45,6 @@ def _Popen_no_window(*args, **kwargs):
4545
argv.Append(new PyString(arg));
4646
}
4747

48-
argv.Append(new PyString("--ffprobe"));
49-
argv.Append(new PyString(Path.Combine(StaticSettings.exeDir, "ffprobe.exe")));
50-
argv.Append(new PyString("--output"));
51-
argv.Append(new PyString(workDir));
5248
sys.SetAttr("argv", argv);
5349

5450
var wannacri = scope.Import("wannacri");
@@ -63,11 +59,11 @@ def _Popen_no_window(*args, **kwargs):
6359

6460
public static void CreateUsm(string src, string key = defaultKey)
6561
{
66-
RunWannaCRIWithArgs(["createusm", src, "--key", key], Path.GetDirectoryName(src));
62+
RunWannaCRIWithArgs("createusm", src, "--key", key, "--ffprobe", Path.Combine(StaticSettings.exeDir, "ffprobe.exe"), "--output", Path.GetDirectoryName(src));
6763
}
6864

69-
public static void UnpackUsm(string src, string key = defaultKey)
65+
public static void UnpackUsm(string src, string output, string key = defaultKey)
7066
{
71-
RunWannaCRIWithArgs(["extractusm", src, "--key", key], Path.GetDirectoryName(src));
67+
RunWannaCRIWithArgs("extractusm", src, "--key", key, "--output", output);
7268
}
7369
}

0 commit comments

Comments
 (0)