Skip to content

Commit

Permalink
FIX parse_data
Browse files Browse the repository at this point in the history
In some instances, multiple entries - in particular 'AB' seem to be present, onlky the the first one is valid.
The supplementary instances are kept and added in the dict with a key ending by '_(1)', '_(2)', etc...
  • Loading branch information
atravert authored Jun 8, 2022
1 parent a23b7da commit 742f741
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions brukeropusreader/opus_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,5 +61,12 @@ def parse_data(data: bytes, blocks_meta: List[BlockMeta]) -> OpusData:
except UnknownBlockType:
continue
parsed_data = parser(data, block_meta)
# in some instances, multiple entries - in particular 'AB' seem to be present
# they are added with a key ending by '_(1)', '_(2)', etc...
if name in opus_data.keys():
i = 1
while name + '_(' + str(i) + ')' in opus_data.keys():
i += 1
name = name + '_(' + str(i) + ')'
opus_data[name] = parsed_data
return opus_data

0 comments on commit 742f741

Please sign in to comment.