134 lines
3.7 KiB
Markdown
134 lines
3.7 KiB
Markdown
# Scripts Directory
|
|
|
|
This directory contains utility scripts for Paper Dynasty card management and data operations.
|
|
|
|
## Scripts
|
|
|
|
### `upload_scouting.py`
|
|
Generates and uploads scouting reports to the remote server.
|
|
|
|
**What it does:**
|
|
1. Runs `scouting_batters.py` to generate batting scouting reports
|
|
2. Runs `scouting_pitchers.py` to generate pitching scouting reports
|
|
3. Uploads all 4 CSV files (batting-basic, batting-ratings, pitching-basic, pitching-ratings) to sba-db server via SCP
|
|
|
|
**How to run:**
|
|
```bash
|
|
cd scripts
|
|
python upload_scouting.py
|
|
```
|
|
|
|
---
|
|
|
|
### `add_second_cards.py`
|
|
Adds secondary card images (image2) to player records for players who have both batting and pitching cards.
|
|
|
|
**What it does:**
|
|
- Pulls all batting and pitching cards from the database
|
|
- For players missing their alternate card type in image2, adds the appropriate card URL
|
|
- Updates player records with the secondary card image
|
|
|
|
**How to run:**
|
|
```bash
|
|
python add_second_cards.py
|
|
```
|
|
|
|
---
|
|
|
|
### `custom_card_creation.py`
|
|
Creates custom cardsets with specific configuration options.
|
|
|
|
**What it does:**
|
|
- Generates cards for a specified custom cardset
|
|
- Allows control over batting/pitching card generation
|
|
- Handles player position updates based on card data
|
|
- Uses command-line arguments for configuration
|
|
|
|
**Arguments:**
|
|
- `cardset_name`: Name of the cardset to create
|
|
- `season`: Season year (optional, defaults to first 4 chars of cardset name)
|
|
- `player_description`: Description shown on cards (optional)
|
|
- `post_batters`: Whether to post batting cards (default: true)
|
|
- `post_pitchers`: Whether to post pitching cards (default: true)
|
|
- `post_players`: Whether to post player updates (default: true)
|
|
|
|
**How to run:**
|
|
```bash
|
|
python custom_card_creation.py cardset_name="2024 Custom" season=2024
|
|
```
|
|
|
|
---
|
|
|
|
### `fix_pitcher_pos.py`
|
|
Updates pitcher positions (SP/RP/CP) based on their pitching card ratings.
|
|
|
|
**What it does:**
|
|
- Queries all players with position P
|
|
- Checks their starter_rating and closer_rating from pitching cards
|
|
- Updates positions: SR >= 4 → SP, otherwise → RP, CR present → CP
|
|
|
|
**How to run:**
|
|
```bash
|
|
python fix_pitcher_pos.py
|
|
```
|
|
|
|
---
|
|
|
|
### `position_updates.py`
|
|
Comprehensive player position updates for a specified cardset.
|
|
|
|
**What it does:**
|
|
- Updates all player positions based on their cards in a specific cardset
|
|
- Handles pitchers (SP/RP/CP logic based on ratings)
|
|
- Handles fielders (preserves existing positions)
|
|
- Only updates positions that have changed
|
|
|
|
**Arguments:**
|
|
- `cardset_name`: Name of the cardset to update
|
|
- `post_players`: Whether to actually post updates (default: false)
|
|
|
|
**How to run:**
|
|
```bash
|
|
python position_updates.py cardset_name="2025 Live" post_players=true
|
|
```
|
|
|
|
---
|
|
|
|
### `scouting_updates.py`
|
|
Triggers scouting report calculations on the Paper Dynasty API.
|
|
|
|
**What it does:**
|
|
- Runs 4 sequential API calls to calculate card ratings:
|
|
1. Basic batting ratings
|
|
2. Full batting scouting ratings
|
|
3. Basic pitching ratings
|
|
4. Full pitching scouting ratings
|
|
- Times each operation and reports total runtime
|
|
|
|
**How to run:**
|
|
```bash
|
|
python scouting_updates.py
|
|
```
|
|
|
|
---
|
|
|
|
### `supabase_doodling.py`
|
|
Development/testing script for Supabase operations (not for production use).
|
|
|
|
---
|
|
|
|
### `raw play tracking.py`
|
|
Legacy script (purpose unclear from filename - check contents before use).
|
|
|
|
---
|
|
|
|
## Legacy Scripts
|
|
|
|
The `legacy/` subdirectory contains older scripts that are no longer actively used but kept for reference.
|
|
|
|
## Notes
|
|
|
|
- Most scripts require authentication credentials configured in `db_calls.py`
|
|
- Scripts typically use async/await patterns and should be run with `asyncio.run()`
|
|
- Check individual script headers for additional documentation
|
|
- Scripts in this directory should be run from the scripts directory or with appropriate path handling |