nps: cache TSV lists in data/nps/ instead of the state dir
TSVs live with the other data assets; users can also drop PSP_GAMES.tsv / PSX_GAMES.tsv there manually to browse offline.
This commit is contained in:
@@ -103,6 +103,8 @@ Discs are matched by hash first (most precise), then serial, then filename.
|
|||||||
- `data/ps1_templates/` — optional PS1 Classics art templates
|
- `data/ps1_templates/` — optional PS1 Classics art templates
|
||||||
(`ICON0.PNG` case frame, `PIC1.PNG` launch background); the app falls back
|
(`ICON0.PNG` case frame, `PIC1.PNG` launch background); the app falls back
|
||||||
to drawn art when they're absent.
|
to drawn art when they're absent.
|
||||||
|
- `data/nps/` — NoPayStation TSV lists (cached here on first store scan; drop
|
||||||
|
`PSP_GAMES.tsv` / `PSX_GAMES.tsv` manually to work offline).
|
||||||
- State dir (`~/.local/state/psp-preserve/` by default, or `$XDG_STATE_HOME/psp-preserve`):
|
- State dir (`~/.local/state/psp-preserve/` by default, or `$XDG_STATE_HOME/psp-preserve`):
|
||||||
- `library.sqlite` — the catalog + library database.
|
- `library.sqlite` — the catalog + library database.
|
||||||
- `covers/` — downloaded cover cache.
|
- `covers/` — downloaded cover cache.
|
||||||
@@ -282,7 +284,8 @@ Requirements & behaviour:
|
|||||||
writes `PSX/<TITLE_ID>/EBOOT.PBP`. Both then show up in the **Library**
|
writes `PSX/<TITLE_ID>/EBOOT.PBP`. Both then show up in the **Library**
|
||||||
(PS1 Classics under **PS1**, PSP games under **Games**) and can be copied to
|
(PS1 Classics under **PS1**, PSP games under **Games**) and can be copied to
|
||||||
the PSP like any other item.
|
the PSP like any other item.
|
||||||
4. The TSV lists are cached in the state dir and refreshed on each store scan.
|
4. The TSV lists are cached in `data/nps/` and refreshed on each store scan
|
||||||
|
(drop the `.tsv` files there manually to work offline).
|
||||||
|
|
||||||
> **DRM note:** NPS content is PSN-DRM'd. To *run* it on the PSP you need the
|
> **DRM note:** NPS content is PSN-DRM'd. To *run* it on the PSP you need the
|
||||||
> [`npdrm_free`](https://github.com/qwikrazor87/npdrm_free) plugin (ARK and most
|
> [`npdrm_free`](https://github.com/qwikrazor87/npdrm_free) plugin (ARK and most
|
||||||
|
|||||||
+3
-3
@@ -36,8 +36,8 @@ def tsv_url(content_type: str, base: str = "") -> str:
|
|||||||
return f"{base}/{_TSV_NAMES.get(content_type, _TSV_NAMES['psp'])}"
|
return f"{base}/{_TSV_NAMES.get(content_type, _TSV_NAMES['psp'])}"
|
||||||
|
|
||||||
|
|
||||||
def _cache_dir() -> Path:
|
def _tsv_dir() -> Path:
|
||||||
d = config.STATE_DIR / "nps"
|
d = config.DATA_DIR / "nps"
|
||||||
d.mkdir(parents=True, exist_ok=True)
|
d.mkdir(parents=True, exist_ok=True)
|
||||||
return d
|
return d
|
||||||
|
|
||||||
@@ -110,7 +110,7 @@ def fetch_items(content_type: str, url: str = "", timeout: int = 60) -> List[dic
|
|||||||
"""Download (and cache) a TSV, returning parsed item dicts."""
|
"""Download (and cache) a TSV, returning parsed item dicts."""
|
||||||
url = url or tsv_url(content_type)
|
url = url or tsv_url(content_type)
|
||||||
name = _TSV_NAMES.get(content_type, "PSP_GAMES.tsv")
|
name = _TSV_NAMES.get(content_type, "PSP_GAMES.tsv")
|
||||||
cache = _cache_dir() / name
|
cache = _tsv_dir() / name
|
||||||
if cache.is_file():
|
if cache.is_file():
|
||||||
try:
|
try:
|
||||||
return parse_tsv(cache.read_text(encoding="utf-8", errors="replace"), content_type)
|
return parse_tsv(cache.read_text(encoding="utf-8", errors="replace"), content_type)
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
# NoPayStation TSV lists are cached here (downloaded on first store scan).
|
||||||
|
# You can also drop PSP_GAMES.tsv / PSX_GAMES.tsv here manually to work offline.
|
||||||
Reference in New Issue
Block a user