diff options
-rw-r--r-- | hello-fusepy.py | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/hello-fusepy.py b/hello-fusepy.py index 7fc86c1..010ef9d 100644 --- a/hello-fusepy.py +++ b/hello-fusepy.py @@ -3,6 +3,7 @@ import errno import stat import logging import requests +from datetime import datetime as dtp from fuse import ( FUSE, Operations, @@ -16,9 +17,10 @@ api_url = "https://furry.engineer/users/uvok/outbox?min_id=0&page=true" class Status(object): - def __init__(self, id: str, content: str): + def __init__(self, id: str, content: str, published: str): self.id = id self.content = content + self.published = published class HelloWorld(Operations, LoggingMixIn): @@ -37,11 +39,15 @@ class HelloWorld(Operations, LoggingMixIn): } found = next((s for s in self.statuses if "/" + s.id == path), None) if found: + published_dt = dtp.fromisoformat(found.published) + pubunix = published_dt.timestamp() return { "st_mode": (stat.S_IFREG | 0o400), "st_size": len(found.content.encode("utf8")), "st_uid": uid, "st_gid": gid, + "st_ctime": pubunix, + "st_mtime": pubunix, } raise FuseOSError(errno.ENOENT) @@ -51,7 +57,7 @@ class HelloWorld(Operations, LoggingMixIn): stats = res.json() logging.debug(f"Status: ${stats['id']}") self.statuses = [ - Status(s["object"]["id"].split("/")[-1], s["object"]["content"]) + Status(s["object"]["id"].split("/")[-1], s["object"]["content"], s["object"]["published"]) for s in stats["orderedItems"] ] pass |