paper-dynasty-card-creation/pd_cards/commands/upload.py
Cal Corum 2e28d29ced Add pd-cards CLI skeleton with Typer
Introduces new pd-cards CLI tool for all card creation workflows:
- custom: manage fictional character cards via YAML profiles
- live-series: live season card updates (stub)
- retrosheet: historical data processing (stub)
- scouting: scouting report generation (stub)
- upload: S3 card image upload (stub)

Key features:
- Typer-based CLI with auto-generated help and shell completion
- YAML profiles for custom characters (replaces per-character Python scripts)
- Preview, submit, new, and list commands for custom cards
- First character migrated: Kalin Young

Install with: uv pip install -e .
Run with: pd-cards --help

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-18 16:08:32 -06:00

92 lines
2.7 KiB
Python

"""
Card image upload commands.
Commands for uploading card images to AWS S3.
"""
from pathlib import Path
from typing import Optional
import typer
from rich.console import Console
app = typer.Typer(no_args_is_help=True)
console = Console()
@app.command()
def s3(
cardset: str = typer.Option(..., "--cardset", "-c", help="Cardset name to upload"),
start_id: Optional[int] = typer.Option(None, "--start-id", help="Player ID to start from (for resuming)"),
limit: Optional[int] = typer.Option(None, "--limit", "-l", help="Limit number of cards to process"),
html: bool = typer.Option(False, "--html", help="Upload HTML preview cards instead of PNG"),
dry_run: bool = typer.Option(False, "--dry-run", "-n", help="Preview without uploading"),
):
"""
Upload card images to AWS S3.
Fetches card images from Paper Dynasty API and uploads to S3 bucket.
"""
console.print()
console.print("=" * 70)
console.print(f"[bold]S3 UPLOAD - {cardset}[/bold]")
console.print("=" * 70)
console.print(f"Cardset: {cardset}")
if start_id:
console.print(f"Starting from player ID: {start_id}")
if limit:
console.print(f"Limit: {limit} cards")
if html:
console.print("Mode: HTML preview cards")
if dry_run:
console.print("[yellow]DRY RUN - no uploads will be made[/yellow]")
# TODO: Migrate logic from check_cards_and_upload.py
console.print()
console.print("[yellow]Not yet implemented - run legacy script:[/yellow]")
console.print(" python check_cards_and_upload.py")
raise typer.Exit(0)
@app.command()
def migrate(
cardset: str = typer.Option(..., "--cardset", "-c", help="Cardset name"),
dry_run: bool = typer.Option(False, "--dry-run", "-n", help="Preview without uploading"),
):
"""
Migrate all cards for a cardset to S3.
Bulk upload for initial cardset migration.
"""
console.print()
console.print("=" * 70)
console.print(f"[bold]S3 MIGRATION - {cardset}[/bold]")
console.print("=" * 70)
if dry_run:
console.print("[yellow]DRY RUN - no uploads will be made[/yellow]")
# TODO: Migrate logic from migrate_all_cards_to_s3.py
console.print()
console.print("[yellow]Not yet implemented - run legacy script:[/yellow]")
console.print(" python migrate_all_cards_to_s3.py")
raise typer.Exit(0)
@app.command()
def refresh(
cardset: str = typer.Option(..., "--cardset", "-c", help="Cardset name"),
):
"""
Refresh card images for a cardset.
Re-generates and re-uploads card images.
"""
console.print()
console.print("[yellow]Not yet implemented - run legacy script:[/yellow]")
console.print(" python refresh_cards.py")