mirror of
https://github.com/Dvorinka/SpotifyRecAlg.git
synced 2026-06-04 12:33:03 +00:00
15 lines
271 B
Python
15 lines
271 B
Python
import mimetypes
|
|
|
|
|
|
def guess_mime_type(filename: str):
|
|
"""
|
|
Guess the mime type of a file.
|
|
"""
|
|
type = mimetypes.guess_type(filename)[0]
|
|
|
|
if type is None:
|
|
ext = filename.rsplit(".", maxsplit=1)[-1]
|
|
return f"audio/{ext}"
|
|
|
|
return type
|