Merged
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces a target_video_length parameter to allow more granular control over generated clip lengths. Changes include adding a CLI argument, updating the S2VInputInfo and RS2VInputInfo structures, and modifying the wan_audio_runner to prioritize this value during audio segmentation. Feedback was provided to refactor the logic for retrieving the video length from input info to make it more concise and Pythonic.
Comment on lines
+320
to
+325
| target_video_length = self.config.get("target_video_length", 81) | ||
| ii = getattr(self, "input_info", None) | ||
| if ii is not None and hasattr(ii, "target_video_length"): | ||
| tvl = ii.target_video_length | ||
| if tvl is not None and tvl is not UNSET and tvl > 0: | ||
| target_video_length = tvl |
Contributor
There was a problem hiding this comment.
为了提高代码的简洁性和可读性,可以对这部分逻辑进行重构。目前的嵌套 if 语句有些冗长,可以将其简化为更紧凑、更符合 Python 风格的形式。
Suggested change
| target_video_length = self.config.get("target_video_length", 81) | |
| ii = getattr(self, "input_info", None) | |
| if ii is not None and hasattr(ii, "target_video_length"): | |
| tvl = ii.target_video_length | |
| if tvl is not None and tvl is not UNSET and tvl > 0: | |
| target_video_length = tvl | |
| target_video_length = self.config.get("target_video_length", 81) | |
| ii = getattr(self, "input_info", None) | |
| if ii is not None: | |
| tvl = getattr(ii, "target_video_length", None) | |
| if tvl not in (None, UNSET) and tvl > 0: | |
| target_video_length = tvl |
helloyongyang
approved these changes
Apr 2, 2026
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.
No description provided.