diff --git a/facebook2wordpress.py b/facebook2wordpress.py index 9e5a1dd..15bdd2a 100644 --- a/facebook2wordpress.py +++ b/facebook2wordpress.py @@ -45,8 +45,8 @@ for c, post in enumerate(data): t = 'gallery' - cmd = "post_id=$(wp post create --porcelain --post_category='Facebook' --post_date='%s' --post_content=%s --post_title='%s')" % ( - str(dt), + cmd = "post_id=$(wp-cli post create --porcelain --post_category='Facebook' --post_date='%s' --post_content=%s --post_title='%s')" % ( + dt.format('YYYY-MM-DD HH:mm:ss'), quote(content), dt.format('YYYY-MM-DD HH:mm') ) @@ -76,6 +76,13 @@ for c, post in enumerate(data): f )) + out.append("wp-cli post update ${post_id} --post_content=%s --post_status='publish' --post_author='4'" % ( + quote("%s\n\n[gallery]" % content) + )) + out.append("wp-cli post update ${post_id} --post_date='%s'" % ( + dt.format('YYYY-MM-DD HH:mm:ss') + )) + if len(out) == 1: continue else: