mirror of
https://github.com/kuhyx/steam-backlog-enforcer.git
synced 2026-07-04 13:43:45 +02:00
feat: puzzle solver algorithm
This commit is contained in:
parent
4527879c9f
commit
83f21a9ca2
@ -91,6 +91,8 @@ PROTECTED_APP_IDS = {
|
||||
1493710, # Proton Experimental
|
||||
1161040, # Proton BattlEye Runtime
|
||||
1007020, # Proton EasyAntiCheat Runtime
|
||||
# Games allowed to be installed anytime
|
||||
3949040, # RV There Yet?
|
||||
}
|
||||
|
||||
STEAMAPPS_PATH = Path("~/.local/share/Steam/steamapps").expanduser()
|
||||
@ -1088,10 +1090,15 @@ def _try_reassign_shorter_game(
|
||||
candidates.sort(key=lambda g: g.completionist_hours)
|
||||
if not candidates or candidates[0].app_id == app_id:
|
||||
return False
|
||||
shortest = candidates[0]
|
||||
# Filter out Linux-incompatible games before deciding to reassign.
|
||||
playable = _pick_playable_candidate(
|
||||
[c for c in candidates if c.app_id != app_id],
|
||||
)
|
||||
if playable is None or playable.completionist_hours >= hours:
|
||||
return False
|
||||
_echo(
|
||||
f"\n Reassigning: {shortest.name} is shorter"
|
||||
f" (~{shortest.completionist_hours:.1f}h vs ~{hours:.1f}h)"
|
||||
f"\n Reassigning: {playable.name} is shorter"
|
||||
f" (~{playable.completionist_hours:.1f}h vs ~{hours:.1f}h)"
|
||||
)
|
||||
pick_next_game(all_games, state, config)
|
||||
return True
|
||||
|
||||
@ -62,8 +62,8 @@ class ProtonDBRating:
|
||||
- Its tier is gold but trending to silver or worse.
|
||||
- No data exists (unknown compatibility).
|
||||
"""
|
||||
if not self.tier:
|
||||
return True # No data → don't block; user can skip manually.
|
||||
if not self.tier or self.tier == "pending":
|
||||
return True # No data / pending → don't block; user can skip manually.
|
||||
tier_rank = TIER_ORDER.get(self.tier, 99)
|
||||
min_rank = TIER_ORDER[MIN_PLAYABLE_TIER]
|
||||
|
||||
@ -83,7 +83,10 @@ class ProtonDBRating:
|
||||
def _load_cache() -> dict[str, Any]:
|
||||
"""Load the on-disk ProtonDB cache."""
|
||||
if PROTONDB_CACHE_FILE.exists():
|
||||
return json.loads(PROTONDB_CACHE_FILE.read_text(encoding="utf-8")) # type: ignore[no-any-return]
|
||||
data: dict[str, Any] = json.loads(
|
||||
PROTONDB_CACHE_FILE.read_text(encoding="utf-8"),
|
||||
)
|
||||
return data
|
||||
return {}
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user