Skip to content

Commit

Permalink
Fixup. Format code with Black
Browse files Browse the repository at this point in the history
  • Loading branch information
github-actions committed Sep 25, 2023
1 parent 21497cb commit 72518c0
Show file tree
Hide file tree
Showing 6 changed files with 28 additions and 49 deletions.
21 changes: 13 additions & 8 deletions pod/import_video/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ def manage_recording_url(source_url, video_file_add):
url.netloc,
bbb_playback_video,
recording_id,
video_file_add
video_file_add,
)
else:
# 2nd case (BBB URL standard without token)
Expand Down Expand Up @@ -217,10 +217,12 @@ def download_video_file(session, source_video_url, dest_file):
# Can be useful to debug
# print(session.cookies.get_dict())
if response.status_code != 200:
raise ValueError(_(
"The video file for this recording "
"was not found on the BBB server."
))
raise ValueError(
_(
"The video file for this recording "
"was not found on the BBB server."
)
)

with open(dest_file, "wb+") as file:
# Total size, in bytes, from response header
Expand Down Expand Up @@ -417,8 +419,11 @@ def get_duration(self):

def to_json(self):
"""Return recording data (without uploadedToPodBy) in JSON format."""
exclusion_list = ['uploadedToPodBy']
exclusion_list = ["uploadedToPodBy"]
return json.dumps(
{key: value for key, value in self.__dict__.items()
if key not in exclusion_list}
{
key: value
for key, value in self.__dict__.items()
if key not in exclusion_list
}
)
7 changes: 1 addition & 6 deletions pod/import_video/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -477,12 +477,7 @@ def upload_bbb_recording_to_pod(request, record_id):
)

# Step 3: Download the video file
source_video_url = manage_download(
session,
source_url,
video_file_add,
dest_file
)
source_video_url = manage_download(session, source_url, video_file_add, dest_file)

# Step 4: Save informations about the recording
recording_title = request.POST.get("recording_name")
Expand Down
9 changes: 6 additions & 3 deletions pod/meeting/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -955,9 +955,12 @@ def get_all_meetings():

def get_recordings_absolute_url(self):
"""Get recordings list absolute URL."""
return reverse("meeting:internal_recordings", args=[
str(self.meeting_id),
])
return reverse(
"meeting:internal_recordings",
args=[
str(self.meeting_id),
],
)

def get_recordings_full_url(self, request=None):
"""Get recordings list full URL."""
Expand Down
6 changes: 1 addition & 5 deletions pod/meeting/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,7 @@
views.internal_recording,
name="internal_recording",
),
path(
"recording_ready/",
views.recording_ready,
name="recording_ready"
),
path("recording_ready/", views.recording_ready, name="recording_ready"),
]

urlpatterns += [
Expand Down
15 changes: 3 additions & 12 deletions pod/meeting/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,12 +95,8 @@ def send_email_recording_ready(meeting):

subject = "[%s] %s" % (
TEMPLATE_VISIBLE_SETTINGS.get("TITLE_SITE"),
_(
"A new Big Blue Button recording for '%(name)s' meeting is available"
)
% {
"name": meeting.name
},
_("A new Big Blue Button recording for '%(name)s' meeting is available")
% {"name": meeting.name},
)

from_email = DEFAULT_FROM_EMAIL
Expand Down Expand Up @@ -128,12 +124,7 @@ def send_email_recording_ready(meeting):

text_message = bleach.clean(html_message, tags=[], strip=True)

msg = EmailMultiAlternatives(
subject,
text_message,
from_email,
to_email
)
msg = EmailMultiAlternatives(subject, text_message, from_email, to_email)
msg.attach_alternative(html_message, "text/html")

if DEBUG:
Expand Down
19 changes: 4 additions & 15 deletions pod/meeting/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -1228,12 +1228,7 @@ def upload_bbb_recording_to_pod(request, record_id, meeting_id):
)

# Step 3: Download the video file
source_video_url = manage_download(
session,
source_url,
video_file_add,
dest_file
)
source_video_url = manage_download(session, source_url, video_file_add, dest_file)

# Step 4: Save informations about the recording
recording_title = request.POST.get("recording_name")
Expand Down Expand Up @@ -1292,9 +1287,7 @@ def recording_ready(request):
# Decoded parameters with BBB secret key
# Returns JSON format like : {'meeting_id': 'xxx', 'record_id': 'xxx'}
decoded_parameters = jwt.decode(
signed_parameters,
BBB_SECRET_KEY,
algorithms=['HS256']
signed_parameters, BBB_SECRET_KEY, algorithms=["HS256"]
)
# Get data
meeting_id = decoded_parameters["meeting_id"]
Expand All @@ -1310,11 +1303,7 @@ def recording_ready(request):
return HttpResponse()
except Exception as exc:
log.error(
"Error when check for recording (%s %s) ready URL: %s. %s" % (
meeting_id,
recording_id,
mark_safe(str(exc)),
traceback.format_exc()
)
"Error when check for recording (%s %s) ready URL: %s. %s"
% (meeting_id, recording_id, mark_safe(str(exc)), traceback.format_exc())
)
return HttpResponse()

0 comments on commit 72518c0

Please sign in to comment.