Skip to content

Commit

Permalink
Merge pull request #436 from kahst/segments-fix
Browse files Browse the repository at this point in the history
segments work again when result files are in different folders.
  • Loading branch information
max-mauermann committed Sep 3, 2024
2 parents 1f393d3 + be11b81 commit 42c910a
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions segments.py
Original file line number Diff line number Diff line change
Expand Up @@ -89,13 +89,14 @@ def parseFolders(apath: str, rpath: str, allowed_result_filetypes: list[str] = [
for root, _, files in os.walk(apath):
for f in files:
if f.rsplit(".", 1)[-1].lower() in cfg.ALLOWED_FILETYPES:
data[os.path.join(root, f.rsplit(".", 1)[0])] = {"audio": os.path.join(root, f), "result": ""}
table_key = os.path.join(root.strip(apath), f.rsplit(".", 1)[0])
data[table_key] = {"audio": os.path.join(root, f), "result": ""}

# Get all result files
for root, _, files in os.walk(rpath):
for f in files:
if f.rsplit(".", 1)[-1] in allowed_result_filetypes and ".BirdNET." in f:
table_key = os.path.join(root, f.split(".BirdNET.", 1)[0])
table_key = os.path.join(root.strip(rpath), f.split(".BirdNET.", 1)[0])
if table_key in data:
data[table_key]["result"] = os.path.join(root, f)

Expand Down

0 comments on commit 42c910a

Please sign in to comment.