Add refresh buttons
This commit is contained in:
parent
62c0f68647
commit
f6fe4f143b
2 changed files with 32 additions and 5 deletions
|
@ -51,3 +51,6 @@ class Channel:
|
||||||
|
|
||||||
def set_logo(self, logo: wx.Bitmap) -> None:
|
def set_logo(self, logo: wx.Bitmap) -> None:
|
||||||
self.m_logo = logo
|
self.m_logo = logo
|
||||||
|
|
||||||
|
def refresh(self) -> None:
|
||||||
|
pass
|
||||||
|
|
34
src/main.py
34
src/main.py
|
@ -110,7 +110,9 @@ class Cast(wx.Frame):
|
||||||
import_from_newpipe(subfile)
|
import_from_newpipe(subfile)
|
||||||
subscriptions = get_subscriptions()
|
subscriptions = get_subscriptions()
|
||||||
for channel in subscriptions:
|
for channel in subscriptions:
|
||||||
channels.append(YouTube.YouTube(channel[0], channel[1]))
|
yt_chan = YouTube.YouTube(channel[0], channel[1])
|
||||||
|
yt_chan.refresh()
|
||||||
|
channels.append(yt_chan)
|
||||||
self.m_providers[1].set_channels(channels)
|
self.m_providers[1].set_channels(channels)
|
||||||
self.m_providers[1].make_latest()
|
self.m_providers[1].make_latest()
|
||||||
self.show_channel_list(None,self.m_selected_provider_index)
|
self.show_channel_list(None,self.m_selected_provider_index)
|
||||||
|
@ -178,18 +180,40 @@ class Cast(wx.Frame):
|
||||||
self.m_sizer = wx.BoxSizer(wx.VERTICAL)
|
self.m_sizer = wx.BoxSizer(wx.VERTICAL)
|
||||||
# self.m_sizer.AddSpacer(SPACER_HEIGHT * 4)
|
# self.m_sizer.AddSpacer(SPACER_HEIGHT * 4)
|
||||||
channel = self.m_selected_provider.get_channel_by_index(index)
|
channel = self.m_selected_provider.get_channel_by_index(index)
|
||||||
|
def refresh_callback(event):
|
||||||
|
if self.m_selected_provider_index == 1 and index == 0:
|
||||||
|
with wx.BusyInfo("Please wait, working..."):
|
||||||
|
for chan in self.m_selected_provider.get_channels():
|
||||||
|
chan.refresh()
|
||||||
|
wait = 1
|
||||||
|
while wait > 0:
|
||||||
|
wait = 0
|
||||||
|
for chan in self.m_selected_provider.get_channels():
|
||||||
|
if chan.wait():
|
||||||
|
wait += 1
|
||||||
|
time.sleep(1)
|
||||||
|
wx.GetApp().Yield()
|
||||||
|
else:
|
||||||
|
channel.refresh()
|
||||||
|
self.show_video_list(event,index )
|
||||||
|
|
||||||
|
refreshbtn = wx.Button(self.m_panel,
|
||||||
|
-1,
|
||||||
|
label="Refresh",
|
||||||
|
size=(WIDTH, BTN_HEIGHT))
|
||||||
|
refreshbtn.Bind(wx.EVT_BUTTON, refresh_callback)
|
||||||
|
self.m_sizer.Add(refreshbtn)
|
||||||
|
|
||||||
if channel.wait():
|
if channel.wait():
|
||||||
with wx.BusyInfo("Please wait, working..."):
|
with wx.BusyInfo("Please wait, working..."):
|
||||||
index = 0
|
|
||||||
|
|
||||||
while channel.wait():
|
while channel.wait():
|
||||||
time.sleep(1)
|
time.sleep(1)
|
||||||
wx.GetApp().Yield()
|
wx.GetApp().Yield()
|
||||||
|
|
||||||
callback = lambda event: self.show_channel_list(
|
back_callback = lambda event: self.show_channel_list(
|
||||||
event, self.m_selected_provider_index)
|
event, self.m_selected_provider_index)
|
||||||
self.add_back_button(callback)
|
self.add_back_button(back_callback)
|
||||||
|
|
||||||
|
|
||||||
for item in channel.get_items(): # type: ignore
|
for item in channel.get_items(): # type: ignore
|
||||||
inner_sizer = wx.BoxSizer(wx.VERTICAL)
|
inner_sizer = wx.BoxSizer(wx.VERTICAL)
|
||||||
|
|
Loading…
Add table
Reference in a new issue