Skip to content

Commit

Permalink
CustomList: Improve frame range error handling
Browse files Browse the repository at this point in the history
  • Loading branch information
LightArrowsEXE committed Dec 6, 2024
1 parent d6fe5ad commit 1112616
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion vswobbly/components/custom_lists.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,24 @@ def apply(self, clip: vs.VideoNode, **kwargs: Any) -> vs.VideoNode:
WobblyPresetFrames=_range
)

clip = replace_ranges(clip, range_flt, _range)
if isinstance(_range, tuple) and _range[1] >= clip.num_frames - 1:
_range = (_range[0], clip.num_frames - 2)

try:
clip = replace_ranges(clip, range_flt, _range)
except vs.Error as e:
if 'invalid last frame' in str(e):
clip = replace_ranges(clip, range_flt, (_range[0], clip.num_frames - 2))

raise CustomRuntimeError(
f'Error applying custom list \'{self.name}\' (range: {_range}): {e}',
self.apply
)
except Exception as e:
raise CustomRuntimeError(
f'Error applying custom list \'{self.name}\' (range: {_range}): {e}',
self.apply
)

return clip

Expand Down

0 comments on commit 1112616

Please sign in to comment.