BirdNET-Analyzer icon indicating copy to clipboard operation
BirdNET-Analyzer copied to clipboard

Segments.py can't match audio and result files

Open kahst opened this issue 5 months ago • 2 comments

In segments.py audio files and result files can't be matched if the audio dir and result dir are different (which we explicitly allow to do) and we don't use combined result files.

In line 92 we say the dictionary entry is:

data[os.path.join(root, f.rsplit(".", 1)[0])] = {"audio": os.path.join(root, f), "result": ""}

which contains the full audio file dir tree.

In line 98 the table_key is:

table_key = os.path.join(root, f.split(".BirdNET.", 1)[0])

which then contains the result file dir tree and thus cannot be matched with the keys in the data dict.

We could remove the full dir trees from the key and only use the filename without the extension as keys in data. However, we might have issues when people have duplicate filenames (which they shouldn't but often do).

What do you think?

kahst avatar Aug 31 '24 15:08 kahst