mirror of
https://github.com/aclist/dztui.git
synced 2026-11-05 17:45:10 +01:00
Merge pull request #521 from aclist/feat/last-updated
feat: last updated (patch)
This commit is contained in:
2 files changed
+15
-5
No files matched your search
+5
-3
@@ -1,16 +1,18 @@
|
||||
import logging
|
||||
import re
|
||||
|
||||
from collections.abc import Iterator
|
||||
from datetime import datetime
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
from typing import Any, TYPE_CHECKING
|
||||
from warnings import deprecated
|
||||
|
||||
from dzgui.const.constants import APP_NAME
|
||||
|
||||
logger = logging.getLogger(APP_NAME)
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from collections.abc import Iterator
|
||||
|
||||
|
||||
class ACF:
|
||||
def __init__(self, file: Path) -> None:
|
||||
@@ -43,7 +45,7 @@ class ACF:
|
||||
def dequote(cls, s: str) -> str:
|
||||
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] = {}
|
||||
try:
|
||||
while True:
|
||||
|
||||
+10
-2
@@ -392,13 +392,21 @@ def get_running_app() -> int | None:
|
||||
def get_last_updated(path: Path, appid: int) -> str | None:
|
||||
root_path = get_app_path(path, appid)
|
||||
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:
|
||||
root_path = get_app_path(path, appid)
|
||||
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:
|
||||
|
||||
Reference in new issue
Block a user