mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-07-31 10:19:48 +03:00
fixed issue where is_video returns False for byte array/stream videos
This commit is contained in:
parent
6baa44b9c8
commit
d493ac15b1
|
@ -815,9 +815,16 @@ def is_audio(file):
|
|||
|
||||
|
||||
def is_video(file):
|
||||
"""Returns `True` if the file extension looks like a video file."""
|
||||
file = 'a' + _get_extension(file)
|
||||
return (mimetypes.guess_type(file)[0] or '').startswith('video/')
|
||||
"""Returns `True` if the file has a video mime type."""
|
||||
filename = 'a' + _get_extension(file)
|
||||
if filename == 'a':
|
||||
metadata = _get_metadata(file)
|
||||
if metadata and metadata.has('mime_type'):
|
||||
return metadata.get('mime_type').startswith('video/')
|
||||
else:
|
||||
return False
|
||||
else:
|
||||
return (mimetypes.guess_type(filename)[0] or '').startswith('video/')
|
||||
|
||||
|
||||
def is_list_like(obj):
|
||||
|
|
Loading…
Reference in New Issue
Block a user