#!/usr/bin/env python # CFG url = 'http://tinyrss.wahlberg.se/' usr = 'admin' pwd = 'unionen' import sys from ttrss.client import TTRClient def autoconf(): print "yes" def count(): client = TTRClient(url, usr, pwd) client.login() unread = client.get_unread_count() hls = client.get_headlines(feed_id=-3) fresh = 0 for article in hls: fresh = fresh + 1 print "unread.value %s" % unread print "fresh.value %s" % fresh def config(): print """ graph_title Tiny Tiny RSS graph_args -l 0 --base 1000 graph_args --base 1000 graph_vlabel Articles graph_category Apps graph_period second graph_info This graph shows the current number RSS articles for Fredrik unread.label Unread unread.colour 663399 unread.max 10000 unread.min 0 unread.info The number of unread articles. fresh.label Fresh fresh.colour 336600 fresh.max 10000 fresh.min 0 fresh.info The number of articles within the last 24 hrs """ if len(sys.argv) > 1: if sys.argv[1] == "autoconf": autoconf() elif sys.argv[1] == "config": config() else: count()