Don't persist source information inside items

This commit is contained in:
Tim Van Baak 2023-06-04 15:46:50 -07:00
parent 535f982c2a
commit 31e63611a4
4 changed files with 2 additions and 4 deletions

View File

@ -62,7 +62,6 @@ All encoding is done with UTF-8. If an item cannot be parsed or the exit code of
An item has the following top-level fields:
* `id`: **Required**. A unique identifier within the scope of the feed source.
* `source`: **Automatic**. The source that generated the item. This attribute is automatically populated.
* `created`: **Automatic**. The Unix timestamp at which the item was generated. This attribute is automatically populated.
* `active`: **Automatic**. Whether the item is active. Inactive items are not displayed in channels.
* `title`: The title of the item. If an item has no title, `is` is used as a fallback title.

View File

@ -124,7 +124,7 @@ def _sources_feed(name: str, sources: List[LocalSource], show_hidden: bool):
items=paged_items,
now=int(time.time()),
mdeac=[
{"source": item["source"], "itemid": item["id"]}
{"source": item.source.source_name, "itemid": item["id"]}
for item in paged_items
if "id" in item
],

View File

@ -256,7 +256,7 @@ def cmd_feed(cmd_args):
created_dt = datetime.fromtimestamp(item["created"])
created = created_dt.strftime("%Y-%m-%d %H:%M:%S")
info2 = "{0} {1} {2}".format(
item.get("source", ""), item.get("id", ""), created
item.source.source_name, item.get("id", ""), created
)
print("| {0:<{1}} |".format(info2, width - 4))
print("+" + (width - 2) * "-" + "+")

View File

@ -42,7 +42,6 @@ class Item:
raise KeyError("id")
item = {
"id": fields["id"],
"source": source.source_name,
"created": int(current_time()),
"active": True,
}