From dd9a28977d67d046340c8bcb229d293b5765bea4 Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Sat, 27 Jul 2013 12:22:03 +0200 Subject: update metadata MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- src/featherweight.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'src/featherweight.py') diff --git a/src/featherweight.py b/src/featherweight.py index 83a37e0..82a6e83 100755 --- a/src/featherweight.py +++ b/src/featherweight.py @@ -63,7 +63,23 @@ with touch('%s/feeds' % root) as feeds_flock: for feed in feed['inner']: update_feed(feed, if_group) elif (if_group is None) or (feed['group'] == if_group): - pass # TODO update feed + uuid = feed['uuid'] + with touch('%s/%s' % (root, uuid)) as feed_flock: + flock(feed_flock, True) + feed_info = None + with open('%s/%s' % (root, uuid), 'rb') as file: + feed_info = file.read().decode('utf-8', 'error') + feed_info = eval(feed_info) + have = feed_info['have'] + unread = feed_info['unread'] + + ## TODO update feed + + feed['new'] = len(unread) + with open('%s/%s' % (root, uuid), 'wb') as file: + file.write(str(feed_info).decode('utf-8')) + file.flush() + unflock(feed_flock) for feed in feeds: update_feed(feed, group) -- cgit v1.2.3-70-g09d2