https://github.com/calne-ca/lastfm-simple-scrobble-client
A simple Java Scrobble Client for Last.fm
https://github.com/calne-ca/lastfm-simple-scrobble-client
java last-fm lastfm scrobble unscrobble
Last synced: about 9 hours ago
JSON representation
A simple Java Scrobble Client for Last.fm
- Host: GitHub
- URL: https://github.com/calne-ca/lastfm-simple-scrobble-client
- Owner: calne-ca
- License: gpl-3.0
- Created: 2018-05-05T20:23:41.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2025-07-12T00:48:52.000Z (11 months ago)
- Last Synced: 2026-05-05T04:44:37.401Z (about 1 month ago)
- Topics: java, last-fm, lastfm, scrobble, unscrobble
- Language: Java
- Size: 48.8 KB
- Stars: 0
- Watchers: 0
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
## A simple Java Scrobble Client for Last.fm
This client uses [jkovac's](https://github.com/jkovacs) [lastfm-java](https://github.com/jkovacs/lastfm-java) library for calls of the official [Last.fm API](https://www.last.fm/api/intro) as well as the [lastfm-unscrobble-java](https://github.com/calne-ca/lastfm-unscrobble-java) library for unscrobbling and updating Scrobbles.
The purpose of this library is to simplify all interactions with Last.fm concerning scrobbles as well as providing extended features - relying on official and unofficial features of Last.fm - such as scrobble updating.
### Usage
**Initializing the Scrobble Client**
```java
LastfmAuthenticationDetails authenticationDetails = new LastfmAuthenticationDetails();
authenticationDetails.setApiKey("api-key");
authenticationDetails.setSharedSecret("shared-secret");
authenticationDetails.setUsername("username");
authenticationDetails.setPassword("password");
ScrobbleClient scrobbleClient = new ScrobbleClient();
try {
scrobbleClient.login(authenticationDetails);
} catch(LastfmAuthenticationException e){
System.err.println(e.getMessage());
}
```
Not all authentication details are mandatory depending on what you want to do. Certain operations require certain authentication details as shown in the table below:
| | Scrobbling | Fetching Scrobbles | Unscrobbling | Updating Scrobbles |
| ------------- | :-------------: | :-------------: | :-------------: | :-------------: |
| API key | X | X | | X |
| Shared Secret | X | | | X |
| Username | X | X | X | X |
| Password | X | | X | X |
So if for example you only want to fetch scrobble data from a user then the username and your API key is sufficient.
**Fetching all Scrobbles**
```java
List scrobbles = scrobbleClient.getAllScrobbles();
```
**Fetching Scrobbles from a specific time**
```java
Temporal since = ZonedDateTime.now(ZoneOffset.UTC).minusDays(10);
List scrobblesSince = scrobbleClient.getScrobblesSince(since);
```
**Fetching a certain amount of Scrobbles**
```java
List scrobbles = scrobbleClient.getLastScrobbles(100);
```
**Scrobbling a Track**
```java
Scrobble scrobble = scrobbleClient.scrobble("LIQ","[un]INSOMNIA");
```
**Setting the *now playing* status**
```java
Scrobble scrobble = scrobbleClient.nowPlaying("LIQ","[un]INSOMNIA");
```
**Unscrobbling a Scrobble**
```java
Scrobble lastScrobble = scrobbles.get(0);
scrobbleClient.unscrobble(lastScrobble);
```
**Updating Scrobble data**
```java
scrobble.setArtist("LIQ feat. 結月ゆかり");
scrobbleClient.updateScrobble(scrobble);
```
### Maven Dependency
```xml
net.beardbot
lastfm-simple-scrobble-client
1.0.2
```
### Enable debug logging
```bash
-Dorg.slf4j.simpleLogger.defaultLogLevel=DEBUG
```