changing output to self.room_path

This commit is contained in:
manetta 2021-02-17 16:51:52 +01:00
parent 17d71674ae
commit 22944ec0c8

View File

@ -48,7 +48,7 @@ def download(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(output, message.room, media_type) path = os.path.join(self.room_path, message.room, 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)
@ -97,7 +97,7 @@ logbot @uptime: To check how long @logbot has been around
for room in self.rooms: for room in self.rooms:
roomname = str(re.match(r'.*@', room).group()).replace('@','') roomname = str(re.match(r'.*@', room).group()).replace('@','')
output = os.path.join(self.output, roomname) self.room_path = os.path.join(self.output, roomname)
# Check if the room is in the database already # Check if the room is in the database already
if not room in self.db.keys(): if not room in self.db.keys():
@ -107,13 +107,13 @@ logbot @uptime: To check how long @logbot has been around
print('INFO ', f'Added to the database: { room }') print('INFO ', f'Added to the database: { room }')
# Check if the room has an output folder already # Check if the room has an output folder already
if not os.path.exists(output): if not os.path.exists(self.room_path):
os.mkdir(output) os.mkdir(self.room_path)
shutil.copy('stylesheet.css', output) shutil.copy('stylesheet.css', self.room_path)
print('INFO ', f'Created a folder for: { room }') print('INFO ', f'Created a folder for: { room }')
print('INFO ', f'Copied stylesheet.css to: { room }') print('INFO ', f'Copied stylesheet.css to: { room }')
print('INFO ', f'Output folder is set to: { output }') print('INFO ', f'Output folder is set to: { self.output }')
def group(self, message): def group(self, message):