From 63365779e384fb62b7bcba8bf592028cdc2b02cb Mon Sep 17 00:00:00 2001 From: manetta Date: Wed, 17 Feb 2021 17:18:32 +0100 Subject: [PATCH] changing path to roomname (and not include the @muc.vvvvvvaria.org) --- LogBot/logbot.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/LogBot/logbot.py b/LogBot/logbot.py index d880b87..e0abb72 100644 --- a/LogBot/logbot.py +++ b/LogBot/logbot.py @@ -22,7 +22,8 @@ def del_from_db(self, message, key): def write_log(self, message): template = jinja2.Template(open('template.html').read()) - log_path = os.path.join(self.output, message.room, 'index.html') + roomname = re.sub(r'@.*', '', message.room) + log_path = os.path.join(self.output, roomname, 'index.html') with open(log_path,'w') as out: html = template.render(title=self.db[message.room]['title'], db=self.db[message.room]['messages']) out.write(html) @@ -48,7 +49,8 @@ def download(self, message): parsed_url = urlparse(message.url) filename = os.path.basename(parsed_url.path).replace(' ','_').replace('%20','_') # safe url's print('as the file: ', filename) - path = os.path.join(self.output, message.room, media_type) + roomname = re.sub(r'@.*', '', message.room) + path = os.path.join(self.output, roomname, media_type) if not os.path.isdir(path): os.mkdir(path) file_path = os.path.join(path, filename)