|
|
@ -1,4 +1,5 @@
|
|
|
|
#!/usr/bin/env python3
|
|
|
|
#!/usr/bin/env python3
|
|
|
|
|
|
|
|
import threading
|
|
|
|
import time
|
|
|
|
import time
|
|
|
|
from typing import NewType
|
|
|
|
from typing import NewType
|
|
|
|
|
|
|
|
|
|
|
@ -21,8 +22,11 @@ class Cast(wx.Frame):
|
|
|
|
:param kw:
|
|
|
|
:param kw:
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
super().__init__(*args, **kw)
|
|
|
|
super().__init__(*args, **kw)
|
|
|
|
self.m_chromecasts, self.m_browser = pychromecast.get_chromecasts()
|
|
|
|
|
|
|
|
self.m_index = 0
|
|
|
|
self.m_index = 0
|
|
|
|
|
|
|
|
self.m_chromecast_thr = threading.Thread(target=self.get_chromecasts,
|
|
|
|
|
|
|
|
args=(),
|
|
|
|
|
|
|
|
kwargs={})
|
|
|
|
|
|
|
|
self.m_chromecast_thr.start()
|
|
|
|
self.m_sizer: wx.Sizer = wx.BoxSizer(wx.VERTICAL)
|
|
|
|
self.m_sizer: wx.Sizer = wx.BoxSizer(wx.VERTICAL)
|
|
|
|
self.m_panel: wx.lib.scrolledpanel.ScrolledPanel = scrolled.ScrolledPanel(
|
|
|
|
self.m_panel: wx.lib.scrolledpanel.ScrolledPanel = scrolled.ScrolledPanel(
|
|
|
|
self, -1, style=wx.VSCROLL)
|
|
|
|
self, -1, style=wx.VSCROLL)
|
|
|
@ -32,6 +36,9 @@ class Cast(wx.Frame):
|
|
|
|
self.m_channels: list[ChannelProvider] = [SVT.SVT()]
|
|
|
|
self.m_channels: list[ChannelProvider] = [SVT.SVT()]
|
|
|
|
self.show_list(None)
|
|
|
|
self.show_list(None)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_chromecasts(self):
|
|
|
|
|
|
|
|
self.m_chromecasts, self.m_browser = pychromecast.get_chromecasts()
|
|
|
|
|
|
|
|
|
|
|
|
def show_list(self, _):
|
|
|
|
def show_list(self, _):
|
|
|
|
self.m_sizer.Clear(delete_windows=True)
|
|
|
|
self.m_sizer.Clear(delete_windows=True)
|
|
|
|
self.m_sizer = wx.BoxSizer(wx.VERTICAL)
|
|
|
|
self.m_sizer = wx.BoxSizer(wx.VERTICAL)
|
|
|
@ -133,6 +140,7 @@ class Cast(wx.Frame):
|
|
|
|
|
|
|
|
|
|
|
|
if player_state == "PLAYING":
|
|
|
|
if player_state == "PLAYING":
|
|
|
|
has_played = True
|
|
|
|
has_played = True
|
|
|
|
|
|
|
|
|
|
|
|
break
|
|
|
|
break
|
|
|
|
|
|
|
|
|
|
|
|
if cast.socket_client.is_connected and has_played and player_state != "PLAYING":
|
|
|
|
if cast.socket_client.is_connected and has_played and player_state != "PLAYING":
|
|
|
|