From 32f9550be5c2fa09a9e9c47acfd79d56bb1bcb4e Mon Sep 17 00:00:00 2001 From: pictuga Date: Wed, 8 Jan 2014 01:34:40 +0100 Subject: [PATCH] Add "al" (apparent limit) param with value Removes element from rss *after* treatment, useful for slow json API --- morss.py | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/morss.py b/morss.py index 1140bed..952fb4e 100644 --- a/morss.py +++ b/morss.py @@ -123,6 +123,9 @@ class ParseOptions: else: return False + def __contains__(self, key): + return self.options.__contains__(key) + class Cache: """ Light, error-prone caching system. """ def __init__(self, folder, key, persistent=False, dic=False): @@ -587,6 +590,11 @@ def Gather(url, cachePath, options): if not options.proxy: Fill(item, cache, url) + if 'al' in options: + if i+1 > int(options.al): + item.remove() + return + if item.desc and item.content: if options.clip: item.content = item.desc + "

* * *


" + item.content