import os import json import shlex import asyncio from io import BytesIO from . import config, client, seen_videos async def split_files(filename, destination_dir): args = [ 'split', '--verbose', '--numeric-suffixes=0', '--bytes=2097152000', '--suffix-length=2', filename, os.path.join(destination_dir, os.path.basename(filename)) + '.part' ] proc = await asyncio.create_subprocess_exec(*args, stdout=asyncio.subprocess.PIPE) stdout, _ = await proc.communicate() return shlex.split(' '.join([i[14:] for i in stdout.decode().strip().split('\n')])) async def update_seen_videos(): with BytesIO(json.dumps(seen_videos).encode()) as file: file.name = 'autoytarchive.json' file.seek(0) await client.edit_message(config['config']['storage_chat_id'], config['config']['storage_message_id'], file=file)