Reverted commits to the last working state
This commit is contained in:
parent
6a188b7ec7
commit
625931f40b
@ -9,6 +9,9 @@ enabled = boolean(default=True)
|
|||||||
username = string(default="")
|
username = string(default="")
|
||||||
password = string(default="")
|
password = string(default="")
|
||||||
quality=string(default="high")
|
quality=string(default="high")
|
||||||
|
include_albums = boolean(default=True)
|
||||||
|
include_compilations = boolean(default=True)
|
||||||
|
include_singles = boolean(default=True)
|
||||||
|
|
||||||
[[youtube]]
|
[[youtube]]
|
||||||
enabled = boolean(default=True)
|
enabled = boolean(default=True)
|
||||||
|
@ -14,7 +14,7 @@ from issueReporter import issueReporter
|
|||||||
from wxUI import mainWindow, menus
|
from wxUI import mainWindow, menus
|
||||||
from update import updater
|
from update import updater
|
||||||
from utils import get_services
|
from utils import get_services
|
||||||
from . import player, configuration, search
|
from . import player, configuration
|
||||||
|
|
||||||
log = logging.getLogger("controller.main")
|
log = logging.getLogger("controller.main")
|
||||||
|
|
||||||
@ -25,13 +25,10 @@ class Controller(object):
|
|||||||
log.debug("Starting main controller...")
|
log.debug("Starting main controller...")
|
||||||
# Setting up the player object
|
# Setting up the player object
|
||||||
player.setup()
|
player.setup()
|
||||||
self.buffers = []
|
|
||||||
# Get main window
|
# Get main window
|
||||||
self.window = mainWindow.mainWindow(extractors=[i.interface.name for i in get_services()])
|
self.window = mainWindow.mainWindow(extractors=[i.interface.name for i in get_services()])
|
||||||
log.debug("Main window created")
|
log.debug("Main window created")
|
||||||
self.window.change_status(_(u"Ready"))
|
self.window.change_status(_(u"Ready"))
|
||||||
search_buffer = search.search(view=self.window.get_buffer(0))
|
|
||||||
self.buffers.append(search_buffer)
|
|
||||||
# Here we will save results for searches as song objects.
|
# Here we will save results for searches as song objects.
|
||||||
self.results = []
|
self.results = []
|
||||||
self.connect_events()
|
self.connect_events()
|
||||||
@ -60,6 +57,9 @@ class Controller(object):
|
|||||||
def connect_events(self):
|
def connect_events(self):
|
||||||
""" connects all widgets to their corresponding events."""
|
""" connects all widgets to their corresponding events."""
|
||||||
log.debug("Binding events...")
|
log.debug("Binding events...")
|
||||||
|
widgetUtils.connect_event(self.window.search, widgetUtils.BUTTON_PRESSED, self.on_search)
|
||||||
|
widgetUtils.connect_event(self.window.list, widgetUtils.LISTBOX_ITEM_ACTIVATED, self.on_activated)
|
||||||
|
widgetUtils.connect_event(self.window.list, widgetUtils.KEYPRESS, self.on_keypress)
|
||||||
widgetUtils.connect_event(self.window, widgetUtils.MENU, self.on_play, menuitem=self.window.player_play)
|
widgetUtils.connect_event(self.window, widgetUtils.MENU, self.on_play, menuitem=self.window.player_play)
|
||||||
widgetUtils.connect_event(self.window, widgetUtils.MENU, self.on_settings, menuitem=self.window.settings)
|
widgetUtils.connect_event(self.window, widgetUtils.MENU, self.on_settings, menuitem=self.window.settings)
|
||||||
widgetUtils.connect_event(self.window, widgetUtils.MENU, self.on_next, menuitem=self.window.player_next)
|
widgetUtils.connect_event(self.window, widgetUtils.MENU, self.on_next, menuitem=self.window.player_next)
|
||||||
@ -82,8 +82,8 @@ class Controller(object):
|
|||||||
self.window.Bind(wx.EVT_COMMAND_SCROLL_CHANGED, self.on_set_volume, self.window.vol_slider)
|
self.window.Bind(wx.EVT_COMMAND_SCROLL_CHANGED, self.on_set_volume, self.window.vol_slider)
|
||||||
self.window.Bind(wx.EVT_COMMAND_SCROLL_THUMBTRACK, self.on_time_change, self.window.time_slider)
|
self.window.Bind(wx.EVT_COMMAND_SCROLL_THUMBTRACK, self.on_time_change, self.window.time_slider)
|
||||||
self.window.Bind(wx.EVT_COMMAND_SCROLL_CHANGED, self.on_time_change, self.window.time_slider)
|
self.window.Bind(wx.EVT_COMMAND_SCROLL_CHANGED, self.on_time_change, self.window.time_slider)
|
||||||
# self.window.list.Bind(wx.EVT_LISTBOX_DCLICK, self.on_play)
|
self.window.list.Bind(wx.EVT_LISTBOX_DCLICK, self.on_play)
|
||||||
# self.window.list.Bind(wx.EVT_CONTEXT_MENU, self.on_context)
|
self.window.list.Bind(wx.EVT_CONTEXT_MENU, self.on_context)
|
||||||
self.window.Bind(wx.EVT_CLOSE, self.on_close)
|
self.window.Bind(wx.EVT_CLOSE, self.on_close)
|
||||||
pub.subscribe(self.change_status, "change_status")
|
pub.subscribe(self.change_status, "change_status")
|
||||||
pub.subscribe(self.on_download_finished, "download_finished")
|
pub.subscribe(self.on_download_finished, "download_finished")
|
||||||
|
@ -1,25 +0,0 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
import widgetUtils
|
|
||||||
from pubsub import pub
|
|
||||||
from . import player
|
|
||||||
|
|
||||||
class search(object):
|
|
||||||
|
|
||||||
def __init__(self, view):
|
|
||||||
super(search, self).__init__()
|
|
||||||
self.name = "search"
|
|
||||||
self.items = []
|
|
||||||
self.view = view
|
|
||||||
print(self.view)
|
|
||||||
self.connect_events()
|
|
||||||
|
|
||||||
def connect_events(self):
|
|
||||||
widgetUtils.connect_event(self.view.list, widgetUtils.LISTBOX_ITEM_ACTIVATED, self.on_activated)
|
|
||||||
pub.subscribe(self.search, "search")
|
|
||||||
widgetUtils.connect_event(self.view.list, widgetUtils.KEYPRESS, self.on_keypress)
|
|
||||||
|
|
||||||
def create_queue(self, parent):
|
|
||||||
pass
|
|
||||||
|
|
||||||
def search(self, text, service):
|
|
||||||
print("Clocked me")
|
|
@ -64,16 +64,19 @@ class interface(base.baseInterface):
|
|||||||
elif field == "artist":
|
elif field == "artist":
|
||||||
data = []
|
data = []
|
||||||
artist = search_response.artists[0].id
|
artist = search_response.artists[0].id
|
||||||
|
if config.app["services"]["tidal"]["include_albums"]:
|
||||||
albums = self.session.get_artist_albums(artist)
|
albums = self.session.get_artist_albums(artist)
|
||||||
for album in albums:
|
for album in albums:
|
||||||
tracks = self.session.get_album_tracks(album.id)
|
tracks = self.session.get_album_tracks(album.id)
|
||||||
for track in tracks:
|
for track in tracks:
|
||||||
data.append(track)
|
data.append(track)
|
||||||
|
if config.app["services"]["tidal"]["include_compilations"]:
|
||||||
compilations = self.session.get_artist_albums_other(artist)
|
compilations = self.session.get_artist_albums_other(artist)
|
||||||
for album in compilations:
|
for album in compilations:
|
||||||
tracks = self.session.get_album_tracks(album.id)
|
tracks = self.session.get_album_tracks(album.id)
|
||||||
for track in tracks:
|
for track in tracks:
|
||||||
data.append(track)
|
data.append(track)
|
||||||
|
if config.app["services"]["tidal"]["include_singles"]:
|
||||||
singles = self.session.get_artist_albums_ep_singles(artist)
|
singles = self.session.get_artist_albums_ep_singles(artist)
|
||||||
for album in singles:
|
for album in singles:
|
||||||
tracks = self.session.get_album_tracks(album.id)
|
tracks = self.session.get_album_tracks(album.id)
|
||||||
@ -133,7 +136,6 @@ class settings(base.baseSettings):
|
|||||||
usernamebox.Add(self.username, 0, wx.ALL, 5)
|
usernamebox.Add(self.username, 0, wx.ALL, 5)
|
||||||
sizer.Add(usernamebox, 0, wx.ALL, 5)
|
sizer.Add(usernamebox, 0, wx.ALL, 5)
|
||||||
self.map.append(("username", self.username))
|
self.map.append(("username", self.username))
|
||||||
|
|
||||||
password = wx.StaticText(self, wx.NewId(), _("Password"))
|
password = wx.StaticText(self, wx.NewId(), _("Password"))
|
||||||
self.password = wx.TextCtrl(self, wx.NewId(), style=wx.TE_PASSWORD)
|
self.password = wx.TextCtrl(self, wx.NewId(), style=wx.TE_PASSWORD)
|
||||||
passwordbox = wx.BoxSizer(wx.HORIZONTAL)
|
passwordbox = wx.BoxSizer(wx.HORIZONTAL)
|
||||||
@ -154,6 +156,14 @@ class settings(base.baseSettings):
|
|||||||
self.quality.GetValue = self.get_quality_value
|
self.quality.GetValue = self.get_quality_value
|
||||||
self.quality.SetValue = self.set_quality_value
|
self.quality.SetValue = self.set_quality_value
|
||||||
self.map.append(("quality", self.quality))
|
self.map.append(("quality", self.quality))
|
||||||
|
include = wx.StaticBoxSizer(parent=self, orient=wx.HORIZONTAL, label=_("Search by artist"))
|
||||||
|
self.include_albums = wx.CheckBox(include.GetStaticBox(), wx.NewId(), _("Include albums"))
|
||||||
|
self.include_compilations = wx.CheckBox(include.GetStaticBox(), wx.NewId(), _("Include compilations"))
|
||||||
|
self.include_singles = wx.CheckBox(include.GetStaticBox(), wx.NewId(), _("Include singles"))
|
||||||
|
sizer.Add(include, 0, wx.ALL, 5)
|
||||||
|
self.map.append(("include_albums", self.include_albums))
|
||||||
|
self.map.append(("include_compilations", self.include_compilations))
|
||||||
|
self.map.append(("include_singles", self.include_singles))
|
||||||
self.SetSizer(sizer)
|
self.SetSizer(sizer)
|
||||||
|
|
||||||
def on_enabled(self, *args, **kwargs):
|
def on_enabled(self, *args, **kwargs):
|
||||||
|
@ -7,7 +7,6 @@ except ImportError:
|
|||||||
pass
|
pass
|
||||||
import application
|
import application
|
||||||
import widgetUtils
|
import widgetUtils
|
||||||
from .search import searchPanel
|
|
||||||
|
|
||||||
class mainWindow(wx.Frame):
|
class mainWindow(wx.Frame):
|
||||||
def makeMenu(self):
|
def makeMenu(self):
|
||||||
@ -41,10 +40,22 @@ class mainWindow(wx.Frame):
|
|||||||
self.panel = wx.Panel(self)
|
self.panel = wx.Panel(self)
|
||||||
self.sizer = wx.BoxSizer(wx.VERTICAL)
|
self.sizer = wx.BoxSizer(wx.VERTICAL)
|
||||||
self.sb = self.CreateStatusBar()
|
self.sb = self.CreateStatusBar()
|
||||||
self.tb = wx.Treebook(self.panel, -1)
|
lbl2 = wx.StaticText(self.panel, wx.NewId(), _(u"search"))
|
||||||
search = searchPanel(extractors, parent=self.tb)
|
self.text = wx.TextCtrl(self.panel, wx.NewId())
|
||||||
self.add_buffer(search, _("Search"))
|
box = wx.BoxSizer(wx.HORIZONTAL)
|
||||||
self.sizer.Add(self.tb, 1, wx.ALL|wx.EXPAND, 5)
|
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=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()
|
||||||
|
box.Add(self.search, 0, wx.GROW)
|
||||||
|
self.sizer.Add(box, 0, wx.GROW)
|
||||||
|
lbl = wx.StaticText(self.panel, wx.NewId(), _(u"Results"))
|
||||||
|
self.list = wx.ListBox(self.panel, wx.NewId())
|
||||||
|
self.sizer.Add(lbl, 0, wx.GROW)
|
||||||
|
self.sizer.Add(self.list, 1, wx.GROW)
|
||||||
box1 = wx.BoxSizer(wx.HORIZONTAL)
|
box1 = wx.BoxSizer(wx.HORIZONTAL)
|
||||||
box2 = wx.BoxSizer(wx.HORIZONTAL)
|
box2 = wx.BoxSizer(wx.HORIZONTAL)
|
||||||
box1.Add(wx.StaticText(self.panel, wx.NewId(), _(u"Position")), 0, wx.GROW)
|
box1.Add(wx.StaticText(self.panel, wx.NewId(), _(u"Position")), 0, wx.GROW)
|
||||||
@ -66,6 +77,9 @@ class mainWindow(wx.Frame):
|
|||||||
self.progressbar = wx.Gauge(self.panel, wx.NewId(), range=100, style=wx.GA_HORIZONTAL)
|
self.progressbar = wx.Gauge(self.panel, wx.NewId(), range=100, style=wx.GA_HORIZONTAL)
|
||||||
self.sizer.Add(self.progressbar, 0, wx.ALL, 5)
|
self.sizer.Add(self.progressbar, 0, wx.ALL, 5)
|
||||||
self.panel.SetSizerAndFit(self.sizer)
|
self.panel.SetSizerAndFit(self.sizer)
|
||||||
|
# self.SetClientSize(self.sizer.CalcMin())
|
||||||
|
# self.Layout()
|
||||||
|
# self.SetSize(self.GetBestSize())
|
||||||
|
|
||||||
def change_status(self, status):
|
def change_status(self, status):
|
||||||
self.sb.SetStatusText(status)
|
self.sb.SetStatusText(status)
|
||||||
@ -88,6 +102,14 @@ class mainWindow(wx.Frame):
|
|||||||
except:
|
except:
|
||||||
wx.AboutBox(info)
|
wx.AboutBox(info)
|
||||||
|
|
||||||
|
def get_text(self):
|
||||||
|
t = self.text.GetValue()
|
||||||
|
self.text.ChangeValue("")
|
||||||
|
return t
|
||||||
|
|
||||||
|
def get_item(self):
|
||||||
|
return self.list.GetSelection()
|
||||||
|
|
||||||
def get_destination_path(self, filename):
|
def get_destination_path(self, filename):
|
||||||
saveFileDialog = wx.FileDialog(self, _(u"Save this file"), "", filename, _(u"Audio Files(*.mp3)|*.mp3"), wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT)
|
saveFileDialog = wx.FileDialog(self, _(u"Save this file"), "", filename, _(u"Audio Files(*.mp3)|*.mp3"), wx.FD_SAVE | wx.FD_OVERWRITE_PROMPT)
|
||||||
if saveFileDialog.ShowModal() == wx.ID_OK:
|
if saveFileDialog.ShowModal() == wx.ID_OK:
|
||||||
@ -100,45 +122,3 @@ class mainWindow(wx.Frame):
|
|||||||
except AttributeError:
|
except AttributeError:
|
||||||
self.notification = wx.NotificationMessage(title, text)
|
self.notification = wx.NotificationMessage(title, text)
|
||||||
self.notification.Show()
|
self.notification.Show()
|
||||||
|
|
||||||
def get_buffer_count(self):
|
|
||||||
return self.tb.GetPageCount()
|
|
||||||
|
|
||||||
def add_buffer(self, buffer, name):
|
|
||||||
self.tb.AddPage(buffer, name)
|
|
||||||
|
|
||||||
def insert_buffer(self, buffer, name, pos):
|
|
||||||
return self.tb.InsertSubPage(pos, buffer, name)
|
|
||||||
|
|
||||||
def search(self, name_):
|
|
||||||
for i in range(0, self.tb.GetPageCount()):
|
|
||||||
if self.tb.GetPage(i).name == name_: return i
|
|
||||||
|
|
||||||
def get_current_buffer(self):
|
|
||||||
return self.tb.GetCurrentPage()
|
|
||||||
|
|
||||||
def get_current_buffer_pos(self):
|
|
||||||
return self.tb.GetSelection()
|
|
||||||
|
|
||||||
def get_buffer(self, pos):
|
|
||||||
return self.tb.GetPage(pos)
|
|
||||||
|
|
||||||
def change_buffer(self, position):
|
|
||||||
self.tb.ChangeSelection(position)
|
|
||||||
|
|
||||||
def get_buffer_text(self, pos=None):
|
|
||||||
if pos == None:
|
|
||||||
pos = self.tb.GetSelection()
|
|
||||||
return self.tb.GetPageText(pos)
|
|
||||||
|
|
||||||
def get_buffer_by_id(self, id):
|
|
||||||
return self.tb.FindWindowById(id)
|
|
||||||
|
|
||||||
def advance_selection(self, forward):
|
|
||||||
self.tb.AdvanceSelection(forward)
|
|
||||||
|
|
||||||
def remove_buffer(self, pos):
|
|
||||||
self.tb.DeletePage(pos)
|
|
||||||
|
|
||||||
def remove_buffer_from_position(self, pos):
|
|
||||||
return self.tb.RemovePage(pos)
|
|
||||||
|
@ -1,41 +0,0 @@
|
|||||||
# -*- coding: utf-8 -*-
|
|
||||||
import wx
|
|
||||||
from pubsub import pub
|
|
||||||
|
|
||||||
class searchPanel(wx.Panel):
|
|
||||||
|
|
||||||
def __init__(self, services=[], *args, **kwargs):
|
|
||||||
super(searchPanel, self).__init__(*args, **kwargs)
|
|
||||||
sizer = wx.BoxSizer(wx.VERTICAL)
|
|
||||||
lbl2 = wx.StaticText(self, wx.NewId(), _("search"))
|
|
||||||
self.text = wx.TextCtrl(self, wx.NewId())
|
|
||||||
box = wx.BoxSizer(wx.HORIZONTAL)
|
|
||||||
box.Add(lbl2, 0, wx.GROW)
|
|
||||||
box.Add(self.text, 1, wx.GROW)
|
|
||||||
box.Add(wx.StaticText(self, wx.NewId(), _(u"Search in")), 0, wx.GROW)
|
|
||||||
self.service = wx.ComboBox(self, wx.NewId(), choices=services, value=services[0], style=wx.CB_READONLY)
|
|
||||||
box.Add(self.service, 1, wx.GROW)
|
|
||||||
self.search = wx.Button(self, wx.NewId(), _(u"Search"))
|
|
||||||
self.search.SetDefault()
|
|
||||||
self.search.Bind(wx.EVT_BUTTON, self.on_search)
|
|
||||||
box.Add(self.search, 0, wx.GROW)
|
|
||||||
sizer.Add(box, 0, wx.GROW)
|
|
||||||
lbl = wx.StaticText(self, wx.NewId(), _(u"Results"))
|
|
||||||
self.list = wx.ListBox(self, wx.NewId())
|
|
||||||
sizer.Add(lbl, 0, wx.GROW)
|
|
||||||
sizer.Add(self.list, 1, wx.GROW)
|
|
||||||
self.SetSizer(sizer)
|
|
||||||
|
|
||||||
def get_text(self):
|
|
||||||
t = self.text.GetValue()
|
|
||||||
self.text.ChangeValue("")
|
|
||||||
return t
|
|
||||||
|
|
||||||
def get_item(self):
|
|
||||||
return self.list.GetSelection()
|
|
||||||
|
|
||||||
def on_search(self, event, *args, **kwargs):
|
|
||||||
text = self.get_text()
|
|
||||||
service = self.service.GetValue()
|
|
||||||
pub.sendMessage("search", service=service, text=text)
|
|
||||||
event.Skip()
|
|
Loading…
Reference in New Issue
Block a user