File size: 618 Bytes
72638cd
4ac9f00
6674573
6dc1517
4ac9f00
6dc1517
72638cd
6dc1517
4ac9f00
 
 
fd8d070
6dc1517
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
from App import bot
from fastapi import UploadFile
from App.Transcription.Model import Transcriptions
import subprocess

async def perform_background_task(file_name: str, file: UploadFile, task_id: str):
    data = await bot.send_file(
        -1001925049183, file_size=file.size, caption=file.filename, file=file_name
    )
    # get entry and update
    entry: Transcriptions = await Transcriptions.objects.filter(task_id=task_id).first()
    await entry.update(tl_file_id=str(data.id))


def download_with_wget(link, download_dir, filename):
    subprocess.run(["aria2c", link, "-d", download_dir, "-o", filename])