about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-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')
id='n132' href='#n132'>132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156