Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
14b0b955f5 |
+4
-4
@@ -1860,7 +1860,7 @@ class StorePage(QWidget):
|
|||||||
self.source_combo.currentIndexChanged.connect(self._on_source_changed)
|
self.source_combo.currentIndexChanged.connect(self._on_source_changed)
|
||||||
bar.addWidget(self.source_combo)
|
bar.addWidget(self.source_combo)
|
||||||
self.nps_type = QComboBox()
|
self.nps_type = QComboBox()
|
||||||
self.nps_type.addItems(["PSP Games", "PS1 Classics", "PSP Themes", "PSP DLC"])
|
self.nps_type.addItems(["All", "PSP Games", "PS1 Classics", "PSP Themes", "PSP DLC"])
|
||||||
self.nps_type.setVisible(False)
|
self.nps_type.setVisible(False)
|
||||||
self.nps_type.currentIndexChanged.connect(self._on_nps_type_changed)
|
self.nps_type.currentIndexChanged.connect(self._on_nps_type_changed)
|
||||||
bar.addWidget(self.nps_type)
|
bar.addWidget(self.nps_type)
|
||||||
@@ -1972,7 +1972,7 @@ class StorePage(QWidget):
|
|||||||
if self.source_combo.currentIndex() == 1:
|
if self.source_combo.currentIndex() == 1:
|
||||||
return transfers.ArchiveOrgSource(self._archive_id, self._archive_sig, self._archive_user)
|
return transfers.ArchiveOrgSource(self._archive_id, self._archive_sig, self._archive_user)
|
||||||
if self.source_combo.currentIndex() == 3:
|
if self.source_combo.currentIndex() == 3:
|
||||||
ct = ("psp", "psx", "theme", "dlc")[self.nps_type.currentIndex()]
|
ct = ("all", "psp", "psx", "theme", "dlc")[self.nps_type.currentIndex()]
|
||||||
return transfers.NoPayStationSource(ct)
|
return transfers.NoPayStationSource(ct)
|
||||||
return transfers.LocalShareSource(self._store_dir)
|
return transfers.LocalShareSource(self._store_dir)
|
||||||
|
|
||||||
@@ -2057,7 +2057,7 @@ class StorePage(QWidget):
|
|||||||
self.status.setText("Fetching store from archive.org…")
|
self.status.setText("Fetching store from archive.org…")
|
||||||
worker = RemoteStoreScanWorker(transfers.ArchiveOrgSource(self._archive_id, self._archive_sig, self._archive_user))
|
worker = RemoteStoreScanWorker(transfers.ArchiveOrgSource(self._archive_id, self._archive_sig, self._archive_user))
|
||||||
elif self.source_combo.currentIndex() == 3: # NoPayStation
|
elif self.source_combo.currentIndex() == 3: # NoPayStation
|
||||||
ct = ("psp", "psx", "theme", "dlc")[self.nps_type.currentIndex()]
|
ct = ("all", "psp", "psx", "theme", "dlc")[self.nps_type.currentIndex()]
|
||||||
log.info("store: fetching NoPayStation %s list", ct)
|
log.info("store: fetching NoPayStation %s list", ct)
|
||||||
self.status.setText(f"Fetching NoPayStation ({ct.upper()})…")
|
self.status.setText(f"Fetching NoPayStation ({ct.upper()})…")
|
||||||
worker = RemoteStoreScanWorker(transfers.NoPayStationSource(ct, force=force))
|
worker = RemoteStoreScanWorker(transfers.NoPayStationSource(ct, force=force))
|
||||||
@@ -5000,7 +5000,7 @@ class MainWindow(QMainWindow):
|
|||||||
if not self._nps_dir:
|
if not self._nps_dir:
|
||||||
QMessageBox.warning(self, "No NPS output dir", "Set the NoPayStation output dir in Settings → Store.")
|
QMessageBox.warning(self, "No NPS output dir", "Set the NoPayStation output dir in Settings → Store.")
|
||||||
return
|
return
|
||||||
sub = {"psp": "PSP", "psx": "PSX", "theme": "THEME", "dlc": "DLC"}.get(src.content_type, "PSP")
|
sub = {"psp": "PSP", "psx": "PSX", "theme": "THEME", "dlc": "DLC"}.get(it.get("content_type") or src.content_type, "PSP")
|
||||||
dest_dir = Path(self._nps_dir) / sub
|
dest_dir = Path(self._nps_dir) / sub
|
||||||
kind = "nps-download"
|
kind = "nps-download"
|
||||||
else:
|
else:
|
||||||
|
|||||||
+12
-3
@@ -506,11 +506,19 @@ class NoPayStationSource(Source):
|
|||||||
def __init__(self, content_type, tsv_url="", force=False):
|
def __init__(self, content_type, tsv_url="", force=False):
|
||||||
from . import nopaystation
|
from . import nopaystation
|
||||||
self.content_type = content_type
|
self.content_type = content_type
|
||||||
self.tsv_url = tsv_url or nopaystation.tsv_url(content_type)
|
self.tsv_url = tsv_url or ("" if content_type == "all" else nopaystation.tsv_url(content_type))
|
||||||
self.force = force
|
self.force = force
|
||||||
|
|
||||||
def scan(self, root=None):
|
def scan(self, root=None):
|
||||||
from . import nopaystation
|
from . import nopaystation
|
||||||
|
if self.content_type == "all":
|
||||||
|
items = []
|
||||||
|
for ct in ("psp", "psx", "theme", "dlc"):
|
||||||
|
try:
|
||||||
|
items.extend(nopaystation.fetch_items(ct, force=self.force))
|
||||||
|
except Exception: # noqa: BLE001 - skip a source that fails
|
||||||
|
log.warning("could not fetch NoPayStation %s list", ct)
|
||||||
|
return items
|
||||||
return nopaystation.fetch_items(self.content_type, self.tsv_url, force=self.force)
|
return nopaystation.fetch_items(self.content_type, self.tsv_url, force=self.force)
|
||||||
|
|
||||||
def download(self, item, dest_dir, progress_cb=None, cancel_event=None):
|
def download(self, item, dest_dir, progress_cb=None, cancel_event=None):
|
||||||
@@ -520,6 +528,7 @@ class NoPayStationSource(Source):
|
|||||||
|
|
||||||
# The bundled Python decryptor handles PSP/PSX/themes/DLC directly.
|
# The bundled Python decryptor handles PSP/PSX/themes/DLC directly.
|
||||||
title_id = item.get("title_id") or item.get("content_id") or ""
|
title_id = item.get("title_id") or item.get("content_id") or ""
|
||||||
|
item_ct = item.get("content_type") or self.content_type
|
||||||
pkg_name = re.sub(r"[^A-Za-z0-9_-]", "", title_id) or "pkg"
|
pkg_name = re.sub(r"[^A-Za-z0-9_-]", "", title_id) or "pkg"
|
||||||
tmp = Path(tempfile.mkdtemp(prefix="nps-download-"))
|
tmp = Path(tempfile.mkdtemp(prefix="nps-download-"))
|
||||||
pkg = tmp / f"{pkg_name}.pkg"
|
pkg = tmp / f"{pkg_name}.pkg"
|
||||||
@@ -527,10 +536,10 @@ class NoPayStationSource(Source):
|
|||||||
if progress_cb is not None:
|
if progress_cb is not None:
|
||||||
progress_cb("Downloading", 0.0, "")
|
progress_cb("Downloading", 0.0, "")
|
||||||
download_url(item["pkg_url"], pkg, None, progress_cb, cancel_event)
|
download_url(item["pkg_url"], pkg, None, progress_cb, cancel_event)
|
||||||
kind_hint = self.content_type if self.content_type in ("theme", "dlc") else None
|
kind_hint = item_ct if item_ct in ("theme", "dlc") else None
|
||||||
folder = nopaystation.extract_pkg(pkg, title_id, dest_dir,
|
folder = nopaystation.extract_pkg(pkg, title_id, dest_dir,
|
||||||
kind_hint, progress_cb, cancel_event)
|
kind_hint, progress_cb, cancel_event)
|
||||||
if self.content_type in ("theme", "dlc"):
|
if item_ct in ("theme", "dlc"):
|
||||||
_write_sidecar(folder, item)
|
_write_sidecar(folder, item)
|
||||||
return folder
|
return folder
|
||||||
finally:
|
finally:
|
||||||
|
|||||||
Reference in New Issue
Block a user