From d7075889263c6383a9396dc84a35e107375e4cfb Mon Sep 17 00:00:00 2001 From: Wiktor Zykubek Date: Thu, 15 Jun 2023 12:12:17 +0200 Subject: [PATCH] Avoid app crashing after station change --- mainwindow.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/mainwindow.py b/mainwindow.py index e2ecef4..02ab8a0 100644 --- a/mainwindow.py +++ b/mainwindow.py @@ -108,7 +108,12 @@ class MainWindow(QMainWindow): stream_url = f"http://stream.open.fm/{e['id']}" self.__player.setSource(QUrl(stream_url)) - self.togglePlayer() + + # Required to avoid crashing. For some reason if you want to change + # the station for the first time, you need to stop and resume playback. + # If you won't, application would crash. + for _ in range(3): + self.togglePlayer() def togglePlayer(self) -> None: """Toggle playback (play/stop)."""