From b255d424eed2eb30c64d5c43b4ac62d01617eae5 Mon Sep 17 00:00:00 2001 From: krateng Date: Fri, 15 Apr 2022 17:49:13 +0200 Subject: [PATCH] Native API accepts superfluous keywords, FoxxMD/multi-scrobbler#42 --- maloja/apis/native_v1.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/maloja/apis/native_v1.py b/maloja/apis/native_v1.py index 684ef06..761c23a 100644 --- a/maloja/apis/native_v1.py +++ b/maloja/apis/native_v1.py @@ -320,7 +320,8 @@ def post_scrobble( length:int=None, time:int=None, nofix=None, - auth_result=None): + auth_result=None, + **extra_kwargs): """Submit a new scrobble. :param string artist: Artist. Can be submitted multiple times as query argument for multiple artists. @@ -358,15 +359,22 @@ def post_scrobble( ) if result: - return { + response = { 'status': 'success', 'track': { 'artists':result['track']['artists'], 'title':result['track']['title'] } } + if extra_kwargs: + response['warnings'] = [ + {'type':'invalid_keyword_ignored','value':k} + for k in extra_kwargs + ] else: - return {"status":"failure"} + response = {"status":"failure"} + + return response