-
Notifications
You must be signed in to change notification settings - Fork 0
/
checkDuplicate.py
56 lines (48 loc) · 1.89 KB
/
checkDuplicate.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import os
import json
# Read metadata for generating NFTs
with open('metadata.json') as metadata_file:
metadata = json.load(metadata_file)
for i in range(len(metadata) - 1):
for j in range(i + 1, len(metadata)):
iattributes = metadata[i]["attributes"]
jattributes = metadata[j]["attributes"]
ipngs = iattributes["png"]
jpngs = jattributes["png"]
isDiff = False
if len(ipngs) == len(jpngs):
for k in range(len(ipngs)):
if ipngs[k]["trait_type"] != jpngs[k]["trait_type"] or ipngs[k]["value"] != jpngs[k]["value"]:
isDiff = True
break
else:
isDiff = True
iwavs = iattributes["wav"]
jwavs = jattributes["wav"]
if isDiff == False and len(iwavs) == len(jwavs):
for k in range(len(iwavs)):
if iwavs[k]["trait_type"] != jwavs[k]["trait_type"] or iwavs[k]["value"] != jwavs[k]["value"]:
isDiff = True
break
else:
isDiff = True
imp4s = iattributes["mp4"]
jmp4s = jattributes["mp4"]
if isDiff == False and len(imp4s) == len(jmp4s):
for k in range(len(imp4s)):
if imp4s[k]["trait_type"] != jmp4s[k]["trait_type"] or imp4s[k]["value"] != jmp4s[k]["value"]:
isDiff = True
break
else:
isDiff = True
imovs = iattributes["mov"]
jmovs = jattributes["mov"]
if isDiff == False and len(imovs) == len(jmovs):
for k in range(len(imovs)):
if imovs[k]["trait_type"] != jmovs[k]["trait_type"] or imovs[k]["value"] != jmovs[k]["value"]:
isDiff = True
break
else:
isDiff = True
if isDiff == False:
print("Same NFTs exist: ", i, " ", j)