Add more meta information to trove entries
This commit is contained in:
parent
4ada169bbe
commit
bd4d571c95
5 changed files with 80 additions and 7 deletions
|
|
@ -8,6 +8,7 @@ tree serialization respectively.
|
|||
|
||||
from typing import Optional, Self
|
||||
from pathlib import Path
|
||||
import datetime as dt
|
||||
|
||||
from .db import Sqlite3Trove, NOTE_ROOT_ID
|
||||
from .tree import Tree as TreeData
|
||||
|
|
@ -30,6 +31,20 @@ class NoteImpl(Note):
|
|||
def object_id(self) -> int:
|
||||
return self._object_id
|
||||
|
||||
@property
|
||||
def readonly(self) -> bool:
|
||||
return False
|
||||
|
||||
@property
|
||||
def mtime(self) -> dt.datetime:
|
||||
"""Return modification time as Unix timestamp, or None if not set."""
|
||||
return self._db.get_mtime(self._object_id)
|
||||
|
||||
@property
|
||||
def mime(self) -> str:
|
||||
"""Return MIME type, defaulting to generic binary stream."""
|
||||
return "application/octet-stream"
|
||||
|
||||
def get_raw_metadata(self, key: str) -> Optional[bytes]:
|
||||
return self._db.read_metadata(self._object_id, key)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue