forked from SmilingZero/BlazeBlack2ReduxWiki
-
Notifications
You must be signed in to change notification settings - Fork 0
/
makePokemonDocs.py
33 lines (27 loc) · 977 Bytes
/
makePokemonDocs.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
from genericpath import isfile
import os
import tqdm
import json
import csv
import re
import pokemonDocWriter as pkmnWriter
def getint(name):
basename = name.partition('.')
return int(basename[0])
docOutFolder = 'docs/pokemons/'
os.makedirs(docOutFolder, exist_ok=True)
pkmnDir = 'scrapedJSON/pokemon/'
listOfPokemonFiles = os.listdir(pkmnDir)
listOfPokemonFiles.sort(key=getint)
moveList = 'scrapedJSON/ref/moves_with_descriptions.json'
pokemonLinkTextFile = 'pokemonNavLinks.txt'
allLinkText = ''
for ind, jsonFile in enumerate(tqdm.tqdm(listOfPokemonFiles)):
with open(pkmnDir+jsonFile) as pkmnFile:
pkmnInformation = json.load(pkmnFile)
linkText, outfilename, markdownText = pkmnWriter.getPokemonMarkdown(pkmnInformation)
with open(docOutFolder+outfilename, mode='w') as outputMarkdown:
outputMarkdown.write(markdownText)
allLinkText+=linkText
with open(pokemonLinkTextFile, mode = 'w') as plFile:
plFile.write(allLinkText)