correction
Browse files
App/Transcription/TranscriptionRoutes.py
CHANGED
@@ -63,8 +63,8 @@ async def download_audio(
|
|
63 |
transcription_enrty = await Transcriptions.objects.create(
|
64 |
user=user, youtubeLink=url, **response
|
65 |
)
|
66 |
-
entry=BaseTranscription(**transcription_enrty.__dict__)
|
67 |
-
return entry
|
68 |
|
69 |
|
70 |
@transcription_router.get("/transcriptions")
|
@@ -83,8 +83,11 @@ async def delete_transcription(
|
|
83 |
task_id: str,
|
84 |
user: UserSchema = Depends(get_token_owner),
|
85 |
):
|
86 |
-
|
87 |
-
|
|
|
|
|
|
|
88 |
await transcript.delete()
|
89 |
task = AsyncResult(task_id)
|
90 |
task.revoke(terminate=True)
|
@@ -135,9 +138,9 @@ async def create_file(
|
|
135 |
@transcription_router.get("/tasks/{task_id}")
|
136 |
async def get_status(task_id):
|
137 |
entry: Transcriptions = await Transcriptions.objects.filter(task_id=task_id).first()
|
138 |
-
if entry==None:
|
139 |
-
return {
|
140 |
-
result =
|
141 |
|
142 |
if result.status == "SUCCESS":
|
143 |
return result
|
@@ -150,11 +153,14 @@ async def get_status(task_id):
|
|
150 |
}
|
151 |
|
152 |
if task_result.status == "SUCCESS":
|
153 |
-
trans =
|
154 |
await entry.update(**trans.dict())
|
155 |
else:
|
156 |
-
|
|
|
|
|
|
|
157 |
await entry.update(**_trans.dict())
|
158 |
|
159 |
-
result =
|
160 |
return result
|
|
|
63 |
transcription_enrty = await Transcriptions.objects.create(
|
64 |
user=user, youtubeLink=url, **response
|
65 |
)
|
66 |
+
entry = BaseTranscription(**transcription_enrty.__dict__)
|
67 |
+
return entry
|
68 |
|
69 |
|
70 |
@transcription_router.get("/transcriptions")
|
|
|
83 |
task_id: str,
|
84 |
user: UserSchema = Depends(get_token_owner),
|
85 |
):
|
86 |
+
transcript = (
|
87 |
+
await Transcriptions.objects.filter(user=user.id)
|
88 |
+
.filter(task_id=task_id)
|
89 |
+
.first()
|
90 |
+
)
|
91 |
await transcript.delete()
|
92 |
task = AsyncResult(task_id)
|
93 |
task.revoke(terminate=True)
|
|
|
138 |
@transcription_router.get("/tasks/{task_id}")
|
139 |
async def get_status(task_id):
|
140 |
entry: Transcriptions = await Transcriptions.objects.filter(task_id=task_id).first()
|
141 |
+
if entry == None:
|
142 |
+
return {"payload": None, "message": "Nothing found", "code": 200}
|
143 |
+
result = BaseTranscription(**entry.__dict__)
|
144 |
|
145 |
if result.status == "SUCCESS":
|
146 |
return result
|
|
|
153 |
}
|
154 |
|
155 |
if task_result.status == "SUCCESS":
|
156 |
+
trans = BaseTranscription(**task_result.result)
|
157 |
await entry.update(**trans.dict())
|
158 |
else:
|
159 |
+
try:
|
160 |
+
_trans = TranscriptionMetadata(**task_result.result)
|
161 |
+
except:
|
162 |
+
return {"payload": None, "message": "Nothing found", "code": 200}
|
163 |
await entry.update(**_trans.dict())
|
164 |
|
165 |
+
result = BaseTranscription(**entry.__dict__)
|
166 |
return result
|