Merge pull request #2 from atravert/master

FIX multiple entries with same name: In some instances, multiple entries - in particular 'AB' seem to be present, only the the first one is valid.
Now the  supplementary entries are kept and added in the dict with a key ending by '(1)', '(2)', etc...
This commit is contained in:
Arnaud TRAVERT 2022-06-08 14:06:56 +02:00 committed by GitHub
commit e9eacfb108
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 7 additions and 0 deletions

View File

@ -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