From ec77ee6091e3ea20f20b34cc3c00fcd195c5264f Mon Sep 17 00:00:00 2001 From: duck <113956421+duckfromdiscord@users.noreply.github.com> Date: Thu, 7 Sep 2023 22:47:19 -0400 Subject: [PATCH 1/3] Add a top album function to the native API --- maloja/apis/native_v1.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/maloja/apis/native_v1.py b/maloja/apis/native_v1.py index 94ac451..422c17f 100644 --- a/maloja/apis/native_v1.py +++ b/maloja/apis/native_v1.py @@ -400,7 +400,23 @@ def get_top_tracks_external(**keys): "list":results } +@api.get("top/albums") +@catch_exceptions +@add_common_args_to_docstring(limitkeys=True,delimitkeys=True) +def get_top_albums_external(**keys): + """Returns respective number 1 albums in specified time frames + :return: list (List) + :rtype: Dictionary""" + _, k_time, k_internal, _, _ = uri_to_internal(keys) + ckeys = {**k_time, **k_internal} + + results = database.get_top_albums(**ckeys) + + return { + "status":"ok", + "list":results + } @api.get("artistinfo") From 49339325860e36914c429102384123a88a649858 Mon Sep 17 00:00:00 2001 From: duck <113956421+duckfromdiscord@users.noreply.github.com> Date: Thu, 7 Sep 2023 23:12:35 -0400 Subject: [PATCH 2/3] Add albums to the native API chart function --- maloja/apis/native_v1.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/maloja/apis/native_v1.py b/maloja/apis/native_v1.py index 422c17f..c6f32b5 100644 --- a/maloja/apis/native_v1.py +++ b/maloja/apis/native_v1.py @@ -314,7 +314,23 @@ def get_charts_tracks_external(**keys): "list":result } +@api.get("charts/albums") +@catch_exceptions +@add_common_args_to_docstring(filterkeys=True,limitkeys=True) +def get_charts_albums_external(**keys): + """Returns album charts + :return: list (List) + :rtype: Dictionary""" + k_filter, k_time, _, _, _ = uri_to_internal(keys,forceArtist=True) + ckeys = {**k_filter, **k_time} + + result = database.get_charts_albums(**ckeys) + + return { + "status":"ok", + "list":result + } @api.get("pulse") From 0c2afcedd30c1a9c3747d2aa886e47f289c6157e Mon Sep 17 00:00:00 2001 From: duck <113956421+duckfromdiscord@users.noreply.github.com> Date: Wed, 4 Oct 2023 17:10:58 -0400 Subject: [PATCH 3/3] Fix native API top album function requiring an artist --- maloja/apis/native_v1.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/maloja/apis/native_v1.py b/maloja/apis/native_v1.py index c6f32b5..41bf560 100644 --- a/maloja/apis/native_v1.py +++ b/maloja/apis/native_v1.py @@ -322,7 +322,7 @@ def get_charts_albums_external(**keys): :return: list (List) :rtype: Dictionary""" - k_filter, k_time, _, _, _ = uri_to_internal(keys,forceArtist=True) + k_filter, k_time, _, _, _ = uri_to_internal(keys) ckeys = {**k_filter, **k_time} result = database.get_charts_albums(**ckeys)