mirror of
https://github.com/Ahrimdon/detailed-cod-tracker.git
synced 2024-11-03 16:46:44 -05:00
Update replacement strings, add more prettifying logic
This commit is contained in:
parent
290852d839
commit
b4d305d531
@ -27,7 +27,7 @@ replacements = {
|
||||
"mp_m_speed": "Shoot House",
|
||||
"mp_farms2_gw": "Krovnik Farmland",
|
||||
"mp_port2_gw": "Port",
|
||||
"mp_crash": "Crash",
|
||||
"mp_crash2": "Crash",
|
||||
"mp_vacant": "Vacant",
|
||||
"mp_shipment": "Shipment",
|
||||
"mp_m_cargo": "Cargo",
|
||||
@ -41,10 +41,10 @@ replacements = {
|
||||
"mp_hideout": "Khandor Hideout",
|
||||
"loading_mp_hideout": "Khandor Hideout",
|
||||
"mp_aniyah_tac": "Aniyah Incursion",
|
||||
"mp_backlot": "Talsik Backlot",
|
||||
"mp_village": "Hovec Sawmill",
|
||||
"mp_backlot2": "Talsik Backlot",
|
||||
"mp_village2": "Hovec Sawmill",
|
||||
"mp_hardhat": "Hardhat",
|
||||
"mp_m_wallco": "Aisle 9",
|
||||
"mp_m_wallco2": "Aisle 9",
|
||||
"mp_donetsk": "Verdansk",
|
||||
"mp_scrapyard": "Zhokov Scrapyard",
|
||||
"mp_m_trench": "Trench",
|
||||
@ -58,7 +58,7 @@ replacements = {
|
||||
"mp_m_stadium": "Verdansk Stadium",
|
||||
"mp_malyshev": "Mialstor Tank Factory",
|
||||
"mp_malyshev_10v10": "Mialstor Tank Factory",
|
||||
"mp_broadcast": "Broadcast",
|
||||
"mp_broadcast2": "Broadcast",
|
||||
"mp_riverside_gw": "Verdansk Riverside",
|
||||
"mp_m_train": "Station",
|
||||
"mp_kstenod": "Verdansk (Night)",
|
||||
@ -288,6 +288,56 @@ replacements = {
|
||||
"super_supply_drop": "Loadout Drop", ### Unsure if this is Loadout Drop
|
||||
"super_tac_cover": "Deployable Cover",
|
||||
"super_support_box": "Stopping Power Rounds",
|
||||
#Extra
|
||||
"mp_stat": "Statistic",
|
||||
"session_start": "Session Start",
|
||||
"uno": "PC",
|
||||
"psn": "Playstation Network",
|
||||
"xbl": "Xbox Live",
|
||||
"mw": "Modern Warfare",
|
||||
"cw": "Cold War",
|
||||
# CW Maps
|
||||
"mp_cartel": "Cartel",
|
||||
"mp_tank": "Garrison",
|
||||
"mp_miami": "Miami",
|
||||
"mp_moscow": "Moscow",
|
||||
"mp_satellite": "Satellite",
|
||||
"mp_kgb": "Checkmate",
|
||||
"wz_forest": "Ruka",
|
||||
"wz_ski_slopes": "Alpine",
|
||||
"mp_nuketown6": "Nuketown '84",
|
||||
"mp_tundra": "Crossroads",
|
||||
"mp_black_sea": "Armada",
|
||||
"mp_mall": "The Pines",
|
||||
"mp_raid_rm": "Raid",
|
||||
"mp_sm_berlin_tunnel": "U-Bahn",
|
||||
"mp_sm_finance": "KGB",
|
||||
"mp_sm_game_show": "Game Show",
|
||||
"mp_sm_central": "ICBM",
|
||||
"wz_sanatorium": "Sanatorium",
|
||||
"nuketown6_holiday": "Nuketown '84 Holiday",
|
||||
"mp_express_rm": "Express",
|
||||
"mp_apocalypse": "Apocalypse",
|
||||
"mp_sm_market": "Mansion",
|
||||
"mp_miami_strike": "Miami Strike",
|
||||
"wz_golova": "Golova",
|
||||
"mp_cliffhanger": "Yamantau",
|
||||
"mp_sm_gas_station": "Diesel",
|
||||
"wz_duga": "Duga",
|
||||
"mp_village_rm": "Standoff",
|
||||
"mp_sm_amsterdam": "Amsterdam",
|
||||
"mp_dune": "Collateral",
|
||||
"mp_hijacked_rm": "Hijacked",
|
||||
"mp_paintball_rm": "Rush",
|
||||
"mp_sm_deptstore": "Showroom",
|
||||
"mp_slums_rm": "Slums",
|
||||
"mp_echelon": "Echelon",
|
||||
"mp_drivein_rm": "Drive In",
|
||||
"mp_zoo_rm": "Zoo",
|
||||
"mp_firebase": "Deprogram",
|
||||
"mp_amerika": "Amerika",
|
||||
"mp_sm_vault": "Gluboko",
|
||||
"mp_don4_pm": "Nuketown '84 Halloween"
|
||||
# Accolades
|
||||
# "accoladeData": "Accolades",
|
||||
# "classChanges": "Most classes changed (Evolver)",
|
||||
|
@ -126,23 +126,46 @@ def get_and_save_data(player_name=None, all_stats=False, season_loot=False, iden
|
||||
save_to_file(settings, 'settings.json')
|
||||
|
||||
def display_menu():
|
||||
print("Please choose an option:")
|
||||
print("1) Get all stats")
|
||||
print("2) Get season loot")
|
||||
print("3) Get identities")
|
||||
print("4) Get map list")
|
||||
print("\nBeautify Options:")
|
||||
print("1) Beautify all data")
|
||||
print("2) Split matches into separate files")
|
||||
|
||||
# Options Requiring Player Name
|
||||
print("\nOptions Requiring Player Name:")
|
||||
print("3) Get all stats")
|
||||
print("4) Get identities")
|
||||
print("5) Get general information")
|
||||
print("6) Get friend feed")
|
||||
print("7) Get event feed")
|
||||
print("8) Get COD Point balance")
|
||||
print("9) Get connected accounts")
|
||||
print("10) Get account settings")
|
||||
print("11) Beautify all data")
|
||||
print("12) Split matches into separate files")
|
||||
print("0) Exit")
|
||||
|
||||
# Options Not Requiring Player Name
|
||||
print("\nOptions Not Requiring Player Name:")
|
||||
print("11) Get season loot")
|
||||
print("12) Get map list")
|
||||
|
||||
# Exit Option
|
||||
print("\n0) Exit")
|
||||
|
||||
choice = input("Enter your choice: ")
|
||||
return int(choice)
|
||||
|
||||
def beautify_feed_data():
|
||||
for feed_file in ['friendFeed.json', 'eventFeed.json']:
|
||||
file_path = os.path.join(DIR_NAME, feed_file)
|
||||
if os.path.exists(file_path):
|
||||
with open(file_path, 'r') as file:
|
||||
data = json.load(file)
|
||||
replace_time_and_duration_recursive(data)
|
||||
data = recursive_key_replace(data)
|
||||
with open(file_path, 'w') as file:
|
||||
json.dump(data, file, indent=4)
|
||||
print(f"Keys sorted and replaced in {file_path}.")
|
||||
else:
|
||||
print(f"{feed_file} does not exist, skipping.")
|
||||
|
||||
# Save results to a JSON file inside the stats directory
|
||||
def recursive_key_replace(obj):
|
||||
if isinstance(obj, dict):
|
||||
@ -172,7 +195,7 @@ def clean_json_files(*filenames, dir_name='stats'):
|
||||
modified_content = re.sub(regex_pattern, replace, content)
|
||||
with open(file_path, 'w') as file:
|
||||
file.write(modified_content)
|
||||
print(f"Cleaned {filename}.")
|
||||
print(f"Removed unreadable strings from {filename}.")
|
||||
else:
|
||||
print(f"{filename} does not exist, skipping.")
|
||||
|
||||
@ -359,37 +382,39 @@ def main():
|
||||
while True:
|
||||
choice = display_menu()
|
||||
|
||||
if choice in [1, 3, 5, 6, 7, 8, 9, 10]:
|
||||
if choice in [3, 4, 5, 6, 7, 8, 9, 10, 11]:
|
||||
player_name = input("Please enter the player's username (with #1234567): ")
|
||||
|
||||
if choice == 1:
|
||||
if choice == 3:
|
||||
get_and_save_data(player_name=player_name, all_stats=True)
|
||||
elif choice == 3:
|
||||
get_and_save_data(player_name=player_name, identities=True)
|
||||
if choice == 4:
|
||||
get_and_save_data(player_name=player_name, season_loot=True)
|
||||
elif choice == 5:
|
||||
get_and_save_data(player_name=player_name, info=True)
|
||||
get_and_save_data(player_name=player_name, identities=True)
|
||||
elif choice == 6:
|
||||
get_and_save_data(player_name=player_name, friendFeed=True)
|
||||
get_and_save_data(player_name=player_name, info=True)
|
||||
elif choice == 7:
|
||||
get_and_save_data(player_name=player_name, eventFeed=True)
|
||||
get_and_save_data(player_name=player_name, friendFeed=True)
|
||||
elif choice == 8:
|
||||
get_and_save_data(player_name=player_name, cod_points=True)
|
||||
get_and_save_data(player_name=player_name, eventFeed=True)
|
||||
elif choice == 9:
|
||||
get_and_save_data(player_name=player_name, connected_accounts=True)
|
||||
get_and_save_data(player_name=player_name, cod_points=True)
|
||||
elif choice == 10:
|
||||
get_and_save_data(player_name=player_name, connected_accounts=True)
|
||||
elif choice == 11:
|
||||
get_and_save_data(player_name=player_name, settings=True)
|
||||
|
||||
elif choice == 2:
|
||||
get_and_save_data(season_loot=True)
|
||||
elif choice == 4:
|
||||
get_and_save_data(maps=True)
|
||||
elif choice == 11:
|
||||
elif choice == 1:
|
||||
beautify_data()
|
||||
beautify_match_data()
|
||||
# beautify_feed_data()
|
||||
beautify_feed_data()
|
||||
clean_json_files('friendFeed.json', 'eventFeed.json')
|
||||
elif choice == 12:
|
||||
elif choice == 2:
|
||||
split_matches_into_files()
|
||||
|
||||
elif choice == 12:
|
||||
get_and_save_data(season_loot=True)
|
||||
elif choice == 13:
|
||||
get_and_save_data(maps=True)
|
||||
elif choice == 0:
|
||||
print("Exiting...")
|
||||
break
|
||||
@ -446,8 +471,8 @@ def main():
|
||||
elif args.clean:
|
||||
beautify_data()
|
||||
beautify_match_data()
|
||||
# beautify_feed_data()
|
||||
# clean_json_files('friendFeed.json', 'eventFeed.json')
|
||||
beautify_feed_data()
|
||||
clean_json_files('friendFeed.json', 'eventFeed.json')
|
||||
elif args.clean_friend_feed:
|
||||
clean_json_files('friendFeed.json')
|
||||
elif args.clean_event_feed:
|
||||
|
Loading…
Reference in New Issue
Block a user