From 797882336ba1956c544cdf6ebb9a27960610245f Mon Sep 17 00:00:00 2001 From: mrq Date: Thu, 9 Mar 2023 04:06:07 +0000 Subject: [PATCH] maybe remedy an issue that crops up if you have a non-wav and non-json file in a results folder (assuming) --- src/utils.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/utils.py b/src/utils.py index 88118a5..c809e53 100755 --- a/src/utils.py +++ b/src/utils.py @@ -220,9 +220,9 @@ def generate(**kwargs): if extension != ".json" and extension != ".wav": continue match = re.findall(rf"^{voice}_(\d+)(?:.+?)?{extension}$", filename) - - key = int(match[0]) - idx_cache[key] = True + if match and len(match) > 0: + key = int(match[0]) + idx_cache[key] = True if len(idx_cache) > 0: keys = sorted(list(idx_cache.keys()))