From c0b14eb026f8cf1139a8151da0a1b23df7e3be92 Mon Sep 17 00:00:00 2001 From: Loan Robert Date: Thu, 25 Jul 2024 14:28:12 +0200 Subject: [PATCH 1/3] Add modal to copy direct link to recording --- web/b3desk/models/bbb.py | 19 ++++++++- web/b3desk/templates/meeting/recordings.html | 42 +++++++++++++++++++- 2 files changed, 58 insertions(+), 3 deletions(-) diff --git a/web/b3desk/models/bbb.py b/web/b3desk/models/bbb.py index eb74f8d3..60b03974 100644 --- a/web/b3desk/models/bbb.py +++ b/web/b3desk/models/bbb.py @@ -275,9 +275,26 @@ def get_recordings(self): type = format.find("type").text if type in ("presentation", "video"): data["playbacks"][type] = { - "url": format.find("url").text, + "url": (media_url := format.find("url").text), "images": images, } + if type == "video": + try: + resp = requests.get( + direct_link := media_url + "video-0.m4v" + ) + if resp.status_code == 200: + data["playbacks"][type]["direct_link"] = ( + direct_link + ) + except ( + requests.exceptions.HTTPError, + requests.exceptions.ConnectionError, + ): + current_app.logger.warning( + "No direct recording link for meeting %s", + self.meeting.meetingID, + ) result.append(data) except Exception as exception: current_app.logger.error(exception) diff --git a/web/b3desk/templates/meeting/recordings.html b/web/b3desk/templates/meeting/recordings.html index 9c6a826b..5b786d18 100644 --- a/web/b3desk/templates/meeting/recordings.html +++ b/web/b3desk/templates/meeting/recordings.html @@ -58,9 +58,13 @@

{% if recording.playbacks.get("video") %} - mp4 + {% if recording.playbacks.video.get("direct_link") %} + + {% endif %} {% endif %} - @@ -151,6 +155,40 @@

+ + +
+
+
+
+
+ +
+
+

+ + Partager l'enregistrement de "{{ recording_name }}" +

