summaryrefslogtreecommitdiffstatshomepage
path: root/wordpress-to-dir.py
diff options
context:
space:
mode:
authorGravatar Andy Wingo2008-02-23 23:58:55 +0100
committerGravatar Andy Wingo2008-02-23 23:58:55 +0100
commit85b09abad7804eb567824c7142373d57bba891d1 (patch)
tree62d0aa9f9c7191a32b6ba95547f76762fce860d3 /wordpress-to-dir.py
parent8dbbc023a950bb7206e7a5e077af63f6525ee89e (diff)
downloadtekuti-85b09abad7804eb567824c7142373d57bba891d1.tar.gz
tekuti-85b09abad7804eb567824c7142373d57bba891d1.zip
using new one-file-per-comment
Diffstat (limited to 'wordpress-to-dir.py')
-rw-r--r--wordpress-to-dir.py12
1 files changed, 6 insertions, 6 deletions
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