Commit 24bbe5ac261810315d4922e0fd0071a403007e34
Make userid configurable
Fix posts' datetimes Output to the right folder for HugoGreg K Nicholson committed on 10/15/2017, 12:34:19 AM
Parent: 3b2f28bf55a5e4e16521028ecddad93b96d90a60
Files changed
conf.py | changed |
scuttleblog.py | changed |
scuttleblog.py | |||
---|---|---|---|
@@ -25,22 +25,22 @@ | |||
25 | 25 … | import json | |
26 | 26 … | import os | |
27 | 27 … | import subprocess | |
28 | 28 … | ||
29 | -userid = '@JoiN9c9+xO0jgu0gg5yflTf+L1peLTBneFHjrKbmcKo=.ed25519' | ||
29 … | +import conf | ||
30 | 30 … | ||
31 | 31 … | def restructure(p): | |
32 | 32 … | post = {} | |
33 | 33 … | post['sequence'] = p['value']['sequence'] | |
34 | 34 … | post['frontmatter'] = {} | |
35 | 35 … | post['frontmatter']['key'] = p['key'] | |
36 | - post['frontmatter']['date'] = datetime.datetime.fromtimestamp(int(p['value']['timestamp'] / 1000), datetime.timezone.utc).strftime('%Y-%m-%dT%H:%M:%S%z') | ||
36 … | + post['frontmatter']['date'] = datetime.datetime.fromtimestamp(int(p['value']['timestamp'] / 1000), datetime.timezone.utc).strftime('%Y-%m-%dT%H:%M:%SZ') | ||
37 | 37 … | post['frontmatter']['sequence'] = p['value']['sequence'] | |
38 | 38 … | post['text'] = p['value']['content']['text'] | |
39 | 39 … | return (post) | |
40 | 40 … | ||
41 | 41 … | def defineFilename(post): | |
42 | - folder = 'output' | ||
42 … | + folder = 'hugo/content/posts' | ||
43 | 43 … | #slug = post['key'].replace('+','-').replace('/','_').replace('=.sha256','') | |
44 | 44 … | slug = str(post['sequence']) | |
45 | 45 … | filetype = 'md' | |
46 | 46 … | return folder + '/' + slug + '.' + filetype | |
@@ -65,6 +65,6 @@ | |||
65 | 65 … | jsonPosts = json.loads(posts) | |
66 | 66 … | for post in jsonPosts: | |
67 | 67 … | writePostFile(restructure(post)) | |
68 | 68 … | ||
69 | -getUserStream(userid) | ||
69 … | +getUserStream(conf.userid) | ||
70 | 70 … |
Built with git-ssb-web