|
|
@ -95,6 +95,25 @@ class Cast(wx.Frame):
|
|
|
|
|
|
|
|
|
|
|
|
return providers
|
|
|
|
return providers
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def show_importer(self, _) -> None:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
with wx.FileDialog(self, "Open Newpipe json file", wildcard="Json files (*.json)|*.json",
|
|
|
|
|
|
|
|
style=wx.FD_OPEN | wx.FD_FILE_MUST_EXIST) as file_dialog:
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if file_dialog.ShowModal() == wx.ID_CANCEL:
|
|
|
|
|
|
|
|
return # the user changed their mind
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
# Proceed loading the file chosen by the user
|
|
|
|
|
|
|
|
subfile = file_dialog.GetPath()
|
|
|
|
|
|
|
|
channels = list()
|
|
|
|
|
|
|
|
if os.path.isfile(subfile):
|
|
|
|
|
|
|
|
import_from_newpipe(subfile)
|
|
|
|
|
|
|
|
subscriptions = get_subscriptions()
|
|
|
|
|
|
|
|
for channel in subscriptions:
|
|
|
|
|
|
|
|
channels.append(YouTube.YouTube(channel[0], channel[1]))
|
|
|
|
|
|
|
|
self.m_providers[1].set_channels(channels)
|
|
|
|
|
|
|
|
self.show_channel_list(None,self.m_selected_provider_index)
|
|
|
|
|
|
|
|
|
|
|
|
def show_provider_list(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)
|
|
|
@ -130,6 +149,12 @@ class Cast(wx.Frame):
|
|
|
|
#self.m_sizer.AddSpacer(SPACER_HEIGHT * 4)
|
|
|
|
#self.m_sizer.AddSpacer(SPACER_HEIGHT * 4)
|
|
|
|
bck_callback = lambda event: self.show_provider_list(event)
|
|
|
|
bck_callback = lambda event: self.show_provider_list(event)
|
|
|
|
self.add_back_button(bck_callback)
|
|
|
|
self.add_back_button(bck_callback)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if self.m_selected_provider.get_name() == "YouTube":
|
|
|
|
|
|
|
|
importbtn = wx.Button(self.m_panel, -1, label="Import from NewPipe",size=(WIDTH, BTN_HEIGHT))
|
|
|
|
|
|
|
|
importbtn.Bind(wx.EVT_BUTTON, lambda event: self.show_importer(event))
|
|
|
|
|
|
|
|
self.m_sizer.Add(importbtn)
|
|
|
|
|
|
|
|
|
|
|
|
channel_index = 0
|
|
|
|
channel_index = 0
|
|
|
|
|
|
|
|
|
|
|
|
for channel in self.m_selected_provider.get_channels():
|
|
|
|
for channel in self.m_selected_provider.get_channels():
|
|
|
|