-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathInterface.py
More file actions
48 lines (45 loc) · 2.21 KB
/
Copy pathInterface.py
File metadata and controls
48 lines (45 loc) · 2.21 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
40
41
42
43
44
45
46
47
48
#a class containing all the convenience interface related functions for autoruning and utilizing different objects
import json
from ffxiv_info_grabber import ffxiv_grabber
from multipledispatch import dispatch
class interface:
#if rerun is true it will run the scraper portion of the code with logging disabled and rerunning enabled
#defaults to false(rerun should be true in server implementations)
# 1 = minimal, only pulls and updates the api and item DB
# 2 = standard, scrapes for crafters and updates/pulls the api (no gatherers) as well as the item DB
# 3 = Extra, scrapes for crafters, gatherers, and the api
#@dispatch(scraper=ffxiv_grabber, rerun=bool, typeofrun=int)
def autorun_grabber(self, scraper, rerun, typeofrun=1):
#with automatic redo
match typeofrun:
#if option 2 is chosen:
case 2:
if rerun:
scraper.ffxivCraftScraper("db-table__txt--detail_link")
else:
scraper.ffxivCraftScraper("db-table__txt--detail_link",False)
#if option 3 is chosen:
case 3:
if rerun:
scraper.ffxivGatherScraper("db-table__txt--detail_link")
scraper.ffxivCraftScraper("db-table__txt--detail_link")
else:
scraper.ffxivGatherScraper("db-table__txt--detail_link",False)
scraper.ffxivCraftScraper("db-table__txt--detail_link",False)
scraper.updateIDDB()
Dictionary={}
with open('Ffxivcrafting.json') as json_file:
data = json.load(json_file)
#grabs all the items needed to translate
for vars in data:
Dictionary.update((data[vars]).get("Ingredients"))
listofitemid=scraper.itemSorter(Dictionary)
#dump file for troubleshooting by user
with open("dump.json", "w+") as outfile:
json.dump(listofitemid, outfile, indent = 6)
if rerun:
scraper.garlandResourceObtain(listofitemid, True)
else:
scraper.garlandResourceObtain(listofitemid, True)
def autorun_gilmaking(rerun=False):
return()