1.1.2 • Published 6 years ago

spotify-activity-listener v1.1.2

Weekly downloads
4
License
ISC
Repository
github
Last release
6 years ago

Spotify Activity Listener

Poll Last.fm for your recent Spotify listening data.

Demo

The gif failed to load, please refresh your browser!

Prerequisite Configuration

  1. Create a Last.fm account
  2. Enable API access for your account
  3. Make note of your API key The image failed to load, please refresh your browser!
  4. In Spotify, go to Settings > Last.fm and select Connect to Last.fm The image failed to load, please refresh your browser!

Installation

  1. npm i spotify-activity-listener --save

Usage

Full Usage Example (React.js)

  • Import the listener:
import SpotifyListener from 'spotify-activity-listener';
// Or
var SpotifyListener = require('spotify-activity-listener');
  • Instantiate the listener:
var Listener = new SpotifyListener({
  username: 'YOUR_LAST.FM_USERNAME',
  key: 'YOUR_LAST.FM_API_KEY',
  pollInterval: 5000, // (Milliseconds)
  trackCount: 1, // Capped at 50 by Last.fm
  callback: (res) => {
    // Handle response data here
  }
});
  • Start listening
Listener.startListening();
  • Stop listening (if need be)
Listener.stopListening();

Response Format

[
  {
    album: "Atrocity Exhibition",
    art: "https://lastfm-img2.akamaized.net/i/u/300x300/514bed1643432ccf69854d30e35d24ba.png",
    artist: "Danny Brown",
    name: "Downward Spiral"
  },
  { /* (...) */ },
  { /* (...) */ }
]

Contribute

  1. Fork it
  2. Create your branch
  3. Make some changes
  4. Commit the changes
  5. Submit a pull request
1.1.2

6 years ago

1.1.1

6 years ago

1.1.0

8 years ago

1.0.6

8 years ago

1.0.5

8 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago