Fixed a couple of issues

This commit is contained in:
Manuel Cortez 2020-07-12 23:11:41 -05:00
parent c518d0ea08
commit fef5c218b0
3 changed files with 11 additions and 3 deletions

View File

@ -9,6 +9,7 @@ enabled = boolean(default=True)
username = string(default="") username = string(default="")
password = string(default="") password = string(default="")
quality=string(default="high") quality=string(default="high")
avoid_transcoding = boolean(default=False)
include_albums = boolean(default=True) include_albums = boolean(default=True)
include_compilations = boolean(default=True) include_compilations = boolean(default=True)
include_singles = boolean(default=True) include_singles = boolean(default=True)

View File

@ -187,6 +187,8 @@ class Controller(object):
def on_download(self, *args, **kwargs): def on_download(self, *args, **kwargs):
item = self.results[self.window.get_item()] item = self.results[self.window.get_item()]
if item.download_url == "":
item.get_download_url()
log.debug("Starting requested download: {0} (using extractor: {1})".format(item.title, self.extractor.name)) log.debug("Starting requested download: {0} (using extractor: {1})".format(item.title, self.extractor.name))
f = "{item_name}.{item_extension}".format(item_name=item.format_track(), item_extension=item.extractor.get_file_format()) f = "{item_name}.{item_extension}".format(item_name=item.format_track(), item_extension=item.extractor.get_file_format())
path = self.window.get_destination_path(f) path = self.window.get_destination_path(f)

View File

@ -46,6 +46,8 @@ class interface(base.baseInterface):
""" Returns the file format (mp3 or flac) depending in quality set. """ """ Returns the file format (mp3 or flac) depending in quality set. """
if config.app["services"]["tidal"]["quality"] == "lossless": if config.app["services"]["tidal"]["quality"] == "lossless":
self.file_extension = "flac" self.file_extension = "flac"
elif config.app["services"]["tidal"]["avoid_transcoding"] == True:
self.file_extension = "m4a"
else: else:
self.file_extension = "mp3" self.file_extension = "mp3"
return self.file_extension return self.file_extension
@ -55,6 +57,8 @@ class interface(base.baseInterface):
# toDo: Shall this be a setting and allow MusicDL to spit out the m4a file directly? # toDo: Shall this be a setting and allow MusicDL to spit out the m4a file directly?
if config.app["services"]["tidal"]["quality"] == "lossless": if config.app["services"]["tidal"]["quality"] == "lossless":
return False return False
elif config.app["services"]["tidal"]["avoid_transcoding"]:
return False
else: else:
return True return True
@ -104,11 +108,9 @@ class interface(base.baseInterface):
s.url = search_result.id s.url = search_result.id
s.tracknumber = str(search_result.track_num) s.tracknumber = str(search_result.track_num)
s.album = search_result.album.name s.album = search_result.album.name
print(search_result.album.num_tracks, search_result.album.name)
if search_result.album.num_tracks == None: if search_result.album.num_tracks == None:
s.single = True s.single = True
s.info = search_result s.info = search_result
print(s.info)
self.results.append(s) self.results.append(s)
log.debug("{0} results found.".format(len(self.results))) log.debug("{0} results found.".format(len(self.results)))
@ -126,7 +128,7 @@ class interface(base.baseInterface):
def format_track(self, item): def format_track(self, item):
if not hasattr(item, "single"): if not hasattr(item, "single"):
return "{0}. {1}".format(self.format_number(item.tracknumber), item.title) return "{0}. {1}".format(self.format_number(int(item.tracknumber)), item.title)
else: else:
return "{title}. {artist}. {duration}".format(title=item.title, duration=item.duration, artist=item.artist) return "{title}. {artist}. {duration}".format(title=item.title, duration=item.duration, artist=item.artist)
@ -158,6 +160,9 @@ class settings(base.baseSettings):
self.enabled.Bind(wx.EVT_CHECKBOX, self.on_enabled) self.enabled.Bind(wx.EVT_CHECKBOX, self.on_enabled)
self.map.append(("enabled", self.enabled)) self.map.append(("enabled", self.enabled))
sizer.Add(self.enabled, 0, wx.ALL, 5) sizer.Add(self.enabled, 0, wx.ALL, 5)
self.avoid_transcoding = wx.CheckBox(self, wx.NewId(), _("Avoid transcoding when downloading"))
self.map.append(("avoid_transcoding", self.avoid_transcoding))
sizer.Add(self.avoid_transcoding, 0, wx.ALL, 5)
username = wx.StaticText(self, wx.NewId(), _("Tidal username or email address")) username = wx.StaticText(self, wx.NewId(), _("Tidal username or email address"))
self.username = wx.TextCtrl(self, wx.NewId()) self.username = wx.TextCtrl(self, wx.NewId())
usernamebox = wx.BoxSizer(wx.HORIZONTAL) usernamebox = wx.BoxSizer(wx.HORIZONTAL)