net.beardbot:lastfm-simple-scrobble-client

A simple scrobble client for Last.fm

License

License

Categories

Categories

Net CLI User Interface
GroupId

GroupId

net.beardbot
ArtifactId

ArtifactId

lastfm-simple-scrobble-client
Last Version

Last Version

1.0.2
Release Date

Release Date

Type

Type

jar
Description

Description

net.beardbot:lastfm-simple-scrobble-client
A simple scrobble client for Last.fm
Project URL

Project URL

https://github.com/calne-ca/lastfm-simple-scrobble-client
Source Code Management

Source Code Management

https://github.com/calne-ca/lastfm-simple-scrobble-client

Download lastfm-simple-scrobble-client

How to add to project

<!-- https://jarcasting.com/artifacts/net.beardbot/lastfm-simple-scrobble-client/ -->
<dependency>
    <groupId>net.beardbot</groupId>
    <artifactId>lastfm-simple-scrobble-client</artifactId>
    <version>1.0.2</version>
</dependency>
// https://jarcasting.com/artifacts/net.beardbot/lastfm-simple-scrobble-client/
implementation 'net.beardbot:lastfm-simple-scrobble-client:1.0.2'
// https://jarcasting.com/artifacts/net.beardbot/lastfm-simple-scrobble-client/
implementation ("net.beardbot:lastfm-simple-scrobble-client:1.0.2")
'net.beardbot:lastfm-simple-scrobble-client:jar:1.0.2'
<dependency org="net.beardbot" name="lastfm-simple-scrobble-client" rev="1.0.2">
  <artifact name="lastfm-simple-scrobble-client" type="jar" />
</dependency>
@Grapes(
@Grab(group='net.beardbot', module='lastfm-simple-scrobble-client', version='1.0.2')
)
libraryDependencies += "net.beardbot" % "lastfm-simple-scrobble-client" % "1.0.2"
[net.beardbot/lastfm-simple-scrobble-client "1.0.2"]

Dependencies

compile (6)

Group / Artifact Type Version
de.u-mass : lastfm-java jar 0.1.2
net.beardbot : lastfm-unscrobble jar 0.3
org.projectlombok : lombok jar 1.16.20
org.apache.commons : commons-lang3 jar 3.0
org.slf4j : slf4j-api jar 1.7.25
org.slf4j : slf4j-simple jar 1.7.25

test (3)

Group / Artifact Type Version
org.hamcrest : hamcrest-all jar 1.3
org.mockito : mockito-core jar 1.10.19
junit : junit jar 4.12

Project Modules

There are no modules declared in this project.

A simple Java Scrobble Client for Last.fm

This client uses jkovac's lastfm-java library for calls of the official Last.fm API as well as the 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

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

List<Scrobble> scrobbles = scrobbleClient.getAllScrobbles();

Fetching Scrobbles from a specific time

Temporal since = ZonedDateTime.now(ZoneOffset.UTC).minusDays(10);
List<Scrobble> scrobblesSince = scrobbleClient.getScrobblesSince(since);

Fetching a certain amount of Scrobbles

List<Scrobble> scrobbles = scrobbleClient.getLastScrobbles(100);

Scrobbling a Track

Scrobble scrobble = scrobbleClient.scrobble("LIQ","[un]INSOMNIA");

Setting the now playing status

Scrobble scrobble = scrobbleClient.nowPlaying("LIQ","[un]INSOMNIA");

Unscrobbling a Scrobble

Scrobble lastScrobble = scrobbles.get(0);
scrobbleClient.unscrobble(lastScrobble);

Updating Scrobble data

scrobble.setArtist("LIQ feat. 結月ゆかり");
scrobbleClient.updateScrobble(scrobble);

Maven Dependency

<dependency>
    <groupId>net.beardbot</groupId>
    <artifactId>lastfm-simple-scrobble-client</artifactId>
    <version>1.0.2</version>
</dependency>

Enable debug logging

-Dorg.slf4j.simpleLogger.defaultLogLevel=DEBUG

Versions

Version
1.0.2
1.0.1
1.0.0