diff --git a/CGGItemSets.py b/CGGItemSets.py index 7f8e27f..be88cff 100644 --- a/CGGItemSets.py +++ b/CGGItemSets.py @@ -17,6 +17,8 @@ ITEMS_TYPE = { 'Most Frequent Core Build': ['items', 'mostGames'], 'Highest Win % Core Build': ['items', 'highestWinPercent'], } +CONSUMABLES = [2003, 2004, 2055, 2031, 2032, 2033, 2138, 2140, 2139] +TRINKETS = [3340, 3364, 3363] def getChampData(champ, position): page = requests.get('https://champion.gg/champion/%s/%s?league=' % (champ, position), headers=HEADERS).text @@ -65,11 +67,11 @@ def writeItemSet(id, pos, ver, dir): if path[1] in data[path[0]]: item_set['blocks'].append(makeItemSet(data[path[0]][path[1]], label)) - item_set['blocks'].append(makeItemSetFromList([2003, 2004, 2055, 2031, 2032, 2033, 2138, 2140, 2139], "Consumables | Frequent: %s", 'mostGames', data)) - item_set['blocks'].append(makeItemSetFromList([3340, 3364, 3363], "Trinkets | Wins: %s", 'highestWinPercent', data)) + item_set['blocks'].append(makeItemSetFromList(CONSUMABLES, "Consumables | Frequent: %s", 'mostGames', data)) + item_set['blocks'].append(makeItemSetFromList(TRINKETS, "Trinkets | Wins: %s", 'highestWinPercent', data)) logging.info('Writing item set for %s at %s' % (id, pos)) - with open('%sCGG_%s_%s.json' % (dir, id, pos), 'w', newline='\n') as out: + with open(dir.joinpath('CGG_%s_%s.json' % (id, pos)), 'w', newline='\n') as out: json.dump(item_set, out, indent=4) def main(): @@ -93,8 +95,8 @@ def main(): for name, positions in champ.items(): c = next((x for x in lol_champs if x['name'] == name), None) if c is not None: - path = '%s%s\\Recommended\\' % (LOL_CHAMPS_DIR, c['id']) - Path(path).mkdir(parents=True, exist_ok=True) + path = Path(LOL_CHAMPS_DIR, c['id'], 'Recommended') + path.mkdir(parents=True, exist_ok=True) for pos in positions: writeItemSet(c['id'], pos, patch, path) sleep(.3)