From 4c5cb88a61137f15912701ecd33fb5b5bb8ae407 Mon Sep 17 00:00:00 2001 From: localhost_frssoft Date: Thu, 15 Jun 2023 16:28:28 +0300 Subject: [PATCH] reorder for album tracks and artist tracks --- src/fw_albums.py | 2 +- src/fw_api.py | 8 ++++++-- src/fw_artists.py | 3 ++- 3 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/fw_albums.py b/src/fw_albums.py index 6611f5d..9a533d9 100644 --- a/src/fw_albums.py +++ b/src/fw_albums.py @@ -70,7 +70,7 @@ def list_albums(albums=None, pg=None, search=None, artist=None, library=None, in def play_album(album_id): - tracks = get_tracks(album=album_id, include_channels=True) + tracks = get_tracks(album=album_id, ordering='disc_number,position', include_channels=True) tracks_results = tracks.get('results') storage = {} for i in tracks_results: diff --git a/src/fw_api.py b/src/fw_api.py index 1147784..786ff50 100644 --- a/src/fw_api.py +++ b/src/fw_api.py @@ -100,11 +100,13 @@ def get_audio_file(track_uuid, listen_url=False, download=False, @logger.catch -def get_tracks(page=None, q=None, artist=None, album=None, library=None, +def get_tracks(page=None, ordering=None, q=None, + artist=None, album=None, library=None, tag=None, favourites=None, include_channels=None, pg=None): '''This function get tracks by params''' params = { 'page': page, + 'ordering': ordering, 'q': q, 'artist': artist, 'album': album, @@ -178,10 +180,12 @@ def get_artists(page=None, q=None, artist=None, album=None, @logger.catch -def get_albums(page=None, q=None, artist=None, library=None, include_channels=None, refresh=False, pg=None): +def get_albums(page=None, q=None, ordering=None, + artist=None, library=None, include_channels=None, refresh=False, pg=None): '''This function get artists by params''' params = { 'page': page, + 'ordering': ordering, 'q': q, 'artist': artist, 'library': library, diff --git a/src/fw_artists.py b/src/fw_artists.py index 8b28667..3e52b1f 100644 --- a/src/fw_artists.py +++ b/src/fw_artists.py @@ -55,7 +55,8 @@ def list_artists(pg=None, search=None, library=None, scope=None): def play_artist(artist_id): - tracks = get_tracks(artist=artist_id, include_channels=True, pg=None) + tracks = get_tracks(artist=artist_id, ordering='disc_number,position', + include_channels=True, pg=None) tracks_next = tracks.get('next') tracks_count = tracks.get('count') storage = {}