This python script totals your PSN purchases in two ways; it provides a number of total purchases made, and the total amount of money spent on those purchases.
Sure you could! But if your account is as old as mine (15 years old as of 2024) it likely has hundreds, if not thousands of transactions. For old accounts, then, it's not feasible to manually count up each and every transaction - hence why I wrote this code! I've now shared it for anyone else curious for their total spending on PSN.
Firstly, download the playstation_purchases.py file.
Make sure Python is installed on your system. You can download it from python.org.
1. Open Terminal:
- Press
Cmd + Spaceto open Spotlight Search. - Type "Terminal" and press
Enterto open the Terminal.
2. Navigate to the Script's Directory:
- Use the
cdcommand to change the directory to where your Python script is located. For example:cd path/to/your/script
3. Run the Script:
- Once you're in the script's directory, run the script using the
pythoncommand:python playstation_purchases.py
1. Open Command Prompt:
- Press
Win + Rto open the Run dialog. - Type "cmd" and press
Enterto open the Command Prompt.
2. Navigate to the Script's Directory:
- Use the
cdcommand to change the directory to where your Python script is located. For example:cd path\to\your\script
3. Run the Script:
- Once you're in the script's directory, run the script using the
pythoncommand:playstation_purchases.py
Is python not recognised by your command line? Here's how to fix the issue:
-
Find Python Executable Path:
- Open Terminal.
- Type the following command to find the Python executable path:
which python
This will display the path to the Python executable.
-
Add Python to PATH:
-
Open or create your shell configuration file. For example, for the default Bash shell, you can use:
nano ~/.bash_profile -
Add the following line at the end of the file:
export PATH="/path/to/python/bin:$PATH"
Replace "/path/to/python/bin" with the actual path you obtained from the first step.
-
Save the file and exit. If you used
nano, pressCtrl + X, thenYto confirm changes, andEnterto exit. -
Restart Terminal or run the following command to apply the changes:
source ~/.bash_profile
-
-
Verify:
- Type
pythonagain in the terminal. It should now recognize the command.
- Type
-
Find Python Executable Path:
- Open Command Prompt.
- Type the following command to find the Python executable path:
where python
This will display the path to the Python executable.
-
Add Python to PATH:
-
Right-click on "This PC" or "Computer" on your desktop or in File Explorer.
-
Select "Properties" > "Advanced system settings" > "Environment Variables."
-
In the "System variables" section, find and select the "Path" variable, then click "Edit."
-
Click "New" and add the path to the Python executable (without the actual executable filename) that you obtained from the first step.
-
Click "OK" to close each dialog.
-
Restart Command Prompt.
-
-
Verify:
- Type
pythonagain in the Command Prompt. It should now recognize the command.
- Type
After following these steps, your system should recognize the python command in the terminal or Command Prompt.
- Migrating to a user-friendly web-page using Github Pages, removing the need for a downloaded script and terminal/command prompt usage.
- Insight-gathering from data, e.g.:
- The year/month/day most purchases were made
- The most expensive year/month/day
- Seasonal trends (e.g. favourite season for purchases)
- Weekday/monthly trends (e.g. what weekday / month are most purchases typically made across all years)
- Average purchase amount
- Most expensive purchase
- Cheapest non-0 purchase
- Longest transaction free period
- Longest purchase streak (days)
- etc...