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 Feb 3, 2025
1 parent 868fbc0 commit aeab8dc
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 8 deletions.
2 changes: 1 addition & 1 deletion src/tauon/t_modules/t_extra.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ class RadioStation:
country: str
website_url: str
icon: str
stream_url_fallback: str = ""
stream_url_fallback: str

@dataclass
class RadioPlaylist:
Expand Down
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 aeab8dc

Please sign in to comment.