Skip to content

Commit 35398d2

Browse files
authored
Merge pull request #305 from UniversityRadioYork/mp/fix-showplan-repair
Fix showplan repairing
2 parents 9a831dc + b0e91a9 commit 35398d2

File tree

4 files changed

+15
-16
lines changed

4 files changed

+15
-16
lines changed

.github/workflows/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
id: yarn-cache-dir-path
2323
run: echo "::set-output name=dir::$(yarn cache dir)"
2424

25-
- uses: actions/cache@v1
25+
- uses: actions/cache@v4
2626
id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
2727
with:
2828
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ version = "1.6.0"
44
description = ""
55
authors = ["Marks Polakovs <marks.polakovs@ury.org.uk>", "Matthew Stratford <matthew.stratford@ury.org.uk>"]
66
readme = "README.md"
7+
package-mode = false
78

89
[tool.poetry.dependencies]
910
python = "^3.9.2"

shittyserver.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@
1010
from typing import Optional, Any, Type, Dict, List
1111

1212
import aiohttp
13-
import av # type: ignore
13+
import av
1414
import jack as Jack
1515
from jack import OwnPort
1616
import websockets.exceptions, websockets.server, websockets.connection
17-
from aiortc import MediaStreamTrack, RTCPeerConnection, RTCSessionDescription # type: ignore
18-
from aiortc.mediastreams import MediaStreamError # type: ignore
17+
from aiortc import MediaStreamTrack, RTCPeerConnection, RTCSessionDescription
18+
from aiortc.mediastreams import MediaStreamError
1919
import sentry_sdk
2020

2121
config = configparser.RawConfigParser()
@@ -131,7 +131,7 @@ class NotReadyException(BaseException):
131131

132132

133133
class Session(object):
134-
websocket: Optional[websockets.server.WebSocketServerProtocol]
134+
websocket: Optional[websockets.server.WebSocketServerProtocol] # type: ignore
135135
connection_state: Optional[str]
136136
pc: Optional[Any]
137137
connection_id: str
@@ -194,7 +194,7 @@ async def end(self) -> None:
194194

195195
if (
196196
self.websocket is not None
197-
and self.websocket.state == websockets.connection.State.OPEN
197+
and self.websocket.state == websockets.connection.State.OPEN # type: ignore
198198
):
199199
try:
200200
await self.websocket.send(json.dumps({"kind": "DIED"}))
@@ -225,15 +225,15 @@ def create_peerconnection(self) -> None:
225225
self.pc = RTCPeerConnection()
226226
assert self.pc is not None
227227

228-
@self.pc.on("signalingstatechange") # type: ignore
228+
@self.pc.on("signalingstatechange")
229229
async def on_signalingstatechange() -> None:
230230
assert self.pc is not None
231231
print(
232232
self.connection_id,
233233
"Signaling state is {}".format(self.pc.signalingState),
234234
)
235235

236-
@self.pc.on("iceconnectionstatechange") # type: ignore
236+
@self.pc.on("iceconnectionstatechange")
237237
async def on_iceconnectionstatechange() -> None:
238238
if self.pc is None:
239239
print(
@@ -249,7 +249,7 @@ async def on_iceconnectionstatechange() -> None:
249249
print(self.connection_id, "Ending due to ICE connection failure")
250250
await self.end()
251251

252-
@self.pc.on("track") # type: ignore
252+
@self.pc.on("track")
253253
async def on_track(track: MediaStreamTrack) -> None:
254254
global live_session, transfer_buffer1, transfer_buffer2
255255
print(self.connection_id, "Received track")
@@ -258,7 +258,7 @@ async def on_track(track: MediaStreamTrack) -> None:
258258

259259
await notify_mattserver_about_sessions()
260260

261-
@track.on("ended") # type: ignore
261+
@track.on("ended")
262262
async def on_ended() -> None:
263263
print(
264264
self.connection_id,
@@ -325,7 +325,7 @@ async def process_ice(self, message: Any) -> None:
325325
)
326326

327327
async def connect(
328-
self, websocket: websockets.server.WebSocketServerProtocol
328+
self, websocket: websockets.server.WebSocketServerProtocol # type: ignore
329329
) -> None:
330330
global active_sessions
331331

@@ -369,7 +369,7 @@ async def connect(
369369

370370

371371
async def serve(
372-
websocket: websockets.server.WebSocketServerProtocol, path: str
372+
websocket: websockets.server.WebSocketServerProtocol, path: str # type: ignore
373373
) -> None:
374374
if path == "/stream":
375375
session = Session()
@@ -378,7 +378,7 @@ async def serve(
378378
pass
379379

380380

381-
start_server = websockets.server.serve(
381+
start_server = websockets.server.serve( # type: ignore
382382
serve, host=None, port=int(config.get("shittyserver", "websocket_port"))
383383
)
384384

src/showplanner/state.ts

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -668,9 +668,6 @@ export const getShowplan = (timeslotId: number): AppThunk => async (
668668
}
669669

670670
if (ops.length > 0) {
671-
console.log("Is corrupt, repairing locally");
672-
dispatch(showplan.actions.applyOps(ops));
673-
674671
console.log("Repairing showplan", ops);
675672
const updateResult = await api.updateShowplan(timeslotId, ops);
676673
if (!updateResult.every((x) => x.status)) {
@@ -679,6 +676,7 @@ export const getShowplan = (timeslotId: number): AppThunk => async (
679676
return;
680677
}
681678
}
679+
// This is the fixed plan
682680
dispatch(showplan.actions.getShowplanSuccess(plan.flat(2)));
683681
} catch (e) {
684682
console.error(e);

0 commit comments

Comments
 (0)