Merge pull request #521 from aclist/feat/last-updated

feat: last updated (patch)
This commit is contained in:
aclist authored and GitHub committed 2026-11-05 21:27:57 +09:00
commit fdf92dca40
2 files changed
+15 -5

No files matched your search

+5 -3
View File
@@ -1,16 +1,18 @@
import logging import logging
import re import re
from collections.abc import Iterator
from datetime import datetime from datetime import datetime
from pathlib import Path from pathlib import Path
from typing import Any from typing import Any, TYPE_CHECKING
from warnings import deprecated from warnings import deprecated
from dzgui.const.constants import APP_NAME from dzgui.const.constants import APP_NAME
logger = logging.getLogger(APP_NAME) logger = logging.getLogger(APP_NAME)
if TYPE_CHECKING:
from collections.abc import Iterator
class ACF: class ACF:
def __init__(self, file: Path) -> None: def __init__(self, file: Path) -> None:
@@ -43,7 +45,7 @@ class ACF:
def dequote(cls, s: str) -> str: def dequote(cls, s: str) -> str:
return s.rstrip('"').lstrip('"') return s.rstrip('"').lstrip('"')
def parse(self, lines: Iterator[list[str]]) -> dict[str, str]: def parse(self, lines: "Iterator[list[str]]") -> dict[str, str]:
acf: dict[str, Any] = {} acf: dict[str, Any] = {}
try: try:
while True: while True:
+10 -2
View File
@@ -392,13 +392,21 @@ def get_running_app() -> int | None:
def get_last_updated(path: Path, appid: int) -> str | None: def get_last_updated(path: Path, appid: int) -> str | None:
root_path = get_app_path(path, appid) root_path = get_app_path(path, appid)
acf = root_path.joinpath(f"steamapps/appmanifest_{appid}.acf") acf = root_path.joinpath(f"steamapps/appmanifest_{appid}.acf")
return ACF(acf).get_last_updated() try:
return ACF(acf).get_last_updated()
except Exception as e:
logger.critical(e)
return None
def get_last_played(path: Path, appid: int) -> str | None: def get_last_played(path: Path, appid: int) -> str | None:
root_path = get_app_path(path, appid) root_path = get_app_path(path, appid)
acf = root_path.joinpath(f"steamapps/appmanifest_{appid}.acf") acf = root_path.joinpath(f"steamapps/appmanifest_{appid}.acf")
return ACF(acf).get_last_played() try:
return ACF(acf).get_last_played()
except Exception as e:
logger.critical(e)
return None
def get_app_allows_downloads(path: Path, appid: int) -> bool: def get_app_allows_downloads(path: Path, appid: int) -> bool: