|
|
@ -45,7 +45,8 @@ class Cast(wx.Frame):
|
|
|
|
channels=[YouTube.YouTube('UCu6mSoMNzHQiBIOCkHUa2Aw')])
|
|
|
|
channels=[YouTube.YouTube('UCu6mSoMNzHQiBIOCkHUa2Aw')])
|
|
|
|
]
|
|
|
|
]
|
|
|
|
self.m_selected_channel = None
|
|
|
|
self.m_selected_channel = None
|
|
|
|
self.show_splash(None)
|
|
|
|
self.m_selected_provider_index = None
|
|
|
|
|
|
|
|
self.show_provider_list(None)
|
|
|
|
|
|
|
|
|
|
|
|
def get_chromecasts(self) -> None:
|
|
|
|
def get_chromecasts(self) -> None:
|
|
|
|
"""
|
|
|
|
"""
|
|
|
@ -55,7 +56,7 @@ class Cast(wx.Frame):
|
|
|
|
"""
|
|
|
|
"""
|
|
|
|
self.m_chromecasts, self.m_browser = pychromecast.get_chromecasts()
|
|
|
|
self.m_chromecasts, self.m_browser = pychromecast.get_chromecasts()
|
|
|
|
|
|
|
|
|
|
|
|
def show_splash(self, _) -> None:
|
|
|
|
def show_provider_list(self, _) -> None:
|
|
|
|
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)
|
|
|
|
provider_index = 0
|
|
|
|
provider_index = 0
|
|
|
@ -75,9 +76,14 @@ class Cast(wx.Frame):
|
|
|
|
self.m_panel.Layout()
|
|
|
|
self.m_panel.Layout()
|
|
|
|
|
|
|
|
|
|
|
|
def show_channel_list(self, _, provider_index) -> None:
|
|
|
|
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.Clear(delete_windows=True)
|
|
|
|
self.m_sizer = wx.BoxSizer(wx.VERTICAL)
|
|
|
|
self.m_sizer = wx.BoxSizer(wx.VERTICAL)
|
|
|
|
self.m_selected_provider = self.m_providers[provider_index]
|
|
|
|
backbtn = wx.Button(self.m_panel, -1, label="Go back", size=(480, 40))
|
|
|
|
|
|
|
|
backbtn.Bind(wx.EVT_BUTTON, lambda event: self.show_provider_list(event))
|
|
|
|
|
|
|
|
self.m_sizer.Add(backbtn, wx.ALIGN_CENTER_VERTICAL)
|
|
|
|
|
|
|
|
self.m_sizer.AddSpacer(10)
|
|
|
|
channel_index = 0
|
|
|
|
channel_index = 0
|
|
|
|
for channel in self.m_selected_provider.get_channels():
|
|
|
|
for channel in self.m_selected_provider.get_channels():
|
|
|
|
bitmap = channel.get_logo_as_bitmap()
|
|
|
|
bitmap = channel.get_logo_as_bitmap()
|
|
|
@ -113,7 +119,7 @@ class Cast(wx.Frame):
|
|
|
|
wx.GetApp().Yield()
|
|
|
|
wx.GetApp().Yield()
|
|
|
|
|
|
|
|
|
|
|
|
backbtn = wx.Button(self.m_panel, -1, label="Go back", size=(480, 40))
|
|
|
|
backbtn = wx.Button(self.m_panel, -1, label="Go back", size=(480, 40))
|
|
|
|
backbtn.Bind(wx.EVT_BUTTON, lambda event: self.show_splash(event))
|
|
|
|
backbtn.Bind(wx.EVT_BUTTON, lambda event: self.show_channel_list(event, self.m_selected_provider_index))
|
|
|
|
self.m_sizer.Add(backbtn, wx.ALIGN_CENTER_VERTICAL)
|
|
|
|
self.m_sizer.Add(backbtn, wx.ALIGN_CENTER_VERTICAL)
|
|
|
|
self.m_sizer.AddSpacer(10)
|
|
|
|
self.m_sizer.AddSpacer(10)
|
|
|
|
for item in channel.get_items():
|
|
|
|
for item in channel.get_items():
|
|
|
@ -171,7 +177,8 @@ class Cast(wx.Frame):
|
|
|
|
chromecast_button = wx.Button(self.m_panel, -1, "Cast")
|
|
|
|
chromecast_button = wx.Button(self.m_panel, -1, "Cast")
|
|
|
|
chromecast_button.Bind(
|
|
|
|
chromecast_button.Bind(
|
|
|
|
wx.EVT_BUTTON,
|
|
|
|
wx.EVT_BUTTON,
|
|
|
|
lambda event, muri=uri: self.select_chromecast(event, muri))
|
|
|
|
lambda event, muri=uri, index=provider_index: self.
|
|
|
|
|
|
|
|
select_chromecast(event, muri, index))
|
|
|
|
self.m_sizer.Add(chromecast_button, (2, 2))
|
|
|
|
self.m_sizer.Add(chromecast_button, (2, 2))
|
|
|
|
|
|
|
|
|
|
|
|
if self.m_selected_chromecast:
|
|
|
|
if self.m_selected_chromecast:
|
|
|
@ -191,7 +198,7 @@ class Cast(wx.Frame):
|
|
|
|
self.m_panel.Layout()
|
|
|
|
self.m_panel.Layout()
|
|
|
|
self.m_panel.ScrollChildIntoView(self.m_control)
|
|
|
|
self.m_panel.ScrollChildIntoView(self.m_control)
|
|
|
|
|
|
|
|
|
|
|
|
def select_chromecast(self, _, uri):
|
|
|
|
def select_chromecast(self, _, uri, provider_index):
|
|
|
|
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)
|
|
|
|
|
|
|
|
|
|
|
@ -202,16 +209,16 @@ class Cast(wx.Frame):
|
|
|
|
label=friendly_name,
|
|
|
|
label=friendly_name,
|
|
|
|
size=(480, 40))
|
|
|
|
size=(480, 40))
|
|
|
|
btn.Bind(wx.EVT_BUTTON,
|
|
|
|
btn.Bind(wx.EVT_BUTTON,
|
|
|
|
lambda event, chromecast=cast, muri=uri: self.
|
|
|
|
lambda event, chromecast=cast, muri=uri, index=provider_index: self.
|
|
|
|
set_chromecast(event, chromecast, muri))
|
|
|
|
set_chromecast(event, chromecast, muri, index))
|
|
|
|
self.m_sizer.Add(btn, wx.ALIGN_CENTER_VERTICAL)
|
|
|
|
self.m_sizer.Add(btn, wx.ALIGN_CENTER_VERTICAL)
|
|
|
|
self.m_panel.SetSizer(self.m_sizer)
|
|
|
|
self.m_panel.SetSizer(self.m_sizer)
|
|
|
|
self.m_sizer.Fit(self)
|
|
|
|
self.m_sizer.Fit(self)
|
|
|
|
self.m_panel.Layout()
|
|
|
|
self.m_panel.Layout()
|
|
|
|
|
|
|
|
|
|
|
|
def set_chromecast(self, event, chromecast, uri):
|
|
|
|
def set_chromecast(self, event, chromecast, uri, provider_index):
|
|
|
|
self.m_selected_chromecast = chromecast
|
|
|
|
self.m_selected_chromecast = chromecast
|
|
|
|
self.show_player(event, uri)
|
|
|
|
self.show_player(event, uri, provider_index)
|
|
|
|
|
|
|
|
|
|
|
|
def cast(self, event, uri):
|
|
|
|
def cast(self, event, uri):
|
|
|
|
mimetype = 'video/mp4'
|
|
|
|
mimetype = 'video/mp4'
|
|
|
|