master
blank X 1 year ago
parent 4f5920866a
commit cf83bbab73
Signed by: blankie
GPG Key ID: CC15FC822C7F61F5
  1. 8
      autoytarchive/workers.py

@ -228,18 +228,22 @@ async def _upload_worker():
is_big = total_size > size_limit
files_sent = size_sent = 0
messages = []
file = bopen(video_filename, size_limit)
file = bopen(video_filename, None)
while total_size > 0:
file.capped_size = None
file.seek(size_sent)
file.capped_size = size_limit
if is_big:
file.name = f'{base_filename}.part{str(files_sent).rjust(2, "0")}'
else:
file.name = base_filename
messages.append((await client.send_message(config['config']['storage_chat_id'], f'Uploading {file.name}...', parse_mode=None)).id)
message = await client.send_file(config['config']['storage_chat_id'], file, caption=file.name, parse_mode=None)
total_size -= message.document.size
if total_size > 0:
size_sent += message.document.size
files_sent += 1
file = bopen(video_filename, size_limit)
file = bopen(video_filename, None)
if messages:
await client.delete_messages(config['config']['storage_chat_id'], messages)
finally:

Loading…
Cancel
Save