+ {% if recording.playbacks.get("video") %} + {% if recording.playbacks.video.get("direct_link") %} +
+ + +
+ {% endif %} + {% endif %} +
+
+
+
+
+
+ {% endfor %}
From 089e08c44fbcc969d679ed56b3c37680acee5239 Mon Sep 17 00:00:00 2001 From: Loan Robert Date: Thu, 25 Jul 2024 17:46:40 +0200 Subject: [PATCH 2/3] Fix direct link recording tests --- web/tests/meeting/test_recordings.py | 200 ++++++++++++++------------- web/tests/test_bbb_api_caching.py | 198 +++++++++++++------------- 2 files changed, 203 insertions(+), 195 deletions(-) diff --git a/web/tests/meeting/test_recordings.py b/web/tests/meeting/test_recordings.py index 3530a517..ff548d3e 100644 --- a/web/tests/meeting/test_recordings.py +++ b/web/tests/meeting/test_recordings.py @@ -13,103 +13,103 @@ class Response: content = """ - SUCCESS - - - ffbfc4cc24428694e8b53a4e144f414052431693-1530718721124 - c637ba21adcd0191f48f5c4bf23fab0f96ed5c18 - ffbfc4cc24428694e8b53a4e144f414052431693-1530718721124 - Fred's Room - false - true - published - 1530718721124 - 1530718810456 - 3 - 951067 - - https://bbb-analytics.url - false - c637ba21adcd0191f48f5c4bf23fab0f96ed5c18 - Fred's Room - - - unknown - 0 - false - - 1104836 - - - presentation - https://demo.bigbluebutton.org/playback/presentation/2.0/playback.html?meetingId=ffbfc4cc24428694e8b53a4e144f414052431693-1530718721124 - 7177 - 0 - 1104836 - - - Welcome tohttps://demo.bigbluebutton.org/presentation/ffbfc4cc24428694e8b53a4e144f414052431693-1530718721124/presentation/d2d9a672040fbde2a47a10bf6c37b6a4b5ae187f-1530718721134/thumbnails/thumb-1.png - (this slide left blank for use as a whiteboard)https://demo.bigbluebutton.org/presentation/ffbfc4cc24428694e8b53a4e144f414052431693-1530718721124/presentation/d2d9a672040fbde2a47a10bf6c37b6a4b5ae187f-1530718721134/thumbnails/thumb-2.png - (this slide left blank for use as a whiteboard)https://demo.bigbluebutton.org/presentation/ffbfc4cc24428694e8b53a4e144f414052431693-1530718721124/presentation/d2d9a672040fbde2a47a10bf6c37b6a4b5ae187f-1530718721134/thumbnails/thumb-3.png - - - - - video - https://demo.bigbluebutton.org/podcast/ffbfc4cc24428694e8b53a4e144f414052431693-1530718721124/meeting.mp4 - 0 - 0 - 1104836 - - - - - ffbfc4cc24428694e8b53a4e144f414052431693-1530278898111 - c637ba21adcd0191f48f5c4bf23fab0f96ed5c18 - ffbfc4cc24428694e8b53a4e144f414052431693-1530278898111 - Fred's Room - false - true - published - 1530278898111 - 1530281194326 - 7 - 381530 - - Recording title hand written - Fred's Room - c637ba21adcd0191f48f5c4bf23fab0f96ed5c18 - https://bbb-analytics.url - false - - - unknown - 0 - false - - - - podcast - https://demo.bigbluebutton.org/podcast/ffbfc4cc24428694e8b53a4e144f414052431693-1530278898111/audio.ogg - 0 - 33 - - - presentation - https://demo.bigbluebutton.org/playback/presentation/2.0/playback.html?meetingId=ffbfc4cc24428694e8b53a4e144f414052431693-1530278898111 - 139458 - 33 - - - Welcome tohttps://demo.bigbluebutton.org/presentation/ffbfc4cc24428694e8b53a4e144f414052431693-1530278898111/presentation/d2d9a672040fbde2a47a10bf6c37b6a4b5ae187f-1530278898120/thumbnails/thumb-1.png - (this slide left blank for use as a whiteboard)https://demo.bigbluebutton.org/presentation/ffbfc4cc24428694e8b53a4e144f414052431693-1530278898111/presentation/d2d9a672040fbde2a47a10bf6c37b6a4b5ae187f-1530278898120/thumbnails/thumb-2.png - (this slide left blank for use as a whiteboard)https://demo.bigbluebutton.org/presentation/ffbfc4cc24428694e8b53a4e144f414052431693-1530278898111/presentation/d2d9a672040fbde2a47a10bf6c37b6a4b5ae187f-1530278898120/thumbnails/thumb-3.png - - - - - - + SUCCESS + + + ffbfc4cc24428694e8b53a4e144f414052431693-1530718721124 + c637ba21adcd0191f48f5c4bf23fab0f96ed5c18 + ffbfc4cc24428694e8b53a4e144f414052431693-1530718721124 + Fred's Room + false + true + published + 1530718721124 + 1530718810456 + 3 + 951067 + + https://bbb-analytics.url + false + c637ba21adcd0191f48f5c4bf23fab0f96ed5c18 + Fred's Room + + + unknown + 0 + false + + 1104836 + + + presentation + https://demo.bigbluebutton.org/playback/presentation/2.0/playback.html?meetingId=ffbfc4cc24428694e8b53a4e144f414052431693-1530718721124 + 7177 + 0 + 1104836 + + + Welcome tohttps://demo.bigbluebutton.org/presentation/ffbfc4cc24428694e8b53a4e144f414052431693-1530718721124/presentation/d2d9a672040fbde2a47a10bf6c37b6a4b5ae187f-1530718721134/thumbnails/thumb-1.png + (this slide left blank for use as a whiteboard)https://demo.bigbluebutton.org/presentation/ffbfc4cc24428694e8b53a4e144f414052431693-1530718721124/presentation/d2d9a672040fbde2a47a10bf6c37b6a4b5ae187f-1530718721134/thumbnails/thumb-2.png + (this slide left blank for use as a whiteboard)https://demo.bigbluebutton.org/presentation/ffbfc4cc24428694e8b53a4e144f414052431693-1530718721124/presentation/d2d9a672040fbde2a47a10bf6c37b6a4b5ae187f-1530718721134/thumbnails/thumb-3.png + + + + + video + https://demo.bigbluebutton.org/podcast/ffbfc4cc24428694e8b53a4e144f414052431693-1530718721124/meeting.mp4 + 0 + 0 + 1104836 + + + + + ffbfc4cc24428694e8b53a4e144f414052431693-1530278898111 + c637ba21adcd0191f48f5c4bf23fab0f96ed5c18 + ffbfc4cc24428694e8b53a4e144f414052431693-1530278898111 + Fred's Room + false + true + published + 1530278898111 + 1530281194326 + 7 + 381530 + + Recording title hand written + Fred's Room + c637ba21adcd0191f48f5c4bf23fab0f96ed5c18 + https://bbb-analytics.url + false + + + unknown + 0 + false + + + + podcast + https://demo.bigbluebutton.org/podcast/ffbfc4cc24428694e8b53a4e144f414052431693-1530278898111/audio.ogg + 0 + 33 + + + presentation + https://demo.bigbluebutton.org/playback/presentation/2.0/playback.html?meetingId=ffbfc4cc24428694e8b53a4e144f414052431693-1530278898111 + 139458 + 33 + + + Welcome tohttps://demo.bigbluebutton.org/presentation/ffbfc4cc24428694e8b53a4e144f414052431693-1530278898111/presentation/d2d9a672040fbde2a47a10bf6c37b6a4b5ae187f-1530278898120/thumbnails/thumb-1.png + (this slide left blank for use as a whiteboard)https://demo.bigbluebutton.org/presentation/ffbfc4cc24428694e8b53a4e144f414052431693-1530278898111/presentation/d2d9a672040fbde2a47a10bf6c37b6a4b5ae187f-1530278898120/thumbnails/thumb-2.png + (this slide left blank for use as a whiteboard)https://demo.bigbluebutton.org/presentation/ffbfc4cc24428694e8b53a4e144f414052431693-1530278898111/presentation/d2d9a672040fbde2a47a10bf6c37b6a4b5ae187f-1530278898120/thumbnails/thumb-3.png + + + + + + """ text = "" @@ -117,7 +117,11 @@ class Response: yield mocker.patch("requests.Session.send", return_value=Response) -def test_get_recordings(meeting, bbb_getRecordings_response): +def test_get_recordings(mocker, meeting, bbb_getRecordings_response): + class DirectLinkRecording: + status_code = 200 + + mocker.patch("b3desk.models.bbb.requests.get", return_value=DirectLinkRecording) recordings = meeting.bbb.get_recordings() assert len(recordings) == 2 diff --git a/web/tests/test_bbb_api_caching.py b/web/tests/test_bbb_api_caching.py index df09d831..a8464632 100644 --- a/web/tests/test_bbb_api_caching.py +++ b/web/tests/test_bbb_api_caching.py @@ -36,103 +36,103 @@ class Response: GET_RECORDINGS_RESPONSE = """ - SUCCESS - - - ffbfc4cc24428694e8b53a4e144f414052431693-1530718721124 - c637ba21adcd0191f48f5c4bf23fab0f96ed5c18 - ffbfc4cc24428694e8b53a4e144f414052431693-1530718721124 - Fred's Room - false - true - published - 1530718721124 - 1530718810456 - 3 - 951067 - - https://bbb-analytics.url - false - c637ba21adcd0191f48f5c4bf23fab0f96ed5c18 - Fred's Room - - - unknown - 0 - false - - 1104836 - - - presentation - https://demo.bigbluebutton.org/playback/presentation/2.0/playback.html?meetingId=ffbfc4cc24428694e8b53a4e144f414052431693-1530718721124 - 7177 - 0 - 1104836 - - - Welcome tohttps://demo.bigbluebutton.org/presentation/ffbfc4cc24428694e8b53a4e144f414052431693-1530718721124/presentation/d2d9a672040fbde2a47a10bf6c37b6a4b5ae187f-1530718721134/thumbnails/thumb-1.png - (this slide left blank for use as a whiteboard)https://demo.bigbluebutton.org/presentation/ffbfc4cc24428694e8b53a4e144f414052431693-1530718721124/presentation/d2d9a672040fbde2a47a10bf6c37b6a4b5ae187f-1530718721134/thumbnails/thumb-2.png - (this slide left blank for use as a whiteboard)https://demo.bigbluebutton.org/presentation/ffbfc4cc24428694e8b53a4e144f414052431693-1530718721124/presentation/d2d9a672040fbde2a47a10bf6c37b6a4b5ae187f-1530718721134/thumbnails/thumb-3.png - - - - - video - https://demo.bigbluebutton.org/podcast/ffbfc4cc24428694e8b53a4e144f414052431693-1530718721124/meeting.mp4 - 0 - 0 - 1104836 - - - - - ffbfc4cc24428694e8b53a4e144f414052431693-1530278898111 - c637ba21adcd0191f48f5c4bf23fab0f96ed5c18 - ffbfc4cc24428694e8b53a4e144f414052431693-1530278898111 - Fred's Room - false - true - published - 1530278898111 - 1530281194326 - 7 - 381530 - - Recording title hand written - Fred's Room - c637ba21adcd0191f48f5c4bf23fab0f96ed5c18 - https://bbb-analytics.url - false - - - unknown - 0 - false - - - - podcast - https://demo.bigbluebutton.org/podcast/ffbfc4cc24428694e8b53a4e144f414052431693-1530278898111/audio.ogg - 0 - 33 - - - presentation - https://demo.bigbluebutton.org/playback/presentation/2.0/playback.html?meetingId=ffbfc4cc24428694e8b53a4e144f414052431693-1530278898111 - 139458 - 33 - - - Welcome tohttps://demo.bigbluebutton.org/presentation/ffbfc4cc24428694e8b53a4e144f414052431693-1530278898111/presentation/d2d9a672040fbde2a47a10bf6c37b6a4b5ae187f-1530278898120/thumbnails/thumb-1.png - (this slide left blank for use as a whiteboard)https://demo.bigbluebutton.org/presentation/ffbfc4cc24428694e8b53a4e144f414052431693-1530278898111/presentation/d2d9a672040fbde2a47a10bf6c37b6a4b5ae187f-1530278898120/thumbnails/thumb-2.png - (this slide left blank for use as a whiteboard)https://demo.bigbluebutton.org/presentation/ffbfc4cc24428694e8b53a4e144f414052431693-1530278898111/presentation/d2d9a672040fbde2a47a10bf6c37b6a4b5ae187f-1530278898120/thumbnails/thumb-3.png - - - - - - + SUCCESS + + + ffbfc4cc24428694e8b53a4e144f414052œ431693-1530718721124 + c637ba21adcd0191f48f5c4bf23fab0f96ed5c18 + ffbfc4cc24428694e8b53a4e144f414052431693-1530718721124 + Fred's Room + false + true + published + 1530718721124 + 1530718810456 + 3 + 951067 + + https://bbb-analytics.url + false + c637ba21adcd0191f48f5c4bf23fab0f96ed5c18 + Fred's Room + + + unknown + 0 + false + + 1104836 + + + presentation + https://demo.bigbluebutton.org/playback/presentation/2.0/playback.html?meetingId=ffbfc4cc24428694e8b53a4e144f414052431693-1530718721124 + 7177 + 0 + 1104836 + + + Welcome tohttps://demo.bigbluebutton.org/presentation/ffbfc4cc24428694e8b53a4e144f414052431693-1530718721124/presentation/d2d9a672040fbde2a47a10bf6c37b6a4b5ae187f-1530718721134/thumbnails/thumb-1.png + (this slide left blank for use as a whiteboard)https://demo.bigbluebutton.org/presentation/ffbfc4cc24428694e8b53a4e144f414052431693-1530718721124/presentation/d2d9a672040fbde2a47a10bf6c37b6a4b5ae187f-1530718721134/thumbnails/thumb-2.png + (this slide left blank for use as a whiteboard)https://demo.bigbluebutton.org/presentation/ffbfc4cc24428694e8b53a4e144f414052431693-1530718721124/presentation/d2d9a672040fbde2a47a10bf6c37b6a4b5ae187f-1530718721134/thumbnails/thumb-3.png + + + + + video + https://demo.bigbluebutton.org/podcast/ffbfc4cc24428694e8b53a4e144f414052431693-1530718721124/meeting.mp4 + 0 + 0 + 1104836 + + + + + ffbfc4cc24428694e8b53a4e144f414052431693-1530278898111 + c637ba21adcd0191f48f5c4bf23fab0f96ed5c18 + ffbfc4cc24428694e8b53a4e144f414052431693-1530278898111 + Fred's Room + false + true + published + 1530278898111 + 1530281194326 + 7 + 381530 + + Recording title hand written + Fred's Room + c637ba21adcd0191f48f5c4bf23fab0f96ed5c18 + https://bbb-analytics.url + false + + + unknown + 0 + false + + + + podcast + https://demo.bigbluebutton.org/podcast/ffbfc4cc24428694e8b53a4e144f414052431693-1530278898111/audio.ogg + 0 + 33 + + + presentation + https://demo.bigbluebutton.org/playback/presentation/2.0/playback.html?meetingId=ffbfc4cc24428694e8b53a4e144f414052431693-1530278898111 + 139458 + 33 + + + Welcome tohttps://demo.bigbluebutton.org/presentation/ffbfc4cc24428694e8b53a4e144f414052431693-1530278898111/presentation/d2d9a672040fbde2a47a10bf6c37b6a4b5ae187f-1530278898120/thumbnails/thumb-1.png + (this slide left blank for use as a whiteboard)https://demo.bigbluebutton.org/presentation/ffbfc4cc24428694e8b53a4e144f414052431693-1530278898111/presentation/d2d9a672040fbde2a47a10bf6c37b6a4b5ae187f-1530278898120/thumbnails/thumb-2.png + (this slide left blank for use as a whiteboard)https://demo.bigbluebutton.org/presentation/ffbfc4cc24428694e8b53a4e144f414052431693-1530278898111/presentation/d2d9a672040fbde2a47a10bf6c37b6a4b5ae187f-1530278898120/thumbnails/thumb-3.png + + + + + + """ @@ -145,7 +145,11 @@ class Response: content = GET_RECORDINGS_RESPONSE text = "" + class DirectLinkRecording: + status_code = 200 + send = mocker.patch("requests.Session.send", return_value=Response) + mocker.patch("b3desk.models.bbb.requests.get", return_value=DirectLinkRecording) assert send.call_count == 0 From 64d6c1e2b677cdd111a41e1905181957bed8d839 Mon Sep 17 00:00:00 2001 From: Loan Robert Date: Wed, 21 Aug 2024 12:04:26 +0200 Subject: [PATCH 3/3] Tidy sharing records button and streaming services --- web/b3desk/settings.py | 17 +++++++++++++++ web/b3desk/templates/meeting/recordings.html | 23 +++++++++++++++----- 2 files changed, 35 insertions(+), 5 deletions(-) diff --git a/web/b3desk/settings.py b/web/b3desk/settings.py index b5848771..facb0c06 100644 --- a/web/b3desk/settings.py +++ b/web/b3desk/settings.py @@ -1051,3 +1051,20 @@ def get_email_whitelist( ENABLE_LASUITENUMERIQUE: Optional[bool] = False """Enable LaSuite numerique homepage style.""" + + VIDEO_STREAMING_LINKS: Optional[dict[str, str]] = {} + """List of streaming service for video sharing.""" + + @field_validator("VIDEO_STREAMING_LINKS", mode="before") + def get_video_streaming_links( + cls, + video_streaming_links: Optional[dict[str, str]], + info: ValidationInfo, + ) -> dict[str, str]: + if not video_streaming_links: + return {} + + if isinstance(video_streaming_links, str): + return json.loads(video_streaming_links) + + return video_streaming_links diff --git a/web/b3desk/templates/meeting/recordings.html b/web/b3desk/templates/meeting/recordings.html index 5b786d18..3d39114a 100644 --- a/web/b3desk/templates/meeting/recordings.html +++ b/web/b3desk/templates/meeting/recordings.html @@ -26,10 +26,12 @@

{% trans %}Renommer l’enregistrement{% endtrans %}

+ {% trans start_date=recording.start_date|dateformat, expiration_date=(recording.end_date+config["RECORDING_DURATION"])|dateformat %} Enregistré le {{ start_date }} - Expire le {{ expiration_date }} {% endtrans %} +
@@ -53,18 +55,19 @@

- - {% if recording.playbacks.get("video") %} + {% if recording.playbacks.video.get("direct_link") %} - {% endif %} {% endif %} -
@@ -171,6 +174,16 @@

Partager l'enregistrement de "{{ recording_name }}"

+

+ Cet enregistrement est conservé temporairement sur ce service. Pour le mettre à disposition de manière pérenne, fournissez ce lien à des services dédiés à la diffusion + {%- if config["VIDEO_STREAMING_LINKS"] -%} + {%- for service, link in config["VIDEO_STREAMING_LINKS"].items() -%} + {{ " tels que " if loop.first else ", " if not loop.last else " ou " }}{{service}} + {%- endfor -%} + {%- endif -%} + . + En cas de diffusion publique, veillez préalablement à obtenir l'autorisation des participants. +

{% if recording.playbacks.get("video") %} {% if recording.playbacks.video.get("direct_link") %}