Skip to content

Commit

Permalink
added better error messages
Browse files Browse the repository at this point in the history
  • Loading branch information
WyattBoothe committed Jan 15, 2021
1 parent a5df4b4 commit 54a7b2e
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions auto_editor/cutting.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down

0 comments on commit 54a7b2e

Please sign in to comment.