From 115bed7d8b605ad88c6a89889f7a380816d0ed8b Mon Sep 17 00:00:00 2001 From: Fabio Manganiello Date: Mon, 6 Jun 2022 14:12:45 +0200 Subject: [PATCH] Added limit parameter to `lastfm.get_similar_tracks` --- platypush/plugins/lastfm/__init__.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/platypush/plugins/lastfm/__init__.py b/platypush/plugins/lastfm/__init__.py index ef8ef474..b34d2541 100644 --- a/platypush/plugins/lastfm/__init__.py +++ b/platypush/plugins/lastfm/__init__.py @@ -164,12 +164,16 @@ class LastfmPlugin(Plugin): } @action - def get_similar_tracks(self, artist: str, title: str) -> List[dict]: + def get_similar_tracks( + self, artist: str, title: str, limit: Optional[int] = None + ) -> List[dict]: """ Get the tracks that are similar to a specific track. :param artist: Track artist. :param title: Track title. + :param limit: Maximum number of suggested tracks to be returned + (default: None). :return: A list of similar tracks, each with a ``match`` score between 0 and 1. Example: @@ -209,7 +213,7 @@ class LastfmPlugin(Plugin): 'title': t.item.title, 'score': t.match, } - for t in track.get_similar() + for t in track.get_similar(limit=limit) ]