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 Oct 14, 2024
1 parent 0db864d commit ff91b02
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 36 deletions.
13 changes: 2 additions & 11 deletions pod/meeting/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -284,17 +284,8 @@ class LiveGatewayAdmin(admin.ModelAdmin):
admin (ModelAdmin): admin model
"""

list_display = (
"id",
"rtmp_stream_url",
"broadcaster",
"sipmediagw_server_url"
)
list_display = ("id", "rtmp_stream_url", "broadcaster", "sipmediagw_server_url")
list_display_links = ("id",)
ordering = ("-id",)
readonly_fields = []
search_fields = [
"id",
"broadcaster__broadcaster_name",
"sipmediagw_server_url"
]
search_fields = ["id", "broadcaster__broadcaster_name", "sipmediagw_server_url"]
4 changes: 3 additions & 1 deletion pod/meeting/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,9 @@
urlpatterns += [
path("restart_live/<slug:meeting_id>/", views.restart_live, name="restart_live"),
path("end_live/<slug:meeting_id>/", views.end_live, name="end_live"),
path("<slug:meeting_id>/<slug:direct_access>/<slug:room>", views.join, name="join"),
path(
"<slug:meeting_id>/<slug:direct_access>/<slug:room>", views.join, name="join"
),
url(
r"^live_publish_chat/(?P<id>[\d]+)/$",
views.live_publish_chat,
Expand Down
19 changes: 6 additions & 13 deletions pod/meeting/webinar.py
Original file line number Diff line number Diff line change
Expand Up @@ -266,18 +266,15 @@ def toggle_rtmp_gateway(meet_id: int):
# Room used (last 10 characters)
room = meeting.get_hashkey()[-10:]
# Search for the livestream used for this webinar
livestream = Livestream.objects.filter(
meeting=meeting, status=1
).first()
livestream = Livestream.objects.filter(meeting=meeting, status=1).first()
if livestream:
# Toogle URL on SIPMediaGW server
sipmediagw_url = slash_join(
livestream.live_gateway.sipmediagw_server_url, "chat"
)
sipmediagw_url = slash_join(livestream.live_gateway.sipmediagw_server_url, "chat")

# SIPMediaGW toogle request
headers = {
"Authorization": "Bearer %s" % livestream.live_gateway.sipmediagw_server_token,
"Authorization": "Bearer %s"
% livestream.live_gateway.sipmediagw_server_token,
}
params = {"room": room, "toggle": True}
response = requests.get(
Expand Down Expand Up @@ -306,14 +303,10 @@ def chat_rtmp_gateway(meet_id: int, msg: str):
# Room used (last 10 characters)
room = meeting.get_hashkey()[-10:]
# Search for the livestream used for this webinar
livestream = Livestream.objects.filter(
meeting=meeting, status=1
).first()
livestream = Livestream.objects.filter(meeting=meeting, status=1).first()
if livestream:
# Toogle URL on SIPMediaGW server
sipmediagw_url = slash_join(
livestream.live_gateway.sipmediagw_server_url, "chat"
)
sipmediagw_url = slash_join(livestream.live_gateway.sipmediagw_server_url, "chat")

# SIPMediaGW toogle request
headers = {
Expand Down
10 changes: 8 additions & 2 deletions pod/video/tests/test_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,10 @@ def test_regroup_videos_by_theme(self) -> None:
# Ajax request for videos is now in HTML format, not JSON
self.assertEqual(response.context["videos"].paginator.count, 1)
self.assertEqual(response.context["theme"], None)
self.assertTrue(b"id=\"videos_list\" data-nextpage=\"false\" data-countvideos=\"\">" in response.content)
self.assertTrue(
b'id="videos_list" data-nextpage="false" data-countvideos="">'
in response.content
)

# Test ajax request, get only themes from channel view
self.client = Client()
Expand Down Expand Up @@ -191,7 +194,10 @@ def test_regroup_videos_by_theme(self) -> None:
# Ajax request for videos is now in HTML format, not JSON
self.assertEqual(response.context["videos"].paginator.count, 1)
self.assertEqual(response.context["theme"], None)
self.assertTrue(b"id=\"videos_list\" data-nextpage=\"false\" data-countvideos=\"\">" in response.content)
self.assertTrue(
b'id="videos_list" data-nextpage="false" data-countvideos="">'
in response.content
)


class MyChannelsTestView(TestCase):
Expand Down
15 changes: 6 additions & 9 deletions pod/video/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,9 @@ def get_theme_children_as_list(channel: Channel, theme_children: QuerySet) -> li
return children


def _regroup_videos_by_theme(request, videos, page, full_path, channel, theme=None): # noqa: C901
def _regroup_videos_by_theme(
request, videos, page, full_path, channel, theme=None
): # noqa: C901
"""Regroup videos by theme.
Args:
Expand Down Expand Up @@ -327,7 +329,7 @@ def _regroup_videos_by_theme(request, videos, page, full_path, channel, theme=No
"videos": videos,
"theme": theme,
"channel": channel,
"full_path": full_path
"full_path": full_path,
},
)

Expand Down Expand Up @@ -378,12 +380,7 @@ def channel(request, slug_c, slug_t=None):
if ORGANIZE_BY_THEME:
# Specific case
return _regroup_videos_by_theme(
request,
videos_list,
page,
full_path,
channel,
theme
request, videos_list, page, full_path, channel, theme
)

if request.is_ajax():
Expand All @@ -394,7 +391,7 @@ def channel(request, slug_c, slug_t=None):
"channel": channel,
"videos": videos,
"theme": theme,
"full_path": full_path
"full_path": full_path,
},
)
return render(
Expand Down

0 comments on commit ff91b02

Please sign in to comment.