This repository was archived by the owner on Aug 20, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathverify.py
More file actions
39 lines (30 loc) · 1.27 KB
/
verify.py
File metadata and controls
39 lines (30 loc) · 1.27 KB
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
import json
import os
###
# This script will check if all icons contained in the
# correlation data exist in the name / uid folder.
###
# Folder containing named icons
namedFolder = 'name'
# Folder containing icons named after uid
uidFolder = 'uid'
# Output file for cleaned correlation data
correlationDataClean = 'correlationClean.json'
# Data used for matching
# Must contain uid and icon
correlationData = 'correlation.json'
with open(correlationData, encoding='utf-8') as json_file:
items = json.load(json_file)
for i in range(len(items)):
nameSrc = namedFolder + os.path.sep + items[i]['icon']
uidSrc = uidFolder + os.path.sep + items[i]['uid'] + '.png'
if not os.path.exists(nameSrc):
print(items[i]['uid'] + " - Could not find: " + nameSrc)
if not os.path.exists(uidSrc):
print(items[i]['uid'] + " - Could not find: " + uidSrc)
out = [
item for item in items
if ((os.path.exists(namedFolder + os.path.sep + item['icon'])) or (os.path.exists(uidFolder + os.path.sep +
item['uid'] + '.png')))
]
open(correlationDataClean, 'w').write(json.dumps(out, sort_keys=True, indent=4, separators=(',', ': ')))