Skip to main content

# Lastfm (Endpoint)

This Source enables multi-scrobbler to accept scrobbles from outside applications as if it was a Last.fm server.

Other Uses

- To scrobble to Last.fm, create a Last.fm (Client)
- To monitor and re-scrobble activity from your Last.fm account, create a Last.fm (Source)

Recommended Alternative

This Source has the same data limitations as the Last.fm (Source) and Last.fm (Client) have: Last.fm does not support separating artists/album artists fields which means any multi-artist tracks will have all artists combined into one string. This makes scrobbling to other services, and using metadata corrections like Musicbrainz, more difficult.

If your application has the option to scrobble using Listenbrainz then use the Listenbrainz (Endpoint) Source instead.

## Setup​

Scenario Picker

Use one of the scenarios below based on how on your service(s) (things "scrobbling" to Multi-Scrobbler using this Source) will need to interact with MS.

- One Service
- Many Services, Same User
- Many Services, Many Users, Can use LFM Account
- Many Services, Many Users, Cannot use LFM Account
- Service cannot use standard URL

> You have one service, like Panoscrobbler, that will scrobble to Multi-Scrobbler.

Configure one Last.fm Endpoint Source. Use the standard base URL to configure your service and apikey/user, if necessary. Use the same apikey/user in MS as you do in your service.

> You may have more than one service that will scrobble to Multi-Scrobbler, like ArchiveTune and Panoscrobbler.

> All of these services will scrobble for the same user (you) and all of the scrobbles should go to the same Clients.

Configure one Lastfm Endpoint Source. Use the standard base URL to configure your service and configure apikey/user in MS, if necessary. Use the same apikey/user for all your services as you configure in MS.

> You have more than one service that will scrobble to Multi-Scrobbler, like ArchiveTune and Panoscrobbler.

> Some of these services should scrobble for different users, scrobble to different Clients, or generally be treated differently (such as for transforms).

> All of these services can accept a apikey/user to authenticate a Last.fm user/account.

Configure one Last.fm Endpoint Sources per service that should be treated differently. That is, if multiple services are all "the same user" then you only need one Source for that entire group of services.

For each Lastfm Endpoint Source, configure a different apikey/user. Use that same apikey/user when configuring Last.fm for the associated service.

All Last.fm Endpoint Sources should use the same standard base URL.

> You have more than one service that will scrobble to Multi-Scrobbler, like ArchiveTune and Panoscrobbler.

> Some of these services should scrobble for different users, scrobble to different Clients, or generally be treated differently (such as for transforms).

> All, or some, of these services cannot accept an apikey/user to authenticate a Last.fm user/account.

This is not a common scenario but if it fits your usecase then use these guidelines to differentiate your services:

Configure one Last.fm Endpoint Sources per service that should be treated differently. That is, if multiple services are all "the same user" then you only need one Source for that entire group of services.

- For any groups of services that can use apikey/user, use the instructions for Many Services, Many Users, Can use LFM Account
- For any groups of services that cannot accept an apikey/user...
  - You can still configure a Source without an apikey/user. Any services not using an account will use this "default" Source.
  - If multiple groups cannot use an apikey/user, or the groups cannot use the standard base URL, then use different base url Slugs.

> You have one service, like PanoScrobbler, that will scrobble to Multi-Scrobbler.

> You have already tried the One Service scenario with the standard base URL but it is not working.

This is not a common scenario. Check the Troubleshooting URL section before trying this.

At this point, you can try to use a different base url Slug. Your service must be able to set a "fully custom" URL for Last.fm IE it must allow you to set more than just a domain/host.

### Standard Base URL​

When setting up your Last.fm client to communicate with Multi-Scrobbler replace the Last.fm domain with your Multi-Scrobbler domain:

https://last.fm => https://yourMSDomain

MS accepts Last.fm API calls with the same url base and structure as the last.fm api, IE `http://yourMSDomain/2.0/`

### Authentication​

If you are only setting up one Lastfm Endpoint Source then you do not need to configure any explicit username/apiKey/password for MS. If your Last.fm Client requires these credentials use any fake values you want.

Supported Auth Types

Currently, Multi-Scrobbler only supports the Mobile Application auth flow. If your client requires one of the other authentication flows please open an issue.

Note: Your client does not need to implement any auth in order to use a Lastfm Endpoint Source. You can directly make `track.scrobble` or `track.updateNowPlaying` api calls to `http://yourMSDomain/2.0/` with any fake auth data you want.

### Multiple Sources​

If you need configure more than one Lastfm Endpoint Source then you should configure username/apiKey for MS, per Source. This enables MS to differentiate scrobbles for each Source.

Use the same username and/or API Key you configure with MS when setting up your Last.fm Client. These values can be anything you want, as long as they match between MS and your client. Password can be anything and is not checked.

