An open API service indexing awesome lists of open source software.

https://github.com/oliveroneill/wilt

Firebase project for viewing Wilt user play history
https://github.com/oliveroneill/wilt

cypress cypress-io firebase firestore plotly semantic-ui

Last synced: 5 months ago
JSON representation

Firebase project for viewing Wilt user play history

Awesome Lists containing this project

README

          

# Wilt - What I Listen To

[![Build Status](https://travis-ci.org/oliveroneill/wilt.svg?branch=master)](https://travis-ci.org/oliveroneill/wilt)

A project for tracking user's listening habits.

This repository contains:
- A browser client for diplaying metrics (in `public/`)
- A server-side API for helping clients query the database (in `functions/`).

This will display a timeline of play history for the specified user.
Inspired by [LastWave](https://github.com/taurheim/LastWave).

Clients:
- iOS: [Github](https://github.com/oliveroneill/wilt-ios)
- Android: [Github](https://github.com/oliveroneill/wilt-android)
- Browser (here, see `public/`)

## Installation
Create a `constants.js` file to specify the Google Cloud Functions backend and
username that you want to query on.
Format is:
```javascript
// Firebase config
const firebaseConfig = {
apiKey: '',
authDomain: '',
projectId: '',
};

// Spotify config
const spotifyConfig = {
clientId: '',
redirectUri: '',
};
```

Set firebase function configuration:
```bash
firebase functions:config:set spotify.client_id="" spotify.client_secret=""
```

## Setup
This project uses BigQuery, Firestore and Firebase Authentication.

### BigQuery
You'll need to create a BigQuery table called `wilt_play_history.play_history`.

#### Table Columns
play_history (BigQuery): user_id, date, artists, name, primary_artist, track_id

users (FireStore): access_token, expires_at, refresh_token

### FireStore
You'll need to create a table called `users`.

### WiltCollector

In order to periodically collect metrics from users, you'll also need
to set up [WiltCollector](https://github.com/oliveroneill/WiltCollector).
The README instructions will help you set this up with AWS Lambda.

## Testing
```bash
npm test
```
Tests are run using [cypress](https://www.cypress.io/).
To use the UI run `npm run cypress:open`, however for some reason the
visual regression tests will fail when run via the UI - I'm still investigating
this.

NOTE: the timezone for the tests is `Australia/Sydney`. This is a limitation of
cypress, documented [here](https://github.com/cypress-io/cypress/issues/1043).
Travis has been setup with this timezone.

The base snapshots were run on macOS and don't lineup the same when compared to
Linux. Potentially we should add different snapshots for each platform.

## Screenshot
The current graph is a stacked area graph for artist plays per week for a
specific user. Note: when you hover over points it will show *some*
points, however it won't show all of them.

![My play history](screenshot.png)

## TODO
- Testing around login page
- Better annotation placement
- Fix hover labels not showing every point