forked from zoffline/zwift-offline
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'zoffline:master' into master
- Loading branch information
Showing
10 changed files
with
168 additions
and
83 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
<Zwift version="1.0.134595" sversion="1.72.2 (134595)" gbranch="rc/1.72.2" gcommit="451573555ef11709e60461ac84f368a122f14ddc" GAME_URL="https://us-or-rly101.zwift.com" manifest="ZwiftMac_1.0.134595_ce35793d_manifest.xml" manifest_checksum="-1057907904" ver_cur_checksum="-1100226285"/> | ||
<Zwift version="1.0.134871" sversion="1.73.0 (134871)" gbranch="rc/1.73.0" gcommit="b3dc433ed3deac8fc0fbd392ed7024a100d25665" GAME_URL="https://us-or-rly101.zwift.com" manifest="ZwiftMac_1.0.134871_5f0303f9_manifest.xml" manifest_checksum="373345836" ver_cur_checksum="2077541851"/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
<Zwift version="1.0.134595" sversion="1.72.2 (134595)" gbranch="rc/1.72.2" gcommit="451573555ef11709e60461ac84f368a122f14ddc" GAME_URL="https://us-or-rly101.zwift.com" manifest="Zwift_1.0.134595_ce35793d_manifest.xml" manifest_checksum="-1185758442" ver_cur_checksum="-390452429"/> | ||
<Zwift version="1.0.134871" sversion="1.73.0 (134871)" gbranch="rc/1.73.0" gcommit="b3dc433ed3deac8fc0fbd392ed7024a100d25665" GAME_URL="https://us-or-rly101.zwift.com" manifest="Zwift_1.0.134871_5f0303f9_manifest.xml" manifest_checksum="-1883941091" ver_cur_checksum="889064577"/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
#! /usr/bin/env python | ||
|
||
# pip install country-converter fuzzywuzzy | ||
# | ||
# use to find and print entries from http://cdn.zwift.com/gameassets/GameDictionary.xml | ||
# scripts/find_equip.py -p emonda -s sworks -o blue -j zwift -e kask | ||
|
||
import urllib.request | ||
import json | ||
import country_converter as coco | ||
import argparse | ||
import os | ||
import sys | ||
import xml.etree.ElementTree as ET | ||
from fuzzywuzzy import process | ||
from fuzzywuzzy import fuzz | ||
|
||
cc = coco.CountryConverter() | ||
|
||
gd_file = 'GameDictionary.xml' | ||
if not os.path.isfile(gd_file): | ||
open(gd_file, 'wb').write(urllib.request.urlopen('http://cdn.zwift.com/gameassets/%s' % gd_file).read()) | ||
tree = ET.parse(gd_file) | ||
|
||
def get_item(location, item, json_name): | ||
items = {} | ||
for x in tree.findall(location): | ||
items[x.get('name')] = int(x.get('signature')) | ||
best_match = process.extractOne(item, items.keys(), scorer=fuzz.token_set_ratio) | ||
equip = {} | ||
equip[json_name] = items[best_match[0]] | ||
equip[json_name+'_name'] = best_match[0] | ||
return equip | ||
|
||
def main(argv): | ||
global args | ||
|
||
parser = argparse.ArgumentParser(description='Print out json for bot.txt or ghost_profile.txt') | ||
megroup = parser.add_mutually_exclusive_group() | ||
parser.add_argument('-n', '--nation', help='Specify nation', default=False) | ||
parser.add_argument('-j', '--jersey', help='Get jersey', default=False) | ||
megroup.add_argument('-b', '--bike', help='Get bike', default=False) | ||
parser.add_argument('-w', '--wheels', help='Get wheels', default=False) | ||
parser.add_argument('-e', '--helmet', help='Get helmet', default=False) | ||
parser.add_argument('-s', '--shoes', help='Get shoes', default=False) | ||
parser.add_argument('-o', '--socks', help='Get socks', default=False) | ||
parser.add_argument('-g', '--glasses', help='Get glasses', default=False) | ||
megroup.add_argument('-p', '--paintjob', help='Get paintjob', default=False) | ||
args = parser.parse_args() | ||
|
||
total_data = {} | ||
if args.nation: | ||
total_data['country_code'] = cc.convert(names=args.nation, to='ISOnumeric') | ||
if args.jersey: | ||
total_data.update(get_item("./JERSEYS/JERSEY", args.jersey, 'ride_jersey')) | ||
if args.bike: | ||
total_data.update(get_item("./BIKEFRAMES/BIKEFRAME", args.bike, 'bike_frame')) | ||
if args.wheels: | ||
total_data.update(get_item("./BIKEFRONTWHEELS/BIKEFRONTWHEEL", args.wheels, 'bike_wheel_front')) | ||
total_data.update(get_item("./BIKEREARWHEELS/BIKEREARWHEEL", args.wheels, 'bike_wheel_rear')) | ||
if args.helmet: | ||
total_data.update(get_item("./HEADGEARS/HEADGEAR", args.helmet, 'ride_helmet_type')) | ||
if args.socks: | ||
total_data.update(get_item("./SOCKS/SOCK", args.socks, 'ride_socks_type')) | ||
if args.shoes: | ||
total_data.update(get_item("./BIKESHOES/BIKESHOE", args.shoes, 'ride_shoes_type')) | ||
if args.glasses: | ||
total_data.update(get_item("./GLASSES/GLASS", args.glasses, 'glass_type')) | ||
if args.paintjob: | ||
total_data.update(get_item("./PAINTJOBS/PAINTJOB", args.paintjob, 'bike_frame_colour')) | ||
total_data['bike_frame_colour'] <<= 32 | ||
total_data.update(get_item("./BIKEFRAMES/BIKEFRAME", total_data['bike_frame_colour_name'].split('-')[0], 'bike_frame')) | ||
|
||
data = json.dumps(total_data, indent=2) | ||
print(data) | ||
open('ghost_profile.txt', 'w').write(data) | ||
|
||
if __name__ == '__main__': | ||
try: | ||
main(sys.argv) | ||
except KeyboardInterrupt: | ||
pass | ||
except SystemExit as se: | ||
print("ERROR:", se) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.