Skip to content

Commit

Permalink
Only use meta_groups for mkv videos.
Browse files Browse the repository at this point in the history
  • Loading branch information
Nekmo committed Mar 8, 2019
1 parent d28f7d4 commit eb5255d
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion telegram_upload/files.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ def get_file_attributes(file):
if mime == 'video':
metadata = video_metadata(file)
video_meta = metadata
meta_groups = metadata._MultipleMetadata__groups
meta_groups = None
if hasattr(metadata, '_MultipleMetadata__groups'):
# Is mkv
meta_groups = metadata._MultipleMetadata__groups
if not metadata.has('width') and meta_groups:
video_meta = meta_groups[next(filter(lambda x: x.startswith('video'), meta_groups._key_list))]
attrs.append(DocumentAttributeStreamVideo(
Expand Down

0 comments on commit eb5255d

Please sign in to comment.