27 lines
601 B
Python
27 lines
601 B
Python
import json
|
|
|
|
files = ['es-songs.json', 'es-artists.json', 'es-albums.json']
|
|
|
|
ids = []
|
|
bad_lines = {}
|
|
|
|
for file in files:
|
|
with open(file) as fp:
|
|
line = fp.readline()
|
|
|
|
while line:
|
|
content = json.loads(line)
|
|
if 'index' in content:
|
|
id = content['index']['_id']
|
|
if id in ids:
|
|
bad_lines[id] = content
|
|
else:
|
|
ids.append(id)
|
|
line = fp.readline()
|
|
|
|
if not bad_lines:
|
|
print("No duplicate ID's found, everything's fine!!")
|
|
else:
|
|
print('KO')
|
|
print(bad_lines)
|