minor fix
Browse files
App/Transcription/TranscriptionRoutes.py
CHANGED
@@ -18,7 +18,13 @@ transcription_router = APIRouter(tags=["Transcription"])
|
|
18 |
|
19 |
|
20 |
@transcription_router.get("/download-audio")
|
21 |
-
async def download_audio(
|
|
|
|
|
|
|
|
|
|
|
|
|
22 |
ydl_opts = {
|
23 |
"format": "bestaudio/best",
|
24 |
"postprocessors": [
|
@@ -31,6 +37,9 @@ async def download_audio(url: str):
|
|
31 |
"outtmpl": os.path.join(tempfile.gettempdir(), "%(title)s.%(ext)s"),
|
32 |
}
|
33 |
task = downloadfile.delay(url, ydl_opts)
|
|
|
|
|
|
|
34 |
return {
|
35 |
"task_id": task.id,
|
36 |
}
|
|
|
18 |
|
19 |
|
20 |
@transcription_router.get("/download-audio")
|
21 |
+
async def download_audio(
|
22 |
+
url: str,
|
23 |
+
userId: int = 1,
|
24 |
+
):
|
25 |
+
user = await User.objects.filter(id=userId).first()
|
26 |
+
if user == None:
|
27 |
+
return {"code": 400, "message": "doesn't exist", "payload": None}
|
28 |
ydl_opts = {
|
29 |
"format": "bestaudio/best",
|
30 |
"postprocessors": [
|
|
|
37 |
"outtmpl": os.path.join(tempfile.gettempdir(), "%(title)s.%(ext)s"),
|
38 |
}
|
39 |
task = downloadfile.delay(url, ydl_opts)
|
40 |
+
transcription_enrty = await Transcriptions.objects.create(
|
41 |
+
task_id=task.id, user=user
|
42 |
+
)
|
43 |
return {
|
44 |
"task_id": task.id,
|
45 |
}
|