mirror of
https://github.com/Ahrimdon/detailed-cod-tracker.git
synced 2024-11-03 16:46:44 -05:00
Added setup.py, centralized curl scripts, added deps
This commit is contained in:
parent
be35db0be4
commit
7ec472e364
5
.gitignore
vendored
Normal file
5
.gitignore
vendored
Normal file
@ -0,0 +1,5 @@
|
||||
__pycache__
|
||||
uninstall.*
|
||||
venv.*
|
||||
/venv
|
||||
/HTML
|
23
curl/beautify_json.py
Normal file
23
curl/beautify_json.py
Normal file
@ -0,0 +1,23 @@
|
||||
import json
|
||||
import os
|
||||
from json.decoder import JSONDecodeError
|
||||
|
||||
def pretty_print_json_file(input_file, output_file):
|
||||
try:
|
||||
with open(input_file, 'r', encoding='utf-8') as infile:
|
||||
content = infile.read()
|
||||
data = json.loads(content)
|
||||
with open(output_file, 'w', encoding='utf-8') as outfile:
|
||||
json.dump(data, outfile, indent=4)
|
||||
except JSONDecodeError as e:
|
||||
print(f"Error decoding JSON in {input_file}: {e}")
|
||||
|
||||
# Hardcoding the input and output file paths
|
||||
input_file = 'stats.json'
|
||||
output_file = 'stats_temp.json'
|
||||
|
||||
pretty_print_json_file(input_file, output_file)
|
||||
|
||||
# Remove the original file and rename the beautified file
|
||||
os.remove(input_file)
|
||||
os.rename(output_file, input_file)
|
16
curl/curl_links.txt
Normal file
16
curl/curl_links.txt
Normal file
@ -0,0 +1,16 @@
|
||||
# Get Stats Using Battle.NET (Requires Numbers)
|
||||
https://my.callofduty.com/api/papi-client/stats/cod/v1/title/mw/platform/battle/gamer/$PROF/profile/type/mp
|
||||
|
||||
# Get Stats Using PSN
|
||||
https://my.callofduty.com/api/papi-client/stats/cod/v1/title/mw/platform/psn/gamer/$PROF/profile/type/mp
|
||||
|
||||
# Get Stats Using Xbox Live
|
||||
https://my.callofduty.com/api/papi-client/stats/cod/v1/title/mw/platform/xbl/gamer/$PROF/profile/type/mp
|
||||
|
||||
---
|
||||
|
||||
# Get Recent Games
|
||||
https://my.callofduty.com/api/papi-client/crm/cod/v2/title/mw/platform/battle/gamer/$PROF/matches/mp/start/0/end/0/details
|
||||
|
||||
# Get Maps & Game Modes (No $PROF Variable Needed)
|
||||
https://my.callofduty.com/api/papi-client/ce/v1/title/mw/platform/battle/gameType/mp/communityMapData/availability
|
13
curl/get_stats.ps1
Normal file
13
curl/get_stats.ps1
Normal file
@ -0,0 +1,13 @@
|
||||
# Set your default values here
|
||||
$PROF = "Ahrimdon%231597" # The % replaces the # for the Activision ID (e.g. Ahrimdon%231597)
|
||||
# You do not need numbers for PSN or XBL
|
||||
# Delete $PROF when getting maps and game modes.
|
||||
$COOKIE_VALUE = "ACCT_SSO_COOKIE"
|
||||
|
||||
$URL = "AddLinkHere"
|
||||
$USER_AGENT = "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36"
|
||||
$OUTPUT_FILE = "stats.json"
|
||||
|
||||
curl -v $URL -H "Cookie: ACT_SSO_COOKIE=$COOKIE_VALUE" -H "User-Agent: $USER_AGENT" -o $OUTPUT_FILE
|
||||
|
||||
# Replace
|
BIN
deps/DateTime-5.2-py3-none-any.whl
vendored
Normal file
BIN
deps/DateTime-5.2-py3-none-any.whl
vendored
Normal file
Binary file not shown.
BIN
deps/aiohttp-3.8.5-cp39-cp39-win_amd64.whl
vendored
Normal file
BIN
deps/aiohttp-3.8.5-cp39-cp39-win_amd64.whl
vendored
Normal file
Binary file not shown.
BIN
deps/aiosignal-1.3.1-py3-none-any.whl
vendored
Normal file
BIN
deps/aiosignal-1.3.1-py3-none-any.whl
vendored
Normal file
Binary file not shown.
BIN
deps/async_timeout-4.0.3-py3-none-any.whl
vendored
Normal file
BIN
deps/async_timeout-4.0.3-py3-none-any.whl
vendored
Normal file
Binary file not shown.
BIN
deps/asyncio-3.4.3-py3-none-any.whl
vendored
Normal file
BIN
deps/asyncio-3.4.3-py3-none-any.whl
vendored
Normal file
Binary file not shown.
BIN
deps/attrs-23.1.0-py3-none-any.whl
vendored
Normal file
BIN
deps/attrs-23.1.0-py3-none-any.whl
vendored
Normal file
Binary file not shown.
BIN
deps/certifi-2023.7.22-py3-none-any.whl
vendored
Normal file
BIN
deps/certifi-2023.7.22-py3-none-any.whl
vendored
Normal file
Binary file not shown.
BIN
deps/charset_normalizer-3.3.0-cp39-cp39-win_amd64.whl
vendored
Normal file
BIN
deps/charset_normalizer-3.3.0-cp39-cp39-win_amd64.whl
vendored
Normal file
Binary file not shown.
BIN
deps/enum34-1.1.10-py3-none-any.whl
vendored
Normal file
BIN
deps/enum34-1.1.10-py3-none-any.whl
vendored
Normal file
Binary file not shown.
BIN
deps/frozenlist-1.4.0-cp39-cp39-win_amd64.whl
vendored
Normal file
BIN
deps/frozenlist-1.4.0-cp39-cp39-win_amd64.whl
vendored
Normal file
Binary file not shown.
BIN
deps/idna-3.4-py3-none-any.whl
vendored
Normal file
BIN
deps/idna-3.4-py3-none-any.whl
vendored
Normal file
Binary file not shown.
BIN
deps/multidict-6.0.4-cp39-cp39-win_amd64.whl
vendored
Normal file
BIN
deps/multidict-6.0.4-cp39-cp39-win_amd64.whl
vendored
Normal file
Binary file not shown.
BIN
deps/pytz-2023.3.post1-py2.py3-none-any.whl
vendored
Normal file
BIN
deps/pytz-2023.3.post1-py2.py3-none-any.whl
vendored
Normal file
Binary file not shown.
BIN
deps/requests-2.31.0-py3-none-any.whl
vendored
Normal file
BIN
deps/requests-2.31.0-py3-none-any.whl
vendored
Normal file
Binary file not shown.
BIN
deps/setuptools-68.2.2-py3-none-any.whl
vendored
Normal file
BIN
deps/setuptools-68.2.2-py3-none-any.whl
vendored
Normal file
Binary file not shown.
BIN
deps/urllib3-2.0.6-py3-none-any.whl
vendored
Normal file
BIN
deps/urllib3-2.0.6-py3-none-any.whl
vendored
Normal file
Binary file not shown.
BIN
deps/uuid-1.30.tar.gz
vendored
Normal file
BIN
deps/uuid-1.30.tar.gz
vendored
Normal file
Binary file not shown.
BIN
deps/wheel-0.41.2-py3-none-any.whl
vendored
Normal file
BIN
deps/wheel-0.41.2-py3-none-any.whl
vendored
Normal file
Binary file not shown.
BIN
deps/yarl-1.9.2-cp39-cp39-win_amd64.whl
vendored
Normal file
BIN
deps/yarl-1.9.2-cp39-cp39-win_amd64.whl
vendored
Normal file
Binary file not shown.
BIN
deps/zope.interface-6.0-cp39-cp39-win_amd64.whl
vendored
Normal file
BIN
deps/zope.interface-6.0-cp39-cp39-win_amd64.whl
vendored
Normal file
Binary file not shown.
41
setup.py
Normal file
41
setup.py
Normal file
@ -0,0 +1,41 @@
|
||||
import os
|
||||
import subprocess
|
||||
import venv
|
||||
|
||||
def deps_exists():
|
||||
return os.path.exists('deps')
|
||||
|
||||
def create_venv():
|
||||
venv.create('venv', with_pip=True)
|
||||
# Create activation scripts
|
||||
with open("venv.ps1", "w") as f:
|
||||
f.write("venv\\Scripts\\Activate.ps1")
|
||||
|
||||
with open("venv.bat", "w") as f:
|
||||
f.write("venv\\Scripts\\activate")
|
||||
|
||||
def upgrade_pip():
|
||||
subprocess.check_call([os.path.join('venv', 'Scripts', 'python'), '-m', 'pip', 'install', '--upgrade', 'pip'])
|
||||
|
||||
def install_wheel():
|
||||
subprocess.check_call([os.path.join('venv', 'Scripts', 'pip'), 'install', '--no-index', '--find-links=deps', 'wheel'])
|
||||
|
||||
def install_requirements_in_venv():
|
||||
# Use the full path to the wheel file
|
||||
wheel_path = os.path.join('src', 'cod_api-2.0.1-py3-none-any.whl')
|
||||
subprocess.check_call([os.path.join('venv', 'Scripts', 'pip'), 'install', '--no-index', '--find-links=deps', wheel_path])
|
||||
|
||||
if __name__ == "__main__":
|
||||
if not deps_exists():
|
||||
print("Error: 'deps' directory does not exist!")
|
||||
exit(1)
|
||||
|
||||
print("Creating virtual environment...")
|
||||
create_venv()
|
||||
print("Upgrading pip...")
|
||||
upgrade_pip()
|
||||
print("Installing wheel...")
|
||||
install_wheel()
|
||||
print("Installing packages in the virtual environment...")
|
||||
install_requirements_in_venv() # Call the function to install the requirements
|
||||
print("Setup complete.")
|
Loading…
Reference in New Issue
Block a user