From 54a7b2e4a255d7699e57d7976845970d47ce8163 Mon Sep 17 00:00:00 2001 From: WyattBlue Date: Fri, 15 Jan 2021 17:33:31 -0500 Subject: [PATCH] added better error messages --- auto_editor/cutting.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/auto_editor/cutting.py b/auto_editor/cutting.py index f6a423fe9..d33d4c7eb 100644 --- a/auto_editor/cutting.py +++ b/auto_editor/cutting.py @@ -197,11 +197,16 @@ def removeSmall(hasLoud: np.ndarray, lim: int, replace: bool, with_: bool) -> np return hasLoud -def setRange(includeFrame: np.ndarray, syntaxRange, fps: float, with_: bool) -> np.ndarray: +def setRange(includeFrame: np.ndarray, syntaxRange, fps: float, with_: bool, log) -> np.ndarray: end = len(includeFrame) - 1 for item in syntaxRange: pair = [] + if(item.count('-') > 1): + log.error('Too many deliminators!') + if(item.count('-') < 1): + log.error('Invalid range. Use range syntax. ex: 5-10') + for num in item.split('-'): if(num == 'start'): pair.append(0) @@ -256,11 +261,11 @@ def cook(hasLoud: np.ndarray, minClip: int, minCut: int) -> np.ndarray: # Apply ignore rules if applicable. if(ignore != []): - includeFrame = setRange(includeFrame, ignore, fps, True) + includeFrame = setRange(includeFrame, ignore, fps, True, log) # Cut out ranges. if(cutOut != []): - includeFrame = setRange(includeFrame, cutOut, fps, False) + includeFrame = setRange(includeFrame, cutOut, fps, False, log) # Remove small clips/cuts created by applying other rules. includeFrame = cook(includeFrame, minClip, minCut)