Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
SpoCCify Backend
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
SpoCCify
SpoCCify Backend
Commits
f8b007fa
Commit
f8b007fa
authored
2 years ago
by
Falk Rehse
Browse files
Options
Downloads
Patches
Plain Diff
Moved player and frontend to submodules
parent
63b8cd43
No related branches found
No related tags found
No related merge requests found
Pipeline
#118089
failed
2 years ago
Stage: build
Changes
4
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
.gitmodules
+6
-0
6 additions, 0 deletions
.gitmodules
cc-player
+1
-0
1 addition, 0 deletions
cc-player
cc/audio-receiver
+0
-156
0 additions, 156 deletions
cc/audio-receiver
frontend
+1
-0
1 addition, 0 deletions
frontend
with
8 additions
and
156 deletions
.gitmodules
0 → 100644
+
6
−
0
View file @
f8b007fa
[submodule "cc-player"]
path = cc-player
url = git@gitlab.fachschaften.org:spoccify/spoccify-cc-player.git
[submodule "frontend"]
path = frontend
url = git@gitlab.fachschaften.org:spoccify/spoccify-frontend.git
This diff is collapsed.
Click to expand it.
cc-player
@
53617a52
Subproject commit 53617a52534ccd8795277408c0892bda190481f6
This diff is collapsed.
Click to expand it.
cc/audio-receiver
deleted
100644 → 0
+
0
−
156
View file @
63b8cd43
local speaker = peripheral.find("speaker")
local monitor = peripheral.find("monitor")
local args = {...}
tobool={ ["true"]=true, ["false"]=false }
local paused = false
if #args < 2 or #args > 3 then
error("audio-receiver <websocket_url> <authentication_token> [headless]")
end -- if
local headless = true
if #args == 3 then
headless = tobool[args[3]]
end -- if
function eprint(message)
if headless then
print(message)
else
term.redirect(term.native())
print(message)
term.redirect(monitor)
end -- if
end -- eprint
function resetMonitor()
term.redirect(monitor)
term.setBackgroundColour(colours.black)
term.clear()
monitor.setTextScale(0.5)
end --setupMonitor
function inputButton(x1, y1, x2, y2, colour_border, colour_normal, colour_pressed, button_id, togglebutton)
paintutils.drawBox(x1, y1, x2, y2, colour_border)
paintutils.drawFilledBox(x1 + 1, y1 + 1, x2 - 1, y2 - 1, colour_normal)
while true
do
local eventData = {os.pullEvent()}
local event = eventData[1]
if event == "monitor_touch" then
local x = eventData[3]
local y = eventData[4]
if x >= x1 and x <= x2 and y >= y1 and y <= y2
then
os.queueEvent("button_touch", button_id)
if not togglebutton then
paintutils.drawFilledBox(x1 + 1, y1 + 1, x2 - 1, y2 - 1, colour_pressed)
sleep(0.5)
paintutils.drawFilledBox(x1 + 1, y1 + 1, x2 - 1, y2 - 1, colour_normal)
end -- if
end -- if
end -- if
end -- while
end -- monitorInput
local function handle_websocket_audio()
eprint("Trying to connect to websocket server!")
local websocket, error = http.websocket(args[1])
if websocket == false then
eprint(error)
return
end -- if
websocket.send(args[2])
eprint("Connected to websocket server!")
while true do
data, binary = websocket.receive()
if (not binary) then
eprint(data)
break
end -- if
eprint("Playing Sample!")
buffer = {}
for i = 1, string.len(data) do
buffer[i] = string.byte(data, i) - 128
end -- for
if paused then
os.pullEvent("unpause")
end -- if
while not speaker.playAudio(buffer) do
os.pullEvent("speaker_audio_empty")
end -- while
websocket.send("next")
end -- while
eprint("Shutting down!")
os.pullEvent("speaker_audio_empty")
end -- handle_websocket_audio
local function handle_screen()
while true do
local event, button_id = os.pullEvent("button_touch")
if button_id == "play_pause" then
if paused then
eprint("Playing!")
paused = false
os.queueEvent("unpause")
paintutils.drawFilledBox(3 + 1, 2 + 1, 34 - 1, 12 - 1, colours.green)
else
eprint("Stopping!")
paused = true
-- speaker.stop()
paintutils.drawFilledBox(3 + 1, 2 + 1, 34 - 1, 12 - 1, colours.red)
end -- if
elseif button_id == "skip" then
eprint("Skipping!")
end -- if
end -- while
end -- handle_screen
local function button_play_pause()
inputButton(3, 2, 34, 12, colours.white, colours.green, colours.red, "play_pause", true)
end -- button_play_pause
local function button_skip()
inputButton(3, 14, 34, 23, colours.white, colours.yellow, colours.orange, "skip", false)
end -- button_skip
if headless then
eprint("Running headless!")
handle_websocket_audio()
else
eprint("Using 2x2 advanced monitor!")
resetMonitor()
parallel.waitForAny(handle_websocket_audio, handle_screen, button_play_pause, button_skip)
end -- if
eprint("Done!")
This diff is collapsed.
Click to expand it.
frontend
@
e9fda016
Subproject commit e9fda016e59626cd189f7b479838fd722d362550
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