diff --git a/cod_api/replacements.py b/data/replacements.json similarity index 72% rename from cod_api/replacements.py rename to data/replacements.json index 82ac69d..1ea0c84 100644 --- a/cod_api/replacements.py +++ b/data/replacements.json @@ -1,5 +1,4 @@ -replacements = { - # Maps +{ "career": "Career", "mp_hackney_yard": "Hackney Yard (Night)", "mp_aniyah": "Aniyah Palace", @@ -66,7 +65,6 @@ replacements = { "mp_herat": "Al-Raab Airbase", "mp_killhouse": "Killhouse", "mp_m_drainage": "Drainage", - # Gamemodes "war": "Team Deathmatch", "sd": "Search and Destroy", "dom": "Domination", @@ -156,7 +154,6 @@ replacements = { "br_rumble_clash": "Clash", "br_dbd_dbd": "Iron Trials '84", "br_gxp_gov": "Ghosts of Verdansk", - # Weapons "scorestreak": "Scorestreak", "equipment": "Equipment", "gear": "Gear", @@ -285,10 +282,9 @@ replacements = { "super_tac_insert": "Tactical Insertion", "super_recon_drone": "Recon Drone", "super_deadsilence": "Dead Silence", - "super_supply_drop": "Loadout Drop", ### Unsure if this is Loadout Drop + "super_supply_drop": "Loadout Drop", "super_tac_cover": "Deployable Cover", "super_support_box": "Stopping Power Rounds", - #Extra "mp_stat": "Statistic", "session_start": "Session Start", "uno": "PC", @@ -296,7 +292,6 @@ replacements = { "xbl": "Xbox Live", "mw": "Modern Warfare", "cw": "Cold War", - # CW Maps "mp_cartel": "Cartel", "mp_tank": "Garrison", "mp_miami": "Miami", @@ -338,74 +333,4 @@ replacements = { "mp_amerika": "Amerika", "mp_sm_vault": "Gluboko", "mp_don4_pm": "Nuketown '84 Halloween" - # Accolades - # "accoladeData": "Accolades", - # "classChanges": "Most classes changed (Evolver)", - # "highestAvgAltitude": "Highest average altitude (High Command)", - # "killsFromBehind": "Most kills from behind (Flanker)", - # "lmgDeaths": "Most LMG deaths (Target Practice)", - # "riotShieldDamageAbsorbed": "Most damage absorbed with Riot Shield (Guardian)", - # "flashbangHits": "Most Flashbang hits (Blinder)", - # "meleeKills": "Most Melee kills (Brawler)", - # "tagsLargestBank": "Largest bank (Bank Account)", - # "shotgunKills": "Most Shotgun kills (Buckshot)", - # "sniperDeaths": "Most Sniper deaths (Zeroed In)", - # "timeProne": "Most time spent Prone (Grassy Knoll)", - # "killstreakWhitePhosphorousKillsAssists": "Most kills and assists with White Phosphorus (Burnout)", - # "shortestLife": "Shortest life (Terminal)", - # "deathsFromBehind": "Most deaths from behind (Blindsided)", - # "higherRankedKills": "Most kills on higher ranked scoreboard players (Upriser)", - # "mostAssists": "Most assists (Wingman)", - # "leastKills": "Fewest kills (The Fearful)", - # "tagsDenied": "Denied the most tags (Denied)", - # "killstreakWheelsonKills": "Most Wheelson kills", - # "sniperHeadshots": "Most Sniper headshots (Dead Aim)", - # "killstreakJuggernautKills": "Most Juggernaut kills (Heavy Metal)", - # "smokesUsed": "Most Smoke Grenades used (Chimney)", - # "avengerKills": "Most avenger kills (Avenger)", - # "decoyHits": "Most Decoy Grenade hits (Made You Look)", - # "killstreakCarePackageUsed": "Most Care Packages called in (Helping Hand)", - # "molotovKills": "Most Molotov kills (Arsonist)", - # "gasHits": "Most Gas Grenade hits (Gaseous)", - # "comebackKills": "Most comebacks (Rally)", - # "lmgHeadshots": "Most LMG headshots (LMG Expert)", - # "smgDeaths": "Most SMG deaths (Run and Gunned)", - # "carrierKills": "Most kills as carrier (Carrier)", - # "deployableCoverUsed": "Most Deployable Covers used (Combat Engineer)", - # "thermiteKills": "Most Thermite kills (Red Iron)", - # "arKills": "Most assault rifle kills (AR Specialist)", - # "c4Kills": "Most C4 kills (Handle With Care)", - # "suicides": "Most suicides (Accident Prone)", - # "clutch": "Most kills as the last alive (Clutched)", - # "survivorKills": "Most kills as survivor (Survivalist)", - # "killstreakGunshipKills": "Most Gunship kills (Death From Above)", - # "timeSpentAsPassenger": "Most time spent as a passenger (Navigator)", - # "returns": "Most flags returned (Flag Returner)", - # "smgHeadshots": "Most SMG headshots (SMG Expert)", - # "launcherDeaths": "Most launcher deaths (Fubar)", - # "oneShotOneKills": "Most one shot kills (One Shot Kill)", - # "ammoBoxUsed": "Most Munitions Boxes used (Provider)", - # #"spawnSelectSquad": "", - # "weaponPickups": "Most picked up weapons (Loaner)", - # "pointBlankKills": "Most point blank kills (Personal Space)", - # "tagsCaptured": "Collected the most tags (Confirmed Kills)", - # "killstreakGroundKills": "Most ground based killstreak kills (Ground Control)", - # "distanceTraveledInVehicle": "Longest distance travelled in a vehicle (Cross Country)", - # "longestLife": "Longest life (Lifer)", - # "stunHits": "Most Stun Grenade hits (Stunner)", - # "spawnSelectFlag": "Most FOB Spawns (Objective Focused)", # Unsure - # "shotgunHeadshots": "Most Shotgun headshots (Boomstick)", - # "bombDefused": "Most defuses (Defuser)", - # "snapshotHits": "Most Snapshot Grenade hits (Photographer)", - # "noKillsWithDeath": "No kills with at least 1 death (Participant)", - # "killstreakAUAVAssists": "Most Advanced UAV assists (Target Rich Environment)", - # "killstreakPersonalUAVKills": "Most kills with a Personal Radar active (Nothing Personal)", - # "tacticalInsertionSpawns": "Most Tactical Insertions used (Revenant)", - # "launcherKills": "Most Launcher kills (Explosive)", - # "spawnSelectVehicle": "Most vehicle spawns (Oscar Mike)", - # "mostKillsLeastDeaths": "Most kills and fewest deaths (MVP)", - # "mostKills": "Most kills (The Feared)", - # "defends": "Most defend kills (Defense)", - # "timeSpentAsDriver": "Most time spent driving (Driver)", - # "": "" # WIP - Still adding more } \ No newline at end of file diff --git a/get_cod_stats.py b/get_cod_stats.py index 4bd85aa..021b1a6 100644 --- a/get_cod_stats.py +++ b/get_cod_stats.py @@ -4,7 +4,6 @@ import json import os import argparse from cod_api import API, platforms -from cod_api.replacements import replacements import asyncio import datetime @@ -17,6 +16,17 @@ api = API() COOKIE_FILE = 'cookie.txt' DIR_NAME = 'stats' MATCH_DIR_NAME = 'matches' +REPLACEMENTS_FILE = 'data/replacements.json' + +# Load replacements from JSON +def load_replacements(): + """Load replacements from the JSON file.""" + if not os.path.exists(REPLACEMENTS_FILE): + raise FileNotFoundError(f"{REPLACEMENTS_FILE} not found. Ensure it exists in the script's directory.") + with open(REPLACEMENTS_FILE, 'r') as file: + return json.load(file) + +replacements = load_replacements() def save_to_file(data, filename, dir_name='stats'): """Utility function to save data to a JSON file."""