Added limit parameter to lastfm.get_similar_tracks

This commit is contained in:
Fabio Manganiello 2022-06-06 14:12:45 +02:00
parent 3d22d6b082
commit 115bed7d8b
Signed by untrusted user: blacklight
GPG key ID: D90FBA7F76362774

View file

@ -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)
]