Nekmo / telegram-upload

Upload and download files from Telegram up to 4 GiB using your account
MIT License
1.1k stars 238 forks source link

ValueError: Metadata has no value 'width' (index 0) #237

Open Aikanairo opened 1 year ago

Aikanairo commented 1 year ago

Description

hi nekmo, when uploading my video files it often gives me this error:

ValueError: Metadata has no value 'width' (index 0)

and skips the file, moving on to the next one

What I Did

I use your wonderful script for a maximum upload through one of my scripts. I'll send you the composition of the command, but this does not generate an error. The error depends on the file you upload

command = f'/telegram-upload-aik/rose/venv/bin/telegram-upload --to {linkcanale} "{file_path}" --caption "{caption}" --print-file-id'

Aikanairo commented 1 year ago

Traceback (most recent call last): File "/home/aik/Scrivania/script/telegram-upload-aik/rose/venv/bin/telegram-upload", line 8, in sys.exit(upload_cli()) ^^^^^^^^^^^^ File "/home/aik/Scrivania/script/telegram-upload-aik/rose/venv/lib/python3.11/site-packages/telegram_upload/exceptions.py", line 68, in wrap return fn(*args, kwargs) ^^^^^^^^^^^^^^^^^^^ File "/home/aik/Scrivania/script/telegram-upload-aik/rose/venv/lib/python3.11/site-packages/click/core.py", line 1157, in call return self.main(args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/aik/Scrivania/script/telegram-upload-aik/rose/venv/lib/python3.11/site-packages/click/core.py", line 1078, in main rv = self.invoke(ctx) ^^^^^^^^^^^^^^^^ File "/home/aik/Scrivania/script/telegram-upload-aik/rose/venv/lib/python3.11/site-packages/click/core.py", line 1434, in invoke return ctx.invoke(self.callback, ctx.params) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/aik/Scrivania/script/telegram-upload-aik/rose/venv/lib/python3.11/site-packages/click/core.py", line 783, in invoke return __callback(args, kwargs) ^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/aik/Scrivania/script/telegram-upload-aik/rose/venv/lib/python3.11/site-packages/telegram_upload/management.py", line 191, in upload client.send_files(to, files, delete_on_success, print_file_id, forward) File "/home/aik/Scrivania/script/telegram-upload-aik/rose/venv/lib/python3.11/site-packages/telegram_upload/client/telegram_upload_client.py", line 126, in send_files message = self.send_one_file(entity, file, send_as_media, thumb=thumb) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/aik/Scrivania/script/telegram-upload-aik/rose/venv/lib/python3.11/site-packages/telegram_upload/client/telegram_upload_client.py", line 103, in send_one_file message = self._send_file_message(entity, file, thumb, progress) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/aik/Scrivania/script/telegram-upload-aik/rose/venv/lib/python3.11/site-packages/telegram_upload/client/telegram_upload_client.py", line 59, in _send_file_message progress_callback=progress, attributes=file.file_attributes) ^^^^^^^^^^^^^^^^^^^^ File "/home/aik/Scrivania/script/telegram-upload-aik/rose/venv/lib/python3.11/site-packages/telegram_upload/upload_files.py", line 202, in file_attributes return get_file_attributes(self.path) ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ File "/home/aik/Scrivania/script/telegram-upload-aik/rose/venv/lib/python3.11/site-packages/telegram_upload/upload_files.py", line 65, in get_file_attributes (0, video_meta.get('width'))[metadata_has(video_meta, 'width')], ^^^^^^^^^^^^^^^^^^^^^^^ File "/home/aik/Scrivania/script/telegram-upload-aik/rose/venv/lib/python3.11/site-packages/hachoir/metadata/metadata.py", line 81, in get raise ValueError( ValueError: Metadata has no value 'width' (index 0)