diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2021-08-10 04:14:32 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2021-08-10 04:14:32 -0700 |
commit | 0c8f8658614274ddfed3b30051c4840a97132a98 (patch) | |
tree | c40c054bfa933e19bcae20b74e851406077a64d8 | |
parent | 4f236749a2374914411005d18106a945815b6bea (diff) | |
download | mu-0c8f8658614274ddfed3b30051c4840a97132a98.tar.gz |
.
-rw-r--r-- | browse_slack/convert_slack.py | 9 |
1 files changed, 1 insertions, 8 deletions
diff --git a/browse_slack/convert_slack.py b/browse_slack/convert_slack.py index db53cebf..12785b6b 100644 --- a/browse_slack/convert_slack.py +++ b/browse_slack/convert_slack.py @@ -32,8 +32,6 @@ from os import listdir from os.path import isfile, join, basename, splitext from urllib.parse import urlparse -channels = {} - user_id = {} # name -> index items = [] @@ -59,11 +57,7 @@ def load_users(): user_id[user['id']] = length length += 1 -def load_channels(): - stderr.write('loading channels..\n') - with open('channels.json') as f: - for channel in json.load(f): - channels[channel['id']] = channel['name'] +channels = {channel['id']: channel['name'] for channel in json.load(open('channels.json'))} def contents(filename): with open(filename) as f: @@ -92,7 +86,6 @@ def filenames(dir): if isfile(result): yield result -load_channels() load_users() for dir in channels.values(): try: |