Skip to content

Setting up Last.fm connection

Pauli Järvinen edited this page Jan 14, 2021 · 3 revisions

It is possible to set up the Music app to show details about artists, albums, and songs from the Last.fm service. Setting this up is a two-phase process:

  1. Obtain an API key from Last.fm
  2. Insert that API key to your config/config.php

(note: scrobbling to Last.fm is not supported for now)

1. Getting the API key

To get the API key, first navigate to https://www.last.fm/api/account/create. If you aren't already logged in to Last.fm, you are required to do so, or create a new account if you don't have one already. When you are logged in, the previous link should take yout to a form like this:

Last.fm API key creation form

You don't need to worry about the rest of the fields, but just enter your contact email and the application name and hit Submit. It doesn't really matter, which application name you give; you are the only one who is going to see this name and you can use it to identify this key if you would register several.

After submitting the form, you should be shown a view like this:

Last.fm has created a new API key

Here, the only significant piece of information is the long string of letters and numbers after the label "API key".

2. Inserting the API key to your config file

After you have the Last.fm API key, you should add it to the config file of your cloud instance. If, for example, you have installed ownCloud to /var/www/html/owncloud, the settings file can be found from /var/www/html/owncloud/config/config.php. For Nextcloud, the path is the same, just substitute owncloud with nextcloud.

Once you have the file open, you need to add one new key-value pair to the file, using the previously obtained API key. It should look something like

'music.lastfm_api_key' => 'c5bdc58a62113d1fa78fca85a712b18a',

(note: the API key shown above is not a real, working key)

3. Enjoy

You should now be all set up. You shall find data from Last.fm by clicking the "i" icon after any artist or album name in the Albums view of the Music app. There is information available about almost any artist you can imagine and about a great number of albums, too.

Last.fm data about artists is provided also via the Subsonic API; at least the DSub client application can utilize this data.