Added a progress bar for downloads in the application. Fixed a problem with format in Tidal
This commit is contained in:
parent
bb97d017b5
commit
7756d71b32
@ -88,8 +88,13 @@ class Controller(object):
|
||||
pub.subscribe(self.change_status, "change_status")
|
||||
pub.subscribe(self.on_download_finished, "download_finished")
|
||||
pub.subscribe(self.on_notify, "notify")
|
||||
pub.subscribe(self.on_update_progress, "update-progress")
|
||||
|
||||
# Event functions. These functions will call other functions in a thread and are bound to widget events.
|
||||
|
||||
def on_update_progress(self, value):
|
||||
wx.CallAfter(self.window.progressbar.SetValue, value)
|
||||
|
||||
def on_settings(self, *args, **kwargs):
|
||||
settings = configuration.configuration()
|
||||
self.reload_extractors()
|
||||
|
@ -149,6 +149,7 @@ class audioPlayer(object):
|
||||
while True:
|
||||
state = media.get_state()
|
||||
pub.sendMessage("change_status", status=_("Downloading {0} ({1}%).").format(item.title, int(transcoder.get_position()*100)))
|
||||
pub.sendMessage("update-progress", value=int(transcoder.get_position()*100))
|
||||
if str(state) == 'State.Ended':
|
||||
break
|
||||
elif str(state) == 'state.error':
|
||||
|
@ -38,6 +38,7 @@ class interface(base.baseInterface):
|
||||
self.file_extension = "flac"
|
||||
else:
|
||||
self.file_extension = "mp3"
|
||||
return self.file_extension
|
||||
|
||||
def transcoder_enabled(self):
|
||||
if config.app["services"]["tidal"]["quality"] == "lossless":
|
||||
|
@ -68,6 +68,7 @@ def download_file(url, local_filename):
|
||||
done = int(100 * dl / total_length)
|
||||
msg = _(u"Downloading {0} ({1}%).").format(os.path.basename(local_filename), done)
|
||||
pub.sendMessage("change_status", status=msg)
|
||||
pub.sendMessage("update-progress", value=done)
|
||||
pub.sendMessage("download_finished", file=os.path.basename(local_filename))
|
||||
log.debug("Download finished successfully")
|
||||
return local_filename
|
||||
|
@ -74,6 +74,8 @@ class mainWindow(wx.Frame):
|
||||
box2.Add(self.next)
|
||||
self.sizer.Add(box1, 0, wx.GROW)
|
||||
self.sizer.Add(box2, 1, wx.GROW)
|
||||
self.progressbar = wx.Gauge(self.panel, wx.NewId(), range=100, style=wx.GA_HORIZONTAL)
|
||||
self.sizer.Add(self.progressbar, 0, wx.ALL, 5)
|
||||
self.panel.SetSizerAndFit(self.sizer)
|
||||
# self.SetClientSize(self.sizer.CalcMin())
|
||||
# self.Layout()
|
||||
|
Loading…
Reference in New Issue
Block a user