Last.Fm Integration
Last.Fm integration is provided via the lastfm package, which is a Service Provider. Because it is a standalone package, it must be connected to Last.Fm.
API Setup
Because using Qilletni is essentially using an API and not an end application, you must create Last.Fm API keys for your account.
To create an API, sign into https://www.last.fm/api/account/create and fill out the information, and click Submit. The Callback URL is not required.
From there, copy the API Key and Shared Secret, and run the following qilletni
command in your console:
Where api-key
is your API Key, such as f8ea7243239ec13d1ab6b858532c5b32
, and api-secret
is your Shared Secret, such as 7f713e749d63adeab805ed78c9585f11
.
Database Setup
The Last.Fm package also needs database access for caching music data. If using the default Docker Postgres settings from Getting Started, the following settings are populated by default and do not need manual setting:
| Property | Value |
| ------------ | ------------------------------------------------- |
| dbUsername | qilletni |
| dbUrl | jdbc:postgresql://localhost:5435/qilletni_lastfm |
| dbPassword | pass |
To set these manually, the following may be ran:
Using The Package
The following is a quick example of a Qilletni program. Follow the Getting Started guide to create a project, and add the following dependency in your qilletni_info.yml
file:
And make a basic program, which checks the most recent 50 songs played on your account:
import "lastfm:lastfm.ql"
LastFmResult result = getRecentTracks("RubbaBoy")
if (result.isError()) {
printf("Error: %s", [result.errorMessage])
exit(1)
}
printf("Recent Tracks:\n\t%s", [result.data])
Which should output something similar to:
Recent Tracks:
[song("Euclid" by "Sleep Token"), song("Take Me Back to Eden" by "Sleep Token"), ...]
For more usage of the Last.Fm package, see the Last.Fm Package Page.