about summary refs log tree commit diff stats
path: root/browse_slack
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2021-08-10 04:51:02 -0700
committerKartik K. Agaram <vc@akkartik.com>2021-08-10 04:51:02 -0700
commit7f972dfc7c433bd0a3cf4a93c8c62bbb392d69b5 (patch)
tree871e1e91f660e9bb2b94d881ee67550329891698 /browse_slack
parentc7d2682aa787b280beb8708288f3e5ca0db1fcd4 (diff)
downloadmu-7f972dfc7c433bd0a3cf4a93c8c62bbb392d69b5.tar.gz
undo my stupid format for post/comment ids
Now items just have a field for parent id.
Diffstat (limited to 'browse_slack')
-rw-r--r--browse_slack/convert_slack.py15
1 files changed, 6 insertions, 9 deletions
diff --git a/browse_slack/convert_slack.py b/browse_slack/convert_slack.py
index ef111130..b3ac3f92 100644
--- a/browse_slack/convert_slack.py
+++ b/browse_slack/convert_slack.py
@@ -50,19 +50,16 @@ with open('users.json') as f:
 def by(item):
     return user_id[item['user']]
 
-def id(item):
-    if 'thread_ts' in item:
-        # comment
-        return f"/{item['thread_ts']}/{item['ts']}"
-    else:
-        # top-level post
-        return                     f"/{item['ts']}"
-
 for channel in json.load(open('channels.json')):
     for filename in sorted(listdir(channel['name'])):
         with open(join(channel['name'], filename)) as f:
             for item in json.load(f):
                 try:
-                    print(f"({json.dumps(id(item))} {json.dumps(channel['name'])} {by(item)} {json.dumps(item['text'])})")
+                    if 'thread_ts' in item:
+                        # comment
+                        print(f"({json.dumps(item['ts'])} {json.dumps(item['thread_ts'])} {json.dumps(channel['name'])} {by(item)} {json.dumps(item['text'])})")
+                    else:
+                        # top-level post
+                        print(f"({json.dumps(item['ts'])} {json.dumps(               '')} {json.dumps(channel['name'])} {by(item)} {json.dumps(item['text'])})")
                 except KeyError:
                     stderr.write(repr(item)+'\n')