-
Notifications
You must be signed in to change notification settings - Fork 0
/
itemidfinder.py
47 lines (39 loc) · 1.7 KB
/
itemidfinder.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
#!/usr/bin/python3
import csv
input = ['resell', 'engineer', 'alchemy', 'recipes']
for group in input:
with open('source/items.csv', 'r') as items_file, open(str(group)+'.txt', 'r') as search_file:
items = csv.reader(items_file)
search_items = search_file.read().splitlines()
search_items_count = 0
items_found_count = 0
items_found = []
not_found = []
for search_item in search_items:
if not search_item or search_item.isspace() :
continue
search_items_count += 1
items_file.seek(0)
found = False
for num, item in enumerate(items, start=1):
if search_item.lower() == item[1].lower():
items_found.append([item[1],item[0], 'https://de.classic.wowhead.com/item='+item[0], 'https://www.bootybaygazette.com/#eu/lucifron-h/item/'+item[0]])
items_found_count += 1
found = True
break
if not found:
not_found.append(search_item)
with open('results_'+group+'.csv', 'w', newline='') as f:
writer = csv.writer(f, delimiter='\t')
writer.writerow(['Name', 'ID', 'Wowhead Classic', 'Booty Bay Gazette'])
for row in items_found:
writer.writerow(row)
print('TSM group: '+group)
for i in items_found:
print('i:'+i[1]+',', sep='', end='', flush=True)
print('\n')
print("Valid search items: " + str(search_items_count))
print("Items found + added: " + str(items_found_count))
print('===========================================')
for i in not_found:
print(i)