Various fixes for chromecasts

main
Micke Nordin 2 years ago
parent fc0a26c74e
commit 60ab02b4ba

@ -122,8 +122,7 @@ class Cast(wx.Frame):
inner_sizer.Add(stop_button, FLAGS)
inner_sizer.Add(back_button, FLAGS)
if not self.m_chromecast_thr.is_alive(
) and not self.m_selected_chromecast:
if self.has_usable_chromecasts():
btm = make_bitmap_from_file(
'{}/assets/Cast.png'.format(self.asset_path), wx.Size(24, 24))
cast_button = wx.BitmapButton(self.m_panel,
@ -191,6 +190,19 @@ class Cast(wx.Frame):
return providers
def has_usable_chromecasts(self) -> bool:
if self.m_chromecast_thr.is_alive():
return False
if self.m_selected_chromecast:
return False
result = False
for cast in self.m_chromecasts:
if cast.cast_type != 'audio':
result = True
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]
@ -375,7 +387,13 @@ class Cast(wx.Frame):
self.m_sizer.Add(cancel_btn)
for cast in self.m_chromecasts:
if cast.cast_type == 'audio':
continue
friendly_name = "Unknown Chromecast"
try:
friendly_name = cast.device.friendly_name
except AttributeError:
friendly_name = cast.cast_info.friendly_name
btn = wx.Button(self.m_panel,
id=-1,
label=friendly_name,

Loading…
Cancel
Save