forked from platypush/platypush
Added limit parameter to lastfm.get_similar_tracks
This commit is contained in:
parent
3d22d6b082
commit
115bed7d8b
1 changed files with 6 additions and 2 deletions
|
@ -164,12 +164,16 @@ class LastfmPlugin(Plugin):
|
||||||
}
|
}
|
||||||
|
|
||||||
@action
|
@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.
|
Get the tracks that are similar to a specific track.
|
||||||
|
|
||||||
:param artist: Track artist.
|
:param artist: Track artist.
|
||||||
:param title: Track title.
|
: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
|
:return: A list of similar tracks, each with a ``match`` score between
|
||||||
0 and 1. Example:
|
0 and 1. Example:
|
||||||
|
|
||||||
|
@ -209,7 +213,7 @@ class LastfmPlugin(Plugin):
|
||||||
'title': t.item.title,
|
'title': t.item.title,
|
||||||
'score': t.match,
|
'score': t.match,
|
||||||
}
|
}
|
||||||
for t in track.get_similar()
|
for t in track.get_similar(limit=limit)
|
||||||
]
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue