20 Zeilen
578 B
Python
20 Zeilen
578 B
Python
import os
|
|
|
|
FILETYPE_AUDIO = 'audio'
|
|
FILETYPE_IMAGE = 'image'
|
|
FILETYPE_VIDEO = 'video'
|
|
|
|
EXTENTIONS_AUDIO = ['.mp3', ]
|
|
EXTENTIONS_IMAGE = ['.jpg', '.jpeg', '.jpe', '.png', '.tif', '.tiff', '.gif', ]
|
|
EXTENTIONS_VIDEO = ['.avi', '.mpg', '.mpeg', '.mpe', '.mov', '.qt', '.mp4', '.webm', '.ogv', '.flv', '.3gp', ]
|
|
|
|
|
|
def get_filetype(full_path):
|
|
ext = os.path.splitext(full_path.lower())[1]
|
|
if ext in EXTENTIONS_AUDIO:
|
|
return FILETYPE_AUDIO
|
|
elif ext in EXTENTIONS_IMAGE:
|
|
return FILETYPE_IMAGE
|
|
elif ext in EXTENTIONS_VIDEO:
|
|
return FILETYPE_VIDEO
|