mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2025-07-30 17:59:55 +03:00
Update utils.py
This commit is contained in:
parent
efb9c799a2
commit
4ddb19bbcc
|
@ -679,15 +679,27 @@ def get_attributes(file, *, attributes=None, mime_type=None,
|
||||||
|
|
||||||
if is_audio(file):
|
if is_audio(file):
|
||||||
m = _get_metadata(file)
|
m = _get_metadata(file)
|
||||||
if m:
|
if file.endswith(".flac"):
|
||||||
attr_dict[types.DocumentAttributeAudio] = \
|
if m:
|
||||||
types.DocumentAttributeAudio(
|
attr_dict[types.DocumentAttributeAudio] = \
|
||||||
voice=voice_note,
|
types.DocumentAttributeAudio(
|
||||||
title=m.get('title') if m.has('title') else None,
|
voice=voice_note,
|
||||||
performer=m.get('author') if m.has('author') else None,
|
title=m.get('title') if m.has('title') else None,
|
||||||
duration=int(m.get('duration').seconds
|
performer=m.get('artist') if m.has('artist') else None,
|
||||||
if m.has('duration') else 0)
|
duration=int(m.get('duration').seconds
|
||||||
)
|
if m.has('duration') else 0)
|
||||||
|
)
|
||||||
|
else:
|
||||||
|
if m:
|
||||||
|
attr_dict[types.DocumentAttributeAudio] = \
|
||||||
|
types.DocumentAttributeAudio(
|
||||||
|
voice=voice_note,
|
||||||
|
title=m.get('title') if m.has('title') else None,
|
||||||
|
performer=m.get('author') if m.has('author') else None,
|
||||||
|
duration=int(m.get('duration').seconds
|
||||||
|
if m.has('duration') else 0)
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
if not force_document and is_video(file):
|
if not force_document and is_video(file):
|
||||||
m = _get_metadata(file)
|
m = _get_metadata(file)
|
||||||
|
|
Loading…
Reference in New Issue
Block a user