Skip to content
This repository was archived by the owner on Feb 9, 2019. It is now read-only.

Commit 87bfb18

Browse files
author
LittlePox
committed
大幅改进对复杂文件夹名称的支持
修正了一个偶然的因为x265参数较短而substring报错的bug
1 parent 24b6f7c commit 87bfb18

File tree

5 files changed

+10
-11
lines changed

5 files changed

+10
-11
lines changed

OKEGui/OKEGui/Gui/WizardWindow.xaml.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -694,7 +694,7 @@ private bool LoadJsonProfile(string profile)
694694
wizardInfo.ProjectPreview = "项目名字: " + wizardInfo.TaskNamePrefix;
695695
wizardInfo.ProjectPreview += "\n\n编码器类型: " + wizardInfo.EncoderType;
696696
wizardInfo.ProjectPreview += "\n编码器路径: \n" + wizardInfo.EncoderPath;
697-
wizardInfo.ProjectPreview += "\n编码参数: \n" + wizardInfo.EncoderParam.Substring(0,30) + "......";
697+
wizardInfo.ProjectPreview += "\n编码参数: \n" + wizardInfo.EncoderParam.Substring(0, Math.Min(30, wizardInfo.EncoderParam.Length-1)) + "......";
698698
wizardInfo.ProjectPreview += "\n\n封装格式: " + wizardInfo.ContainerFormat;
699699
wizardInfo.ProjectPreview += "\n视频编码: " + wizardInfo.VideoFormat;
700700
wizardInfo.ProjectPreview += "\n视频帧率: " + String.Format("{0:0.000} fps", wizardInfo.Fps);

OKEGui/OKEGui/JobProcessor/Audio/FLACDecoder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public FLACDecoder(string FlacPath, AudioJob j) : base()
3232
}
3333

3434
if (Path.GetExtension(j.Input) == ".flac") {
35-
commandLine += j.Input;
35+
commandLine += $"\"{j.Input}\"";
3636
}
3737

3838
executable = FlacPath;

OKEGui/OKEGui/JobProcessor/Audio/QAACEncoder.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,12 +26,12 @@ public static IJobProcessor NewQAACEncoder(string QAACPath, Job j)
2626
// TODO: 变更编码参数
2727
public QAACEncoder(string QAACPath, AudioJob j, int bitrate = Constants.QAACBitrate) : base()
2828
{
29-
if (j.Input == "-") {
30-
// stdin
29+
if (j.Input != "-") { //not from stdin, but an actual file
30+
j.Input = $"\"{j.Input}\"";
3131
}
3232

3333
executable = QAACPath;
34-
commandLine = "-i -v " + bitrate + " -q 2 --no-delay -o " + j.Output + " " + j.Input;
34+
commandLine = $"-i -v {bitrate} -q 2 --no-delay -o \"{j.Output}\" {j.Input}";
3535
}
3636

3737
public override void ProcessLine(string line, StreamType stream)

OKEGui/OKEGui/JobProcessor/Muxer/AutoMuxer.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -161,16 +161,16 @@ private string GenerateMp4MergeParameter(Episode episode)
161161

162162
if (episode.ChapterFile != null) parameters.Add($"--chapter \"{episode.ChapterFile}\"");
163163

164-
parameters.Add($"-i {episode.VideoFile}?fps={episode.VideoFps}");
164+
parameters.Add($"-i \"{episode.VideoFile}\"?fps={episode.VideoFps}");
165165

166166
foreach (var audioFile in episode.AudioFiles) {
167167
FileInfo ainfo = new FileInfo(audioFile);
168168
if (ainfo.Extension.ToLower() == ".aac" || ainfo.Extension.ToLower() == ".m4a" || ainfo.Extension.ToLower() == ".ac3") {
169-
parameters.Add($"-i {audioFile}?language={episode.AudioLanguage}");
169+
parameters.Add($"-i \"{audioFile}\"?language={episode.AudioLanguage}");
170170
}
171171
}
172172

173-
parameters.Add($"-o {episode.OutputFile}");
173+
parameters.Add($"-o \"{episode.OutputFile}\"");
174174

175175
return string.Join(" ", parameters);
176176
}

OKEGui/OKEGui/Worker/WorkerManager.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ public bool StartWorker(string name)
100100
args.bgWorker = worker;
101101

102102
worker.RunWorkerAsync(args);
103-
104103
return true;
105104
}
106105

@@ -119,7 +118,7 @@ public string AddTempWorker()
119118

120119
lock (o) {
121120
workerList.Add(name);
122-
Debug.Assert(workerType.TryAdd(name, WorkerType.Temporary));
121+
workerType.TryAdd(name, WorkerType.Temporary);
123122
}
124123

125124
if (isRunning) {
@@ -138,7 +137,7 @@ public bool AddWorker(string name)
138137
}
139138

140139
workerList.Add(name);
141-
Debug.Assert(workerType.TryAdd(name, WorkerType.Normal));
140+
workerType.TryAdd(name, WorkerType.Normal);
142141
}
143142

144143
if (isRunning) {

0 commit comments

Comments
 (0)