feat: add freshrss openclaw pipeline and clean repo
This commit is contained in:
@@ -16,7 +16,7 @@ FRESHRSS_OUTPUT_ROOT = OUTPUT_ROOT / "freshrss"
|
||||
if str(SRC_ROOT) not in sys.path:
|
||||
sys.path.insert(0, str(SRC_ROOT))
|
||||
|
||||
from summary_mcp.integrations.freshrss import FreshRSSClient, map_entry_to_item
|
||||
from summary_mcp.integrations.freshrss import READ_TAG, FreshRSSClient, map_entry_to_item
|
||||
|
||||
|
||||
def _save_json(path: Path, payload: dict[str, Any] | list[Any]) -> None:
|
||||
@@ -45,6 +45,16 @@ def main() -> None:
|
||||
)
|
||||
parser.add_argument("--limit", type=int, default=10, help="Maximum number of entries to request")
|
||||
parser.add_argument("--continuation", type=str, default=None, help="Continuation token for paging")
|
||||
parser.add_argument(
|
||||
"--include-read",
|
||||
action="store_true",
|
||||
help="Do not exclude items already tagged as read.",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--mark-read",
|
||||
action="store_true",
|
||||
help="Mark fetched entries as read after this script finishes successfully.",
|
||||
)
|
||||
parser.add_argument(
|
||||
"--raw-output",
|
||||
type=Path,
|
||||
@@ -76,6 +86,7 @@ def main() -> None:
|
||||
stream_id=args.stream_id,
|
||||
limit=args.limit,
|
||||
continuation=args.continuation,
|
||||
exclude_targets=[] if args.include_read else [READ_TAG],
|
||||
)
|
||||
|
||||
entries = payload.get("items")
|
||||
@@ -87,8 +98,17 @@ def main() -> None:
|
||||
_save_json(args.raw_output, payload)
|
||||
_save_json(args.items_output, mapped_items)
|
||||
|
||||
marked_count = 0
|
||||
if args.mark_read:
|
||||
item_ids = [entry.get("external_id") for entry in mapped_items if isinstance(entry.get("external_id"), str)]
|
||||
if item_ids:
|
||||
client.mark_items_as_read(auth_token=auth_token, item_ids=item_ids)
|
||||
marked_count = len(item_ids)
|
||||
|
||||
print(f"Saved {len(mapped_items)} mapped items to {args.items_output}")
|
||||
if args.mark_read:
|
||||
print(f"Marked {marked_count} FreshRSS entries as read")
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
main()
|
||||
|
||||
Reference in New Issue
Block a user