lastfm
#
Description#
Plugin to interact with your Last.FM (https://last.fm) account, update your current track and your scrobbles.
Configuration#
lastfm:
# [Required]
# Last.FM API key, see https://www.last.fm/api
api_key:
# [Required]
# Last.FM API secret, see https://www.last.fm/api
api_secret:
# [Required]
# Last.FM username
username:
# [Required]
# Last.FM password, used to sign the requests
password:
Dependencies#
pip
pip install pylast
Alpine
apk add py3-pylast
Debian
apt install python3-pylast
Fedora
yum install python-pylast
Arch Linux
pacman -S python-pylast
Actions#
Module reference#
- class platypush.plugins.lastfm.LastfmPlugin(api_key, api_secret, username, password)[source]#
Bases:
Plugin
Plugin to interact with your Last.FM (https://last.fm) account, update your current track and your scrobbles.
- __init__(api_key, api_secret, username, password)[source]#
- Parameters:
api_key (str) – Last.FM API key, see https://www.last.fm/api
api_secret – Last.FM API secret, see https://www.last.fm/api
username – Last.FM username
password – Last.FM password, used to sign the requests
- get_recent_tracks(username: str | None = None, limit: int = 10, time_from: int | None = None, time_to: int | None = None) List[dict] [source]#
Get a list of recently played tracks.
- Parameters:
username – Target username (default: the one registered to this plugin).
limit – Maximum number of tracks to be returned (default: 10).
time_from – Return tracks starting from this time (as a UNIX timestamp).
time_to – Return tracks starting up to this time (as a UNIX timestamp).
- Returns:
Example:
[ { "artist": "Led Zeppelin", "title": "Stairway to Heaven", "album": "IV", "timestamp": 1654196137 } ]
- get_similar_tracks(artist: str, title: str, limit: int | None = None) List[dict] [source]#
Get the tracks that are similar to a specific track.
- Parameters:
artist – Track artist.
title – Track title.
limit – Maximum number of suggested tracks to be returned (default: None).
- Returns:
A list of similar tracks, each with a
match
score between 0 and 1. Example:[ { "artist": "Led Zeppelin", "title": "Black Dog", "score": 1.0 }, { "artist": "Led Zeppelin", "title": "Rock and Roll", "score": 0.89 }, { "artist": "Eagles", "title": "Hotel California", "score": 0.471 }, { "artist": "Deep Purple", "title": "Smoke on the Water", "score": 0.393 } ]
- get_track(artist: str, title: str) dict | None [source]#
Get the information about a track.
- Parameters:
artist – Track artist.
title – Track title.
- Returns:
The retrieved track, with the title corrected if required, if it exists on Last.FM. Example:
{ "artist": "Led Zeppelin", "title": "Stairway to Heaven", "tags": ["rock", "hard rock", "70s"] }