Browse Source

changing path to roomname (and not include the @muc.vvvvvvaria.org)

master
manetta 4 years ago
parent
commit
63365779e3
  1. 6
      LogBot/logbot.py

6
LogBot/logbot.py

@ -22,7 +22,8 @@ def del_from_db(self, message, key):
def write_log(self, message): def write_log(self, message):
template = jinja2.Template(open('template.html').read()) 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: with open(log_path,'w') as out:
html = template.render(title=self.db[message.room]['title'], db=self.db[message.room]['messages']) html = template.render(title=self.db[message.room]['title'], db=self.db[message.room]['messages'])
out.write(html) out.write(html)
@ -48,7 +49,8 @@ def download(self, message):
parsed_url = urlparse(message.url) parsed_url = urlparse(message.url)
filename = os.path.basename(parsed_url.path).replace(' ','_').replace('%20','_') # safe url's filename = os.path.basename(parsed_url.path).replace(' ','_').replace('%20','_') # safe url's
print('as the file: ', filename) 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): if not os.path.isdir(path):
os.mkdir(path) os.mkdir(path)
file_path = os.path.join(path, filename) file_path = os.path.join(path, filename)

Loading…
Cancel
Save