However, if you cannot configure username/apiKeys for your scenario you may also use a URL Slug to tell MS which Source belongs to a specific user. This is not a common scenario and should only be used if username/apiKey configuration is not sufficient or not possible.

Different URL Base (Slug)

If you cannot use different username/apiKey per Source (or Last.fm Client) you can still differentiate Sources by using a different url base (slug) for Last.fm communication.

Setting a slug in config will change the url base for MS like this:

    slug: "mySlug"

    http://yourMsDomain/api/lastfm/mySlug

The above url base is equivalent to making calls to `http://yourMSDomain/2.0/`

## Troubleshooting URL​

If you think your service should be able to use the standard base URL but it is not working follow these steps before trying the the base URL Slug.

#### Verify URL Format​

Some service may require `http/https` in the URL format (`http://myMSDomainOrIp:9078`) while others may not (`myDomainOrIp:9078`). Check the docs for your service to see if they specify this or have an example. Try both versions, if possible, to see if one works.

Some Services Require HTTPS

Some services that can scrobble to a custom Last.fm URL may require the URL to have a real domain (`example.com`) and/or use SSL (`https://`). In this case you should setup multi-scrobbler behind a reverse proxy to support this functionality.

#### Is MS is Reachable?​

Verify that MS can be accessed by your service, or from the same host as the service is running. See the FAQ for guidance on troubleshooting ingress connection issues.

#### Service Logging​

If you service has accessible logging, check to see if it outputs the URL it is trying to reach when authenticating the Last.fm apiKey/user, or trying to make a scrobble request.

If you decide to report this issue, please include this logging in your issue.

## Configuration​

- ENV
- File
- AIO

Configuration Type

This is configuration for the ENV Config Type.

Environmental Variable | Type | Default | Description
--- | --- | --- | ---
`LFM_ID` | string |  | A globally unique ID EX `myComponentId`
`LFM_NAME` | string | Value of `LFM_ID` | A vanity name EX `My Cool Component`
`LFM_ENABLE` | boolean | true | Should this component be used?
`LFM_SLUG` | string |  | When using multiple sources without apikey/user, or not using the standard base URL, this is the URL base path that should be used to identify scrobbles for this source
`LFM_USERNAME` | string |  | A fake username to differentiate LFM Endpoint Sources
`LFM_API_KEY` | string |  | A fake api key to differentiate LFM Endpoint Sources

Bold/Italic = Required

Config Structure

This displays the structure of the File Configuration for a endpointlfm type Source with all possible properties, their shape, and descriptions/types. Use this to understand how to write a valid config.

Loading ...
Config Example

This displays an example config file of a endpointlfm Source File Configuration that adheres to the shown Config Structure.

- text mode lets you edit the JSON directly.
- tree mode gives you a guided point-and-click editing experience that always keeps the JSON syntax valid.

Both modes validate that the configuration is correct. Any errors show up as squiggly lines.

important

Only source endpointlfm configs will validate correctly in the editor but both source and client endpointlfm configs are allowed in the real `CONFIG/endpointlfm.json`

After you finish editing, switch to text and then copy all text to get a completed config.

Config Example Mobile Experience

This displays an example config file of a endpointlfm Source File Configuration that adheres to the shown Config Structure.

The example config file editor is meant for a larger screen experience so only the read-only example is shown. Please use this site on a tablet/laptop/desktop to enable file editor features.

CONFIG/endpointlfm.json

    [
      {
        "name": "LFM For App",
        "enable": true,
        "id": "myLfmApp",
        "data": {
          "slug": "mySlug"
        }
      }
    ]

Config Structure

This displays the structure of the all-in-one (`config.json`) configuration with all possible properties, their shape, and descriptions/types. Use this to understand how to write a valid config.

Select the endpointlfm type from the respective `sources` node below, then expand it.

Loading ...
Config Example

This displays an example config file of a all-in-one (`config.json`) configuration that includes a endpointlfm Source that adheres to the shown Config Structure.

- text mode lets you edit the JSON directly.
- tree mode gives you a guided point-and-click editing experience that always keeps the JSON syntax valid.

Both modes validate that the configuraion is correct. Any errors show up as squiggly lines.

After you finish editing, switch to text and then copy all text to get a completed config.

Config Example Mobile Experience

This displays an example config file of a all-in-one (`config.json`) configuration that includes a endpointlfm Source that adheres to the shown Config Structure.

The example config file editor is meant for a larger screen experience so only the read-only example is shown. Please use this site on a tablet/laptop/desktop to enable file editor features.

CONFIG/config.json

    {
      "sources": [
        {
          "name": "LFM For App",
          "enable": true,
          "id": "myLfmApp",
          "data": {
            "slug": "mySlug"
          },
          "type": "endpointlfm"
        }
      ]
    }