feat: get last updated timestamp

This commit is contained in:
aclist committed 2026-11-01 23:42:06 +09:00
1 parent 46117ecdda
commit e3c1ef59ee
5 files changed
+57 -4

No files matched your search

+23
View File
@@ -2,6 +2,7 @@ import logging
import re
from collections.abc import Iterator
from datetime import date, datetime
from pathlib import Path
from typing import Any
from warnings import deprecated
@@ -69,6 +70,28 @@ class ACF:
except StopIteration:
return acf
def search_key(self, key: str) -> str:
return self.dict["AppState"][key]
def date_to_str(self, epoch: int) -> str | None:
if epoch == 0:
return None
return datetime.fromtimestamp(epoch).isoformat(" ")
def get_date_by_key(self, key: str) -> str | None:
try:
stamp = int(self.search_key(key))
return self.date_to_str(stamp)
except Exception as e:
logger.critical(e)
return None
def get_last_updated(self) -> str | None:
return self.get_date_by_key("LastUpdated")
def get_last_played(self) -> str:
return self.get_date_by_key("LastPlayed")
def get_allows_downloads(self) -> int | None:
try:
# TODO: consider coercing strs to ints on initial import