mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-08-02 11:10:18 +03:00
added gracefully handling older versions of Hachoir
This commit is contained in:
parent
c706154509
commit
a97dac7e0b
|
@ -805,8 +805,9 @@ def is_gif(file):
|
|||
|
||||
def is_audio(file):
|
||||
"""Returns `True` if the file has an audio mime type."""
|
||||
filename = 'a' + _get_extension(file)
|
||||
if filename == 'a':
|
||||
ext = _get_extension(file)
|
||||
filename = 'a' + ext
|
||||
if not ext:
|
||||
metadata = _get_metadata(file)
|
||||
if metadata and metadata.has('mime_type'):
|
||||
return metadata.get('mime_type').startswith('audio/')
|
||||
|
@ -818,8 +819,9 @@ def is_audio(file):
|
|||
|
||||
def is_video(file):
|
||||
"""Returns `True` if the file has a video mime type."""
|
||||
filename = 'a' + _get_extension(file)
|
||||
if filename == 'a':
|
||||
ext = _get_extension(file)
|
||||
filename = 'a' + ext
|
||||
if not ext:
|
||||
metadata = _get_metadata(file)
|
||||
if metadata and metadata.has('mime_type'):
|
||||
return metadata.get('mime_type').startswith('video/')
|
||||
|
|
Loading…
Reference in New Issue
Block a user