Skip to content

Commit

Permalink
Handle radio websocket better
Browse files Browse the repository at this point in the history
  • Loading branch information
C0rn3j committed Jan 30, 2025
1 parent 868fbc0 commit 931e28e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
4 changes: 2 additions & 2 deletions src/tauon/t_modules/t_main.py
Original file line number Diff line number Diff line change
Expand Up @@ -28191,7 +28191,7 @@ def delete_playlist(index: int, force: bool = False, check_lock: bool = False) -
if gui.radio_view:
del pctl.radio_playlists[index]
if not pctl.radio_playlists:
pctl.radio_playlists = [RadioPlaylist(uid=uid_gen(),name ="Default", stations=[])]
pctl.radio_playlists = [RadioPlaylist(uid=uid_gen(),name="Default", stations=[])]
return

global default_playlist
Expand Down Expand Up @@ -38540,7 +38540,7 @@ def test_show_add_home_music() -> None:
gui.add_music_folder_ready = False
break

def menu_is_open():
def menu_is_open() -> bool:
for menu in Menu.instances:
if menu.active:
return True
Expand Down
6 changes: 1 addition & 5 deletions src/tauon/t_modules/t_stream.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,18 +69,14 @@ def __init__(self, tauon: Tauon) -> None:
self.url = None

def stop(self) -> None:

try:
if self.tauon.radiobox.websocket:
self.tauon.radiobox.websocket.close()
logging.info("Websocket closed")
except Exception:
logging.exception("No socket to close?")

self.abort = True
self.tauon.radiobox.loaded_url = None

def start_download(self, url: str) -> bool:

self.abort = True
while self.download_running:
time.sleep(0.01)
Expand Down

0 comments on commit 931e28e

Please sign in to comment.