Skip to content
No description, website, or topics provided.
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib
spec
.gitignore
.rspec
.travis.yml
Gemfile
Gemfile.lock
README.md
Rakefile
app.rb

README.md

#Geckoboard-Spotify

Build Status Coverage Status

A Geckoboard integration using the Spotify API that allows users to monitor data of a Spotify artist. It pulls data from Spotify API and pushes that data to Geckoboard Datasets API at a regular interval.

Dashboard sharing link

Prerequisites

  • Ruby 2.3.1

Installation

From the command line:

$ git clone https://github.com/yyl29/geckoboard-spotify.git
$ cd geckoboard-spotify
$ bundle

Create a file .env in the root directory, then add your Geckoboard API key:

GECKOBOARD_API_KEY='your_api_key'

Usage

Configure custom settings in app.rb. The defaults are set as follows:

ARTIST_ID = "43ZHCT0cAZBISjO8DG9PnE" # Spotify artist id for Elvis Presley
COUNTRY = "GB" # Country code for top tracks
UPDATE_INTERVAL = '10m' # Geckoboard update interval

The artist id can be found in the url address of the artist's Spotify page. E.g. 43ZHCT0cAZBISjO8DG9PnE for Elvis Presley(https://open.spotify.com/artist/43ZHCT0cAZBISjO8DG9PnE).

The country code is an ISO 3166-1 alpha-2 country code.

The update interval can have units in seconds, minutes, hours, days or weeks(s, m, h, d or w).

To run the app locally, run from the command line:

$ ruby app.rb

This will create a artist dataset (with the number of followers and popularity) and a top_tracks dataset (with top tracks of the artist and popularity of the tracks), you can then go to your dashboard to build some widgets from the datasets!

Test

From the command line:

$ rspec

Tools

This app is written in Ruby and uses the Geckoboard Datasets API to integrate with the Spotify API.

Ruby Net::HTTP is used to make HTTP request from Spotify API.

The following Ruby gems are also used:

The app is tested in Rspec. In order to stub external API services, I used the Ruby gem webmock and example json data (downloaded from real HTTP response) to control the responses.

Possible future improvements

  • Include a timestamp field so that data trend can be displayed over time
  • Use Spotify OAuth to access more data
  • Ability to include more artists
You can’t perform that action at this time.