fix: Fix parser vocal named-argument asset resolution#946
Open
A-kirami wants to merge 2 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request refactors the argsParser to explicitly handle the vocal argument by applying an assetSetter and flattens the conditional logic for better readability. A corresponding test case was added to verify this behavior. Feedback was provided to perform a case-insensitive check for the vocal argument name to ensure consistency and improve robustness.
I am having trouble creating individual review comments. Click here to see my feedback.
packages/parser/src/scriptParser/argsParser.ts (38-43)
建议对 vocal 参数名进行不区分大小写的检查,并将结果的 key 统一设置为小写的 'vocal'。这样可以确保即使脚本中使用了不同大小写的参数名(如 -VOCAL=...),解析结果也能保持一致,并正确触发后续的语音逻辑。这也能与第33行简写形式的处理逻辑保持一致。
} else if (argName.toLowerCase() === 'vocal' && argValue !== undefined) {
returnArrayList.push({
key: 'vocal',
value: assetSetter(argValue, fileType.vocal),
});
}
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
背景
当前 parser 对语音参数有两种写法:
-a.mp3-vocal=a.mp3其中简写会经过
assetSetter,但标准写法此前会被当作普通字符串参数处理,导致没有补全资源路径,最终无法正确解析语音资源。变更
vocal命名参数新增独立解析分支-vocal=...与简写语法统一走assetSettersay:123 -speaker=xx -vocal=a.mp3;