Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Syng
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Falk Rehse
Syng
Commits
c74a0d52
Commit
c74a0d52
authored
1 year ago
by
Christoph Stahl
Browse files
Options
Downloads
Patches
Plain Diff
Force to waiting room, but admin can lift to queue
parent
0dd0f32b
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
syng/server.py
+34
-3
34 additions, 3 deletions
syng/server.py
with
34 additions
and
3 deletions
syng/server.py
+
34
−
3
View file @
c74a0d52
...
...
@@ -396,7 +396,38 @@ async def handle_get_first(sid: str) -> None:
await
sio
.
emit
(
"
play
"
,
current
,
room
=
sid
)
async
def
add_song_from_waiting_room
(
room
:
str
)
->
None
:
@sio.on
(
"
waiting-room-to-queue
"
)
async
def
handle_waiting_room_to_queue
(
sid
:
str
,
data
:
dict
[
str
,
Any
])
->
None
:
"""
Handle the
"
waiting-room-to-queue
"
message.
If on an admin-connection, removes a song from the waiting room and appends it to
the queue.
:param sid: The session id of the requesting client
:type sid: str
:rtype: None
"""
async
with
sio
.
session
(
sid
)
as
session
:
room
=
session
[
"
room
"
]
is_admin
=
session
[
"
admin
"
]
state
=
clients
[
room
]
if
is_admin
:
entry
=
next
(
(
wr_entry
for
wr_entry
in
state
.
waiting_room
if
str
(
wr_entry
.
uuid
)
==
data
[
"
uuid
"
]
),
None
,
)
if
entry
is
not
None
:
state
.
waiting_room
.
remove
(
entry
)
await
append_to_queue
(
room
,
entry
,
sid
)
async
def
add_songs_from_waiting_room
(
room
:
str
)
->
None
:
"""
Add all songs from the waiting room, that should be added to the queue.
...
...
@@ -428,7 +459,7 @@ async def discard_first(room: str) -> Entry:
old_entry
=
await
state
.
queue
.
popleft
()
await
add_song_from_waiting_room
(
room
)
await
add_song
s
_from_waiting_room
(
room
)
state
.
recent
.
append
(
old_entry
)
state
.
last_seen
=
datetime
.
datetime
.
now
()
...
...
@@ -817,7 +848,7 @@ async def handle_skip(sid: str, data: dict[str, Any]) -> None:
if
entry
is
not
None
:
logger
.
info
(
"
Skipping %s
"
,
entry
)
await
add_song_from_waiting_room
(
room
)
await
add_song
s
_from_waiting_room
(
room
)
await
state
.
queue
.
remove
(
entry
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment