Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Platypush
platypush
Commits
115bed7d
Verified
Commit
115bed7d
authored
Jun 06, 2022
by
Fabio Manganiello
Browse files
Added limit parameter to `lastfm.get_similar_tracks`
parent
3d22d6b0
Pipeline
#253
passed with stages
in 6 minutes and 4 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
platypush/plugins/lastfm/__init__.py
View file @
115bed7d
...
...
@@ -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
)
]
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment