diff options
author | Kartik K. Agaram <vc@akkartik.com> | 2021-08-10 04:28:44 -0700 |
---|---|---|
committer | Kartik K. Agaram <vc@akkartik.com> | 2021-08-10 04:28:44 -0700 |
commit | 49dacb600e9819b4da6cc5490e14042d13975957 (patch) | |
tree | f1956627c0e933a2d525cc6b680c91612feea35c /browse_slack | |
parent | 639f89ca42ed8082f6ae60ba7e11fbe0fa6bae1c (diff) | |
download | mu-49dacb600e9819b4da6cc5490e14042d13975957.tar.gz |
.
Diffstat (limited to 'browse_slack')
-rw-r--r-- | browse_slack/convert_slack.py | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/browse_slack/convert_slack.py b/browse_slack/convert_slack.py index ee8de392..4e8fad3e 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 = {channel['id']: channel['name'] for channel in json.load(open('channels.json'))} - def look_up_ppm_image(url): file_root = splitext(basename(urlparse(url).path))[0] filename = f"images/ppm/{file_root}.ppm" @@ -78,8 +76,8 @@ def filenames(dir): if isfile(result): yield result -for dir in channels.values(): - for filename in filenames(dir): +for channel in json.load(open('channels.json')): + for filename in filenames(channel['name']): print(filename) for item in contents(filename): - print(f"({json.dumps(item['name'])} {json.dumps(dir)} {item['by']} {json.dumps(item['contents'])})") + print(f"({json.dumps(item['name'])} {json.dumps(channel['name'])} {item['by']} {json.dumps(item['contents'])})") |