Skip to content

Commit

Permalink
Add (and query) the Entry read_modified and important_modified attrib…
Browse files Browse the repository at this point in the history
…utes.

For #254.
  • Loading branch information
lemon24 committed Sep 29, 2021
1 parent 454978e commit bcbeb9f
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/reader/_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -1239,7 +1239,9 @@ def make_get_entries_query(
entries.content
entries.enclosures
entries.read
entries.read_modified
entries.important
entries.important_modified
entries.last_updated
entries.original_feed
""".split()
Expand Down Expand Up @@ -1270,9 +1272,11 @@ def entry_factory(t: Tuple[Any, ...]) -> Entry:
tuple(Content(**d) for d in json.loads(t[17])) if t[17] else (),
tuple(Enclosure(**d) for d in json.loads(t[18])) if t[18] else (),
t[19] == 1,
t[20] == 1,
t[21],
t[22] or feed.url,
t[20],
t[21] == 1,
t[22],
t[23],
t[24] or feed.url,
feed,
)
return Entry._make(entry)
Expand Down
14 changes: 14 additions & 0 deletions src/reader/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,9 +230,23 @@ def feed_url(self) -> str:
#: Whether the entry was read or not.
read: bool = False

#: The date when :attr:`read` was last set by the user;
#: :const:`None` if that never happened,
#: or the entry predates the date being recorded.
#:
#: .. versionadded:: 2.2
read_modified: Optional[datetime] = None

#: Whether the entry is important or not.
important: bool = False

#: The date when :attr:`important` was last set by the user;
#: :const:`None` if that never happened,
#: or the entry predates the date being recorded.
#:
#: .. versionadded:: 2.2
important_modified: Optional[datetime] = None

#: The date when the entry was last updated by reader.
#:
#: .. versionadded:: 1.3
Expand Down

0 comments on commit bcbeb9f

Please sign in to comment.