The metadata dict was continuously getting filled with bytes from f.read() because of this code:

result = metadata[path]
result["audio"] = {"path": path, "bytes": f.read()}

copying the result with result = dict(metadata[path]) fixes it: the bytes are no longer added to metadata

Merged with other changes in a direct commit

anton-l changed pull request status to closed