|
|
|
@ -86,6 +86,7 @@ class Cast(wx.Frame):
|
|
|
|
|
self.m_chromecasts, self.m_browser = pychromecast.get_chromecasts()
|
|
|
|
|
|
|
|
|
|
def get_player_controls(self, channel_index: int, uri: str) -> wx.BoxSizer:
|
|
|
|
|
outer_sizer = wx.BoxSizer(wx.VERTICAL)
|
|
|
|
|
inner_sizer = wx.BoxSizer(wx.HORIZONTAL)
|
|
|
|
|
play_button = wx.Button(self.m_panel,
|
|
|
|
|
-1,
|
|
|
|
@ -104,8 +105,8 @@ class Cast(wx.Frame):
|
|
|
|
|
if self.m_mode == 'normal':
|
|
|
|
|
back_button = wx.Button(self.m_panel,
|
|
|
|
|
-1,
|
|
|
|
|
"Back",
|
|
|
|
|
size=(WIDTH / 4, BTN_HEIGHT))
|
|
|
|
|
"Go Back",
|
|
|
|
|
size=(WIDTH, BTN_HEIGHT))
|
|
|
|
|
back_button.Bind(
|
|
|
|
|
wx.EVT_BUTTON,
|
|
|
|
|
lambda event, cindex=channel_index: self.show_video_list(
|
|
|
|
@ -115,12 +116,12 @@ class Cast(wx.Frame):
|
|
|
|
|
back_button = wx.Button(self.m_panel,
|
|
|
|
|
-1,
|
|
|
|
|
label="Close",
|
|
|
|
|
size=(WIDTH / 4, BTN_HEIGHT))
|
|
|
|
|
size=(WIDTH, BTN_HEIGHT))
|
|
|
|
|
back_button.Bind(wx.EVT_BUTTON, lambda event: self.Destroy())
|
|
|
|
|
outer_sizer.Add(back_button, FLAGS)
|
|
|
|
|
inner_sizer.Add(play_button, FLAGS)
|
|
|
|
|
inner_sizer.Add(pause_button, FLAGS)
|
|
|
|
|
inner_sizer.Add(stop_button, FLAGS)
|
|
|
|
|
inner_sizer.Add(back_button, FLAGS)
|
|
|
|
|
|
|
|
|
|
if self.has_usable_chromecasts():
|
|
|
|
|
btm = make_bitmap_from_file(
|
|
|
|
@ -151,10 +152,12 @@ class Cast(wx.Frame):
|
|
|
|
|
play_button.Bind(wx.EVT_BUTTON, self.play)
|
|
|
|
|
pause_button.Bind(wx.EVT_BUTTON, self.pause)
|
|
|
|
|
stop_button.Bind(wx.EVT_BUTTON, self.stop)
|
|
|
|
|
outer_sizer.Add(inner_sizer, FLAGS)
|
|
|
|
|
inner_sizer.Fit(self)
|
|
|
|
|
inner_sizer.Layout()
|
|
|
|
|
outer_sizer.Fit(self)
|
|
|
|
|
outer_sizer.Layout()
|
|
|
|
|
|
|
|
|
|
return inner_sizer
|
|
|
|
|
return outer_sizer
|
|
|
|
|
|
|
|
|
|
def get_providers(self) -> list[ChannelProvider]:
|
|
|
|
|
|
|
|
|
@ -185,7 +188,8 @@ class Cast(wx.Frame):
|
|
|
|
|
channels = list()
|
|
|
|
|
for id in chandict[provider]["channels"]:
|
|
|
|
|
channels.append(SVT.SVT(id))
|
|
|
|
|
svt = ChannelProvider(chandict[provider]["displayname"], channels=channels)
|
|
|
|
|
svt = ChannelProvider(chandict[provider]["displayname"],
|
|
|
|
|
channels=channels)
|
|
|
|
|
providers.append(svt)
|
|
|
|
|
|
|
|
|
|
return providers
|
|
|
|
@ -202,15 +206,13 @@ class Cast(wx.Frame):
|
|
|
|
|
break
|
|
|
|
|
return result
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def show_channel_list(self, _, provider_index) -> None:
|
|
|
|
|
self.m_selected_provider_index = provider_index
|
|
|
|
|
self.m_selected_provider = self.m_providers[provider_index]
|
|
|
|
|
self.m_sizer.Clear(delete_windows=True)
|
|
|
|
|
self.m_sizer = wx.BoxSizer(wx.VERTICAL)
|
|
|
|
|
if len(self.m_providers) > 1:
|
|
|
|
|
back_callback = lambda event: self.show_provider_list(
|
|
|
|
|
event)
|
|
|
|
|
back_callback = lambda event: self.show_provider_list(event)
|
|
|
|
|
self.add_back_button(back_callback)
|
|
|
|
|
else:
|
|
|
|
|
closebtn = wx.Button(self.m_panel,
|
|
|
|
@ -387,7 +389,7 @@ class Cast(wx.Frame):
|
|
|
|
|
self.m_sizer.Add(cancel_btn)
|
|
|
|
|
|
|
|
|
|
for cast in self.m_chromecasts:
|
|
|
|
|
if cast.cast_type == 'audio':
|
|
|
|
|
if cast.cast_type == 'audio':
|
|
|
|
|
continue
|
|
|
|
|
friendly_name = "Unknown Chromecast"
|
|
|
|
|
try:
|
|
|
|
@ -395,9 +397,9 @@ class Cast(wx.Frame):
|
|
|
|
|
except AttributeError:
|
|
|
|
|
friendly_name = cast.cast_info.friendly_name
|
|
|
|
|
btn = wx.Button(self.m_panel,
|
|
|
|
|
id=-1,
|
|
|
|
|
label=friendly_name,
|
|
|
|
|
size=(WIDTH, BTN_HEIGHT))
|
|
|
|
|
id=-1,
|
|
|
|
|
label=friendly_name,
|
|
|
|
|
size=(WIDTH, BTN_HEIGHT))
|
|
|
|
|
btn.Bind(
|
|
|
|
|
wx.EVT_BUTTON,
|
|
|
|
|
lambda event, chromecast=cast, muri=uri, cindex=channel_index:
|
|
|
|
|