tidal: Add track number to results when tracks are part of an album in artist search
This commit is contained in:
parent
16d99aaaac
commit
10d60e3aa2
@ -4,6 +4,7 @@
|
||||
|
||||
* changes in Tidal:
|
||||
* In the settings dialog, you can control wether Albums, compilations and singles will be added when searching by artist (by using artist://...).
|
||||
* When searching by artists, results that belong to an album will be numbered.
|
||||
|
||||
## Version 0.6
|
||||
|
||||
|
@ -81,9 +81,13 @@ class interface(base.baseInterface):
|
||||
for album in singles:
|
||||
tracks = self.session.get_album_tracks(album.id)
|
||||
for track in tracks:
|
||||
track.single = True
|
||||
data.append(track)
|
||||
for search_result in data:
|
||||
s = base.song(self)
|
||||
if not hasattr(search_result, "single"):
|
||||
s.title = "{0}. {1}".format(self.format_number(search_result.track_num), search_result.name)
|
||||
else:
|
||||
s.title = search_result.name
|
||||
s.artist = search_result.artist.name
|
||||
s.duration = seconds_to_string(search_result.duration)
|
||||
@ -92,6 +96,12 @@ class interface(base.baseInterface):
|
||||
self.results.append(s)
|
||||
log.debug("{0} results found.".format(len(self.results)))
|
||||
|
||||
def format_number(self, number):
|
||||
if number < 10:
|
||||
return "0%d" % (number)
|
||||
else:
|
||||
return number
|
||||
|
||||
def get_download_url(self, url):
|
||||
url = self.session.get_media_url(url)
|
||||
if url.startswith("https://") or url.startswith("http://") == False:
|
||||
|
Loading…
Reference in New Issue
Block a user