Browse Source

updating the download path

master
manetta 4 years ago
parent
commit
192dbbc2a7
  1. 6
      LogBot/logbot.py

6
LogBot/logbot.py

@ -53,9 +53,9 @@ 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)
if not os.path.isdir(f'{ message.room }/{ media_type }'): if not os.path.isdir(f'{ output }/{ message.room }/{ media_type }'):
os.mkdir(f'{ message.room }/{ media_type }') os.mkdir(f'{ output }/{ message.room }/{ media_type }')
with open(f'{ message.room }/{ media_type }/{ filename }', 'wb') as media_file: with open(f'{ output }/{ message.room }/{ media_type }/{ filename }', 'wb') as media_file:
media_file.write(data) media_file.write(data)
media_file.close() media_file.close()

Loading…
Cancel
Save