Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions feediverse.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ def main():
default=os.path.expanduser(DEFAULT_CONFIG_FILE))
parser.add_argument("-d", "--delay", action="store_true",
help="delay randomly from 10 to 30 seconds between each post")
parser.add_argument("-m", "--maximum", action="count",
help="limit number of posts to given number",
default=0)
parser.add_argument("-p", "--dedupe",
help="dedupe against the given tag",
default="", metavar="TAG")
Expand Down Expand Up @@ -113,6 +116,11 @@ def get_feed(feed_url, last_update):
for entry in entries:
yield get_entry(entry)

# Get only maximum number of items in feed, if specified in args
if args.maximum > 0:
max = min(args.maximum, len(entries)):
entries = entries[:max]

def update_dupes(dupes, new):
if len(dupes) > 10:
del dupes[0]
Expand Down