Skip to content

Commit f3b8d1b

Browse files
authored
[DONE] Raise aristote failure (#1382)
POD ne traite pas les erreurs qu'il reçoit d'Aristote. Cette PR prévient l'utilisateur que l'enrichissement s'est mal passé. C'est une première étape. Il faudrait sans doute aller plus loin et proposer un nouveau "statut" de l'enrichissement parce que pour l'instant POD laisse penser que l'enrichissement est encore en cours.
1 parent 7188345 commit f3b8d1b

File tree

7 files changed

+106
-41
lines changed

7 files changed

+106
-41
lines changed

pod/ai_enhancement/utils.py

Lines changed: 31 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -253,19 +253,19 @@ def enhancement_is_ready(video: Video) -> bool:
253253
return AIEnhancement.objects.filter(video=video, is_ready=True).exists()
254254

255255

256-
def notify_user(video: Video):
256+
def notify_user(video: Video, success: bool = True):
257257
"""Notify user at the end of enhancement."""
258258
if (
259259
USE_NOTIFICATIONS
260260
and video.owner.owner.accepts_notifications
261261
and PushInformation.objects.filter(user=video.owner).exists()
262262
):
263-
send_notification_enhancement(video)
263+
send_notification_enhancement(video, success)
264264
if EMAIL_ON_ENHANCEMENT_COMPLETION:
265-
send_email_enhancement(video)
265+
send_email_enhancement(video, success)
266266

267267

268-
def send_notification_enhancement(video):
268+
def send_notification_enhancement(video, success: bool = True):
269269
"""Send push notification on video encoding or transcripting completion."""
270270
subject = "[%s] %s" % (
271271
__TITLE_SITE__,
@@ -279,6 +279,14 @@ def send_notification_enhancement(video):
279279
"content_title": video.title,
280280
"site_title": __TITLE_SITE__,
281281
}
282+
if not success:
283+
message = _(
284+
"Something went wrong with AI improvement on “%(content_title)s”."
285+
+ " Suggestions for improvement can’t be available on %(site_title)s."
286+
) % {
287+
"content_title": video.title,
288+
"site_title": __TITLE_SITE__,
289+
}
282290

283291
pwa_notify_user(
284292
video.owner,
@@ -288,30 +296,38 @@ def send_notification_enhancement(video):
288296
)
289297

290298

291-
def send_email_enhancement(video) -> None:
299+
def send_email_enhancement(video, success: bool = True) -> None:
292300
"""Send email notification on video improvement completion."""
293301
if DEBUG:
294-
logger.info("SEND EMAIL ON IA IMPROVEMENT COMPLETION")
302+
logger.info("SEND EMAIL ON AI IMPROVEMENT COMPLETION %s", success)
295303
url_scheme = "https" if SECURE_SSL_REDIRECT else "http"
296304
content_url = "%s:%s" % (url_scheme, video.get_full_url())
297305
subject = "[%s] %s" % (
298306
__TITLE_SITE__,
299-
_("IA improvement #%(content_id)s completed") % {"content_id": video.id},
307+
_("AI improvement #%(content_id)s completed") % {"content_id": video.id},
300308
)
309+
main_text = _(
310+
"AI improvement “%(content_title)s” has been completed"
311+
+ ", and is now available on %(site_title)s."
312+
) % {
313+
"content_title": "<strong>%s</strong>" % video.title,
314+
"site_title": __TITLE_SITE__,
315+
}
316+
if not success:
317+
main_text = _(
318+
"Something went wrong with AI improvement on “%(content_title)s” "
319+
+ " on %(site_title)s."
320+
) % {
321+
"content_title": "<strong>%s</strong>" % video.title,
322+
"site_title": __TITLE_SITE__,
323+
}
301324

302325
html_message = (
303326
'<p>%s</p><p>%s</p><p>%s<br><a href="%s"><i>%s</i></a>\
304327
</p><p>%s</p>'
305328
% (
306329
_("Hello,"),
307-
_(
308-
"IA improvement “%(content_title)s” has been completed"
309-
+ ", and is now available on %(site_title)s."
310-
)
311-
% {
312-
"content_title": "<strong>%s</strong>" % video.title,
313-
"site_title": __TITLE_SITE__,
314-
},
330+
main_text,
315331
_("You will find it here:"),
316332
content_url,
317333
content_url,

pod/ai_enhancement/views.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,7 @@ def toggle_webhook(request: WSGIRequest):
7272
notify_user(enhancement.video)
7373
return JsonResponse({"status": "OK"}, status=200)
7474
else:
75+
notify_user(enhancement.video, success=False)
7576
return JsonResponse(
7677
{"status": "Enhancement has not yet been successfully achieved."},
7778
status=500,
2.74 KB
Binary file not shown.

pod/locale/fr/LC_MESSAGES/django.po

Lines changed: 28 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ msgid ""
55
msgstr ""
66
"Project-Id-Version: Pod\n"
77
"Report-Msgid-Bugs-To: \n"
8-
"POT-Creation-Date: 2025-12-04 12:09+0100\n"
8+
"POT-Creation-Date: 2025-12-16 23:10+0000\n"
99
"PO-Revision-Date: \n"
1010
"Last-Translator: obado <[email protected]>\n"
1111
"Language-Team: Pod Team [email protected]\n"
@@ -428,23 +428,42 @@ msgstr ""
428428

429429
#: pod/ai_enhancement/utils.py
430430
#, python-format
431-
msgid "IA improvement #%(content_id)s completed"
432-
msgstr "Amélioration de l’IA #%(content_id)s est terminée"
431+
msgid ""
432+
"Something went wrong with AI improvement on “%(content_title)s”. Suggestions "
433+
"for improvement can’t be available on %(site_title)s."
434+
msgstr ""
435+
"Une erreur s’est produite sur le traitement par l’IA de "
436+
"« %(content_title)s ». Les suggestions d’amélioration ne peuvent pas être "
437+
"disponibles sur %(site_title)s."
433438

434-
#: pod/ai_enhancement/utils.py pod/live/utils.py pod/meeting/utils.py
435-
#: pod/video_encode_transcript/utils.py
436-
msgid "Hello,"
437-
msgstr "Bonjour,"
439+
#: pod/ai_enhancement/utils.py
440+
#, python-format
441+
msgid "AI improvement #%(content_id)s completed"
442+
msgstr "Amélioration de l’IA #%(content_id)s est terminée"
438443

439444
#: pod/ai_enhancement/utils.py
440445
#, python-format
441446
msgid ""
442-
"IA improvement “%(content_title)s” has been completed, and is now available "
447+
"AI improvement “%(content_title)s” has been completed, and is now available "
443448
"on %(site_title)s."
444449
msgstr ""
445-
"Amélioration de l’IA « %(content_title)s » achevée, elle est maintenant "
450+
"Amélioration par l’IA « %(content_title)s » achevée, elle est maintenant "
446451
"disponible sur %(site_title)s."
447452

453+
#: pod/ai_enhancement/utils.py
454+
#, python-format
455+
msgid ""
456+
"Something went wrong with AI improvement on “%(content_title)s” on "
457+
"%(site_title)s."
458+
msgstr ""
459+
"Une erreur s’est produite sur l’amélioration par l’IA de "
460+
"« %(content_title)s » sur %(site_title)s."
461+
462+
#: pod/ai_enhancement/utils.py pod/live/utils.py pod/meeting/utils.py
463+
#: pod/video_encode_transcript/utils.py
464+
msgid "Hello,"
465+
msgstr "Bonjour,"
466+
448467
#: pod/ai_enhancement/utils.py pod/meeting/utils.py
449468
#: pod/video_encode_transcript/utils.py
450469
msgid "You will find it here:"
937 Bytes
Binary file not shown.

pod/locale/nl/LC_MESSAGES/django.po

Lines changed: 46 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ msgid ""
55
msgstr ""
66
"Project-Id-Version: Pod\n"
77
"Report-Msgid-Bugs-To: \n"
8-
"POT-Creation-Date: 2025-12-04 12:09+0100\n"
8+
"POT-Creation-Date: 2025-12-16 23:10+0000\n"
99
"PO-Revision-Date: 2025-10-09 14:19+0200\n"
1010
"Last-Translator: obado <[email protected]>\n"
1111
"Language-Team: \n"
@@ -413,21 +413,35 @@ msgstr ""
413413

414414
#: pod/ai_enhancement/utils.py
415415
#, python-format
416-
msgid "IA improvement #%(content_id)s completed"
416+
msgid ""
417+
"Something went wrong with AI improvement on “%(content_title)s”. Suggestions "
418+
"for improvement can’t be available on %(site_title)s."
417419
msgstr ""
418420

419-
#: pod/ai_enhancement/utils.py pod/live/utils.py pod/meeting/utils.py
420-
#: pod/video_encode_transcript/utils.py
421-
msgid "Hello,"
421+
#: pod/ai_enhancement/utils.py
422+
#, python-format
423+
msgid "AI improvement #%(content_id)s completed"
422424
msgstr ""
423425

424426
#: pod/ai_enhancement/utils.py
425427
#, python-format
426428
msgid ""
427-
"IA improvement “%(content_title)s” has been completed, and is now available "
429+
"AI improvement “%(content_title)s” has been completed, and is now available "
428430
"on %(site_title)s."
429431
msgstr ""
430432

433+
#: pod/ai_enhancement/utils.py
434+
#, python-format
435+
msgid ""
436+
"Something went wrong with AI improvement on “%(content_title)s” on "
437+
"%(site_title)s."
438+
msgstr ""
439+
440+
#: pod/ai_enhancement/utils.py pod/live/utils.py pod/meeting/utils.py
441+
#: pod/video_encode_transcript/utils.py
442+
msgid "Hello,"
443+
msgstr ""
444+
431445
#: pod/ai_enhancement/utils.py pod/meeting/utils.py
432446
#: pod/video_encode_transcript/utils.py
433447
msgid "You will find it here:"
@@ -1290,6 +1304,11 @@ msgid ""
12901304
"time end values."
12911305
msgstr ""
12921306

1307+
#: pod/completion/permissions/video.py
1308+
#, python-brace-format
1309+
msgid "{func.__name__}: Permission denied for user {current_user.pk}."
1310+
msgstr ""
1311+
12931312
#: pod/completion/templates/contributor/form_contributor.html
12941313
#: pod/completion/templates/document/form_document.html
12951314
#: pod/completion/templates/overlay/form_overlay.html
@@ -6523,6 +6542,13 @@ msgstr ""
65236542
msgid "Private"
65246543
msgstr ""
65256544

6545+
#: pod/playlist/models.py
6546+
#, python-brace-format
6547+
msgid ""
6548+
"Please choose a title between 1 and {__MAX_LENGTH_FOR_PLAYLIST_NAME__} "
6549+
"characters."
6550+
msgstr ""
6551+
65266552
#: pod/playlist/models.py
65276553
msgid ""
65286554
"Selecting this setting causes your playlist to be promoted on the page "
@@ -6729,7 +6755,6 @@ msgstr ""
67296755
#: pod/playlist/templates/playlist/playlist.html
67306756
#: pod/playlist/templates/playlist/playlist_content.html
67316757
#: pod/video/templates/channel/channel.html
6732-
#: pod/video/templates/videos/dashboard.html
67336758
#: pod/video/templates/videos/videos.html
67346759
#: pod/video_search/templates/search/search.html
67356760
#, python-format
@@ -6900,10 +6925,6 @@ msgstr ""
69006925
msgid "The playlist has been deleted."
69016926
msgstr ""
69026927

6903-
#: pod/playlist/views.py
6904-
msgid "Delete the playlist"
6905-
msgstr ""
6906-
69076928
#: pod/playlist/views.py
69086929
#, python-format
69096930
msgid "Edit the playlist “%(pname)s”"
@@ -7292,7 +7313,7 @@ msgstr ""
72927313
msgid "Quizzes"
72937314
msgstr ""
72947315

7295-
#: pod/quiz/models.py pod/quiz/tests/test_models.py
7316+
#: pod/quiz/models.py
72967317
msgid "Quiz of video"
72977318
msgstr ""
72987319

@@ -9293,6 +9314,19 @@ msgstr ""
92939314
msgid "Sort videos"
92949315
msgstr ""
92959316

9317+
#: pod/video/templates/videos/dashboard.html
9318+
#, python-format
9319+
msgid ""
9320+
"\n"
9321+
" %(counter)s video found\n"
9322+
" "
9323+
msgid_plural ""
9324+
"\n"
9325+
" %(counter)s videos found\n"
9326+
" "
9327+
msgstr[0] ""
9328+
msgstr[1] ""
9329+
92969330
#: pod/video/templates/videos/filter_aside.html
92979331
msgid ""
92989332
"The videos on the left are automatically sorted according to the filters "
@@ -10396,10 +10430,5 @@ msgstr ""
1039610430
msgid "Esup-Pod xAPI"
1039710431
msgstr ""
1039810432

10399-
#, fuzzy
10400-
#~| msgid "Encoding"
10401-
#~ msgid "Encoding task"
10402-
#~ msgstr "Videocodering"
10403-
1040410433
#~ msgid "category title"
1040510434
#~ msgstr "categorie titel"
8 Bytes
Binary file not shown.

0 commit comments

Comments
 (0)