mirror of
https://github.com/Abdess/retroarch_system.git
synced 2026-10-20 18:59:07 -05:00
feat: watch the release page of off-forge profiles
About forty profiles describe projects published outside any forge (Altirra, ePSXe, DraStic, mednafen, xroar). profile_sync skipped them as an unsupported host and check_freshness reported the same UNKNOWN line every run, so a new release adding a firmware went unseen. A profile can now name the page announcing its releases and a pattern for the version: --check-version reads it, and check_freshness --profiles calls the profile stale when the page announces another version than core_version.
This commit is contained in:
1 parent
d43aa5354c
commit
282f8d5d0a
7 files changed
+102
No files matched your search
@@ -400,6 +400,26 @@ def _api(
|
||||
return payload
|
||||
|
||||
|
||||
def fetch_page(url: str, cache_dir: str, offline: bool) -> str | None:
|
||||
"""A web page's text, cached like a moving API answer (MOVING_TTL).
|
||||
|
||||
A project published outside a forge (Altirra, mednafen, ePSXe) says its
|
||||
version on a download page: that page is the only release feed there is.
|
||||
"""
|
||||
key = hashlib.sha256(url.encode()).hexdigest()
|
||||
target = Path(cache_dir) / "_pages" / f"{key}.txt"
|
||||
if target.is_file():
|
||||
fresh = time.time() - target.stat().st_mtime <= MOVING_TTL
|
||||
if fresh or offline:
|
||||
raw = target.read_text(encoding="utf-8")
|
||||
return None if raw == ABSENT else raw
|
||||
if offline:
|
||||
return None
|
||||
text = _http_text(url)
|
||||
write_cache(target, ABSENT if text is None else text)
|
||||
return text
|
||||
|
||||
|
||||
def _project(repo: Repo) -> str:
|
||||
return urllib.parse.quote(f"{repo.owner}/{repo.name}", safe="")
|
||||
|
||||
|
||||
Reference in new issue
Block a user