Metadata-Version: 2.5
Name: whattoplay-psn
Version: 1.0.0
Summary: PlayStation Network store plugin for whattoplay: owned PS4/PS5 games with playtime.
Project-URL: Homepage, https://github.com/junousia/whattoplay-psn
Project-URL: Issues, https://github.com/junousia/whattoplay-psn/issues
Author: Jukka Nousiainen
License-Expression: MIT
License-File: LICENSE
Keywords: agent-skill,playstation,psn,psnawp,whattoplay
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Games/Entertainment
Requires-Python: >=3.11
Requires-Dist: psnawp>=3.1
Requires-Dist: whattoplay>=1.0.0
Description-Content-Type: text/markdown

# whattoplay-psn

PlayStation Network backend for [whattoplay](https://github.com/junousia/whattoplay). It adds your owned PS4 and PS5 games, with playtime, to the library `whattoplay` picks from. Built on [psnawp](https://github.com/isFakeAccount/psnawp), an unofficial client for Sony's private API.

## Install

Install it into the same environment as `whattoplay`; the plugin registers itself through the `whattoplay.stores` entry point.

```bash
uv tool install whattoplay --with whattoplay-psn
# or: pip install whattoplay whattoplay-psn
```

`whattoplay stores` should now list `psn`.

## Set up

1. Sign in at [playstation.com](https://www.playstation.com), then open <https://ca.account.sony.com/api/v1/ssocookie> in the same browser. Copy the `npsso` value from the JSON.
2. Give it to whattoplay as a secret, never in `config.toml`:

   ```bash
   whattoplay configure psn      # prompts without echoing, stores it in <data dir>/.env (mode 600)
   # or set PSN_NPSSO in the environment
   ```

3. `whattoplay refresh --store psn`

The NPSSO token expires after roughly two months. When it does, `refresh` reports it and keeps your previously cached PSN games; get a new token and run `configure psn` again.

## What you get

- **Owned games** from your entitlements, so games you bought but never started show up with 0 minutes. That is what a backlog picker needs.
- **Playtime** from PSN's play statistics. A title appears there only after it has been played.
- PS4 and PS5 editions of the same game are merged into one entry (the larger playtime wins).
- Games get a PlayStation Store link and cover art. Genres and review scores are not available from PSN.

Games are addressed as `psn:<titleId>` (for example `psn:PPSA01234_00`).

## Limits

- Only PS4 and PS5 titles; PS3 and Vita games are not in PSN's entitlement or statistics endpoints.
- Subscription catalogue games (PS Plus) only appear once you have played them.
- This uses an unofficial API that Sony can change without notice.

## Development

```bash
uv sync
uv run pytest
```

## License

MIT
