stuff
This commit is contained in:
parent
4f5920866a
commit
cf83bbab73
|
@ -228,18 +228,22 @@ async def _upload_worker():
|
||||||
is_big = total_size > size_limit
|
is_big = total_size > size_limit
|
||||||
files_sent = size_sent = 0
|
files_sent = size_sent = 0
|
||||||
messages = []
|
messages = []
|
||||||
file = bopen(video_filename, size_limit)
|
file = bopen(video_filename, None)
|
||||||
while total_size > 0:
|
while total_size > 0:
|
||||||
|
file.capped_size = None
|
||||||
file.seek(size_sent)
|
file.seek(size_sent)
|
||||||
|
file.capped_size = size_limit
|
||||||
if is_big:
|
if is_big:
|
||||||
file.name = f'{base_filename}.part{str(files_sent).rjust(2, "0")}'
|
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)
|
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)
|
message = await client.send_file(config['config']['storage_chat_id'], file, caption=file.name, parse_mode=None)
|
||||||
total_size -= message.document.size
|
total_size -= message.document.size
|
||||||
if total_size > 0:
|
if total_size > 0:
|
||||||
size_sent += message.document.size
|
size_sent += message.document.size
|
||||||
files_sent += 1
|
files_sent += 1
|
||||||
file = bopen(video_filename, size_limit)
|
file = bopen(video_filename, None)
|
||||||
if messages:
|
if messages:
|
||||||
await client.delete_messages(config['config']['storage_chat_id'], messages)
|
await client.delete_messages(config['config']['storage_chat_id'], messages)
|
||||||
finally:
|
finally:
|
||||||
|
|
Loading…
Reference in New Issue