From 85b09abad7804eb567824c7142373d57bba891d1 Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Sat, 23 Feb 2008 23:58:55 +0100 Subject: using new one-file-per-comment --- wordpress-to-dir.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'wordpress-to-dir.py') diff --git a/wordpress-to-dir.py b/wordpress-to-dir.py index f8710df..2c9f17a 100644 --- a/wordpress-to-dir.py +++ b/wordpress-to-dir.py @@ -63,9 +63,8 @@ def write_comment(comment, dir): out += 'timestamp: %s\n' % int(time.mktime(date.timetuple())) return out - d = make_dir(dir + str(comment['id'])) - write_file(d + 'content', comment['content']) - write_file(d + 'metadata', make_metadata()) + write_file(dir + str(comment['id']), + make_metadata() + '\n' + comment['content']) def make_post_key(post): d = post['date'] @@ -87,9 +86,10 @@ def write_post(post, categories, comments): write_file(d + 'content', post['content']) write_file(d + 'content-filtered', post['content_filtered']) write_file(d + 'metadata', make_metadata()) - c = make_dir(d + 'comments') - for comment in comments: - write_comment(comment, c) + if comments: + c = make_dir(d + 'comments') + for comment in comments: + write_comment(comment, c) def main(args): global cxn -- cgit v1.2.3-54-g00ecf