Added more settings in Tidal

This commit is contained in:
Manuel Cortez 2019-07-08 16:43:31 -05:00
parent 69452b69bd
commit 207a7110ef
2 changed files with 29 additions and 16 deletions

View File

@ -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)

View File

@ -64,21 +64,24 @@ class interface(base.baseInterface):
elif field == "artist": elif field == "artist":
data = [] data = []
artist = search_response.artists[0].id artist = search_response.artists[0].id
albums = self.session.get_artist_albums(artist) if config.app["services"]["tidal"]["include_albums"]:
for album in albums: albums = self.session.get_artist_albums(artist)
tracks = self.session.get_album_tracks(album.id) for album in albums:
for track in tracks: tracks = self.session.get_album_tracks(album.id)
data.append(track) for track in tracks:
compilations = self.session.get_artist_albums_other(artist) data.append(track)
for album in compilations: if config.app["services"]["tidal"]["include_compilations"]:
tracks = self.session.get_album_tracks(album.id) compilations = self.session.get_artist_albums_other(artist)
for track in tracks: for album in compilations:
data.append(track) tracks = self.session.get_album_tracks(album.id)
singles = self.session.get_artist_albums_ep_singles(artist) for track in tracks:
for album in singles: data.append(track)
tracks = self.session.get_album_tracks(album.id) if config.app["services"]["tidal"]["include_singles"]:
for track in tracks: singles = self.session.get_artist_albums_ep_singles(artist)
data.append(track) for album in singles:
tracks = self.session.get_album_tracks(album.id)
for track in tracks:
data.append(track)
for search_result in data: for search_result in data:
s = base.song(self) s = base.song(self)
s.title = search_result.name s.title = search_result.name
@ -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):