Add available extractors dynamically from imports of extractors package

This commit is contained in:
Manuel Cortez 2019-06-12 22:28:58 -05:00
parent d0491d8dd0
commit 99d02c97f0
3 changed files with 4 additions and 4 deletions

View File

@ -32,7 +32,7 @@ class Controller(object):
# Setting up the player object
player.setup()
# Get main window
self.window = mainWindow.mainWindow()
self.window = mainWindow.mainWindow(extractors=[i.name for i in get_extractors()])
log.debug("Main window created")
self.window.change_status(_(u"Ready"))
# Here we will save results for searches as song objects.

View File

@ -15,7 +15,7 @@ YOUTUBE_API_VERSION = "v3"
log = logging.getLogger("extractors.youtube.com")
class interface(object):
name = "youtube"
name = "YouTube"
def __init__(self):
self.results = []

View File

@ -32,7 +32,7 @@ class mainWindow(wx.Frame):
mb.Append(help_, _(u"Help"))
self.SetMenuBar(mb)
def __init__(self):
def __init__(self, extractors=[]):
super(mainWindow, self).__init__(parent=None, id=wx.NewId(), title=application.name)
self.Maximize(True)
self.makeMenu()
@ -45,7 +45,7 @@ class mainWindow(wx.Frame):
box.Add(lbl2, 0, wx.GROW)
box.Add(self.text, 1, wx.GROW)
box.Add(wx.StaticText(self.panel, wx.NewId(), _(u"Search in")), 0, wx.GROW)
self.extractor = wx.ComboBox(self.panel, wx.NewId(), choices=["youtube", "tidal", "mail.ru", "zaycev.net"], value="youtube", style=wx.CB_READONLY)
self.extractor = wx.ComboBox(self.panel, wx.NewId(), choices=extractors, value=extractors[0], style=wx.CB_READONLY)
box.Add(self.extractor, 1, wx.GROW)
self.search = wx.Button(self.panel, wx.NewId(), _(u"Search"))
self.search.SetDefault()