From 31e63611a43e3f08de4f85daab0f5658738480e1 Mon Sep 17 00:00:00 2001 From: Tim Van Baak Date: Sun, 4 Jun 2023 15:46:50 -0700 Subject: [PATCH] Don't persist source information inside items --- README.md | 1 - intake/app.py | 2 +- intake/cli.py | 2 +- intake/source.py | 1 - 4 files changed, 2 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index 36c6b98..e3718f7 100644 --- a/README.md +++ b/README.md @@ -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. diff --git a/intake/app.py b/intake/app.py index bee5688..60cca9a 100644 --- a/intake/app.py +++ b/intake/app.py @@ -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 ], diff --git a/intake/cli.py b/intake/cli.py index e5cf258..ff55b6f 100644 --- a/intake/cli.py +++ b/intake/cli.py @@ -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) * "-" + "+") diff --git a/intake/source.py b/intake/source.py index 8341622..7fa5153 100755 --- a/intake/source.py +++ b/intake/source.py @@ -42,7 +42,6 @@ class Item: raise KeyError("id") item = { "id": fields["id"], - "source": source.source_name, "created": int(current_time()), "active": True, }