From 49dacb600e9819b4da6cc5490e14042d13975957 Mon Sep 17 00:00:00 2001 From: "Kartik K. Agaram" Date: Tue, 10 Aug 2021 04:28:44 -0700 Subject: . --- browse_slack/convert_slack.py | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) (limited to 'browse_slack') 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'])})") -- cgit 1.4.1-2-gfad0