|
@ -92,33 +92,13 @@ def download(self, message, logger): |
|
|
|
|
|
|
|
|
# define media_post |
|
|
# define media_post |
|
|
media_path = os.path.join(media_type, filename) |
|
|
media_path = os.path.join(media_type, filename) |
|
|
if message.url.lower().endswith( |
|
|
if message.url.lower().endswith(IMAGE_TYPES): |
|
|
(".jpg", "jpeg", "png", ".gif", ".bmp", ".svg", "eps") |
|
|
|
|
|
): |
|
|
|
|
|
media_post = f'<img src="{ media_path }">' |
|
|
media_post = f'<img src="{ media_path }">' |
|
|
elif message.url.lower().endswith(".pdf"): |
|
|
elif message.url.lower().endswith(FILE_TYPES): |
|
|
media_post = f'<iframe src="{ media_path }" width="800" height="1000"></iframe>' |
|
|
media_post = f'<iframe src="{ media_path }" width="800" height="1000"></iframe>' |
|
|
elif message.url.lower().endswith( |
|
|
elif message.url.lower().endswith(AUDIO_TYPES): |
|
|
(".mp3", ".ogg", ".oga", ".mogg", ".wav", ".m4a", ".webm") |
|
|
|
|
|
): |
|
|
|
|
|
media_post = f'<audio controls src="{ media_path }"></audio>' |
|
|
media_post = f'<audio controls src="{ media_path }"></audio>' |
|
|
elif message.url.lower().endswith( |
|
|
elif message.url.lower().endswith(VIDEO_TYPES): |
|
|
( |
|
|
|
|
|
".mp4", |
|
|
|
|
|
".webm", |
|
|
|
|
|
".flv", |
|
|
|
|
|
".vob", |
|
|
|
|
|
".avi", |
|
|
|
|
|
".mov", |
|
|
|
|
|
".qt", |
|
|
|
|
|
".mpg", |
|
|
|
|
|
".mpeg", |
|
|
|
|
|
".mp4", |
|
|
|
|
|
".m2v", |
|
|
|
|
|
".mpe", |
|
|
|
|
|
".3gp", |
|
|
|
|
|
) |
|
|
|
|
|
): |
|
|
|
|
|
media_post = f'<video controls src="{ media_path }"></video>' |
|
|
media_post = f'<video controls src="{ media_path }"></video>' |
|
|
else: |
|
|
else: |
|
|
media_post = None |
|
|
media_post = None |
|
|