diff --git a/maloja/apis/native_v1.py b/maloja/apis/native_v1.py index 775175d..aea7710 100644 --- a/maloja/apis/native_v1.py +++ b/maloja/apis/native_v1.py @@ -347,7 +347,23 @@ def get_artists_external(k_filter, k_limit, k_delimit, k_amount): } +@api.get("albums") +@catch_exceptions +@add_common_args_to_docstring(filterkeys=True) +@convert_kwargs +def get_albums_external(k_filter, k_limit, k_delimit, k_amount): + """Returns all albums (optionally of an artist). + :return: list (List) + :rtype: Dictionary""" + + ckeys = {**k_filter} + result = database.get_albums(**ckeys) + + return { + "status":"ok", + "list":result + } @api.get("charts/artists") @@ -536,6 +552,20 @@ def track_info_external(k_filter, k_limit, k_delimit, k_amount): return database.track_info(**ckeys) +@api.get("albuminfo") +@catch_exceptions +@add_common_args_to_docstring(filterkeys=True) +@convert_kwargs +def album_info_external(k_filter, k_limit, k_delimit, k_amount): + """Returns information about an album + + :return: album (Mapping), scrobbles (Integer), position (Integer), medals (Mapping), certification (String), topweeks (Integer) + :rtype: Dictionary""" + + ckeys = {**k_filter} + return database.album_info(**ckeys) + + @api.post("newscrobble") @authenticated_function(alternate=api_key_correct,api=True,pass_auth_result_as='auth_result') @catch_exceptions