Your Spotify logo

Your Spotify

  •  0 ratings
In category: Personal Dashboards

About Your Spotify

Allows you to record your Spotify listening activity and have statistics about them served through a Web application.

  •   364  
  •   0  
  •   0  
  •   0  
Github stats:
  •  Commits: 191  
  •   1,500  
  •   61  
  •  Latest commit: Apr 23, 2023  

Deploy this app to Linode with a free $100 credit!

Languages/Platforms/Technologies:
Lincenses:

  Depends on a proprietary service outside the user's control

More about Your Spotify

Client CI Server CI Donate

Your Spotify

YourSpotify is a self-hosted application that tracks what you listen and offers you a dashboard to explore statistics about it! It's composed of a web server which polls the Spotify API every now and then and a web application on which you can explore your statistics.

Table of contents

Prerequisites

  1. You have to own a Spotify application ID that you can create through their dashboard.
  2. You need to provide the Server environment the public AND secret key of the application (cf. Installation).
  3. You need to provide an authorized redirect URI to the docker-compose file.

A tutorial is available at the end of this readme.

Installation

Using docker-compose

Follow the docker-compose-example.yml to host your application through docker.

version: "3"

services:
  server:
    image: yooooomi/your_spotify_server
    restart: always
    ports:
      - "8080:8080"
    links:
      - mongo
    depends_on:
      - mongo
    environment:
      API_ENDPOINT: http://localhost:8080 # This MUST be included as a valid URL in the spotify dashboard (see below)
      CLIENT_ENDPOINT: http://localhost:3000
      SPOTIFY_PUBLIC: __your_spotify_client_id__
      SPOTIFY_SECRET: __your_spotify_secret__
  mongo:
    container_name: mongo
    image: mongo:6
    volumes:
      - ./your_spotify_db:/data/db

  web:
    image: yooooomi/your_spotify_client
    restart: always
    ports:
      - "3000:3000"
    environment:
      API_ENDPOINT: http://localhost:8080

Some ARM-based devices might have trouble with Mongo >= 5. I suggest you use the image mongo:4.4.

Installing locally (not recommended)

You can follow the instructions here. Note that you will still have to do the steps below.

Environment

Key Default value (if any) Description
CLIENT_ENDPOINT REQUIRED The endpoint of your web application
API_ENDPOINT REQUIRED The endpoint of your server
SPOTIFY_PUBLIC REQUIRED The public key of your Spotify application (cf Creating the Spotify Application)
SPOTIFY_SECRET REQUIRED The secret key of your Spotify application (cf Creating the Spotify Application)
CORS not defined List of comma-separated origin allowed, or nothing to allow any origin
MAX_IMPORT_CACHE_SIZE Infinite The maximum element in the cache when importing data from an outside source, more cache means less requests to Spotify, resulting in faster imports
MONGO_ENDPOINT mongodb://mongo:27017/your_spotify The endpoint of the Mongo database, where mongo is the name of your service in the compose file
PORT 8080 The port of the server, do not modify if you're using docker
TIMEZONE Europe/Paris The timezone of your stats, only affects read requests since data is saved with UTC time
LOG_LEVEL info The log level, debug is useful if you encouter any bugs

CORS

You can edit the CORS for the server:

  • all will allow every source.
  • origin1,origin2 will allow origin1 and origin2.

Creating the Spotify Application

For YourSpotify to work you need to provide a Spotify application public AND secret to the server environment. To do so, you need to create a Spotify application here.

  1. Click on Create a client ID.
  2. Fill out all the informations.
  3. Copy the public and the secret key into your docker-compose file under the name of SPOTIFY_PUBLIC and SPOTIFY_SECRET respectively.
  4. Add an authorized redirect URI corresponding to your server location on the internet adding the suffix /oauth/spotify/callback.
  5. use the EDIT SETTINGS button on the top right corner of the page.
  6. add your URI under the Redirect URIs section.
  7. i.e: http://localhost:8080/oauth/spotify/callback or http://home.mydomain.com/your_spotify_backend/oauth/spotify/callback
  8. Do not forget to hit the save button at the bottom of the popup.
  9. Once you have created your application, Spotify wants you to register the users that will be able to access the application. (You don't need to do that for the account that created the application)
  10. Click the Users and access button
  11. Click the Add new user button
  12. Enter the required information, a name and the email the user's spotify account has been created with.
  13. (Optional) You can Request extension if you do not want to register the users by hand.

Importing past history

By default, YourSpotify will only retrieve data for the past 24 hours once registered. This is a technical limitation. However, you can import previous data by two ways.

The import process uses cache to limit requests to the Spotify API. By default, the cache size is unlimited, but you can limit is with the MAX_IMPORT_CACHE_SIZE env variable in the server.

Supported import methods

Privacy data

Takes a maximum of 5 days. Only gets you the last year of history.

  • Request your privacy data at Spotify to have access to your history for the past year here.
  • Head to the Settings page and choose the Account data method.
  • Input your files starting with StreamingHistoryX.json.
  • Start your import.

Full privacy data

Takes a maximum of 30 days. Gets you the whole history since the creation of your account.

  • Request your Full privacy data to have access to your history data since the creation of the account here.
  • Head to the Settings page and choose the Extended streaming history method.
  • Input your files starting with endsongX.json.
  • Start your import.

Troubleshoot

An import can fail: - If the server reboots. - If a request fails 10 times in a row.

A failed import can be retried in the Settings page. Be sure to clean your failed imports if you do not want to retry it as it will remove the files used for it.

It is safer to import data at account creation. Though YourSpotify detects duplicates, some may still be inserted.

FAQ

How can I block new registrations?

From an admin account, go to the Settings page and hit the Disable new registrations button.

Songs don't seem to synchronize anymore.

This can happen if you revoked access on your Spotify account. To re-sync the songs, go to settings and hit the Relog to Spotify button.

The web application is telling me it cannot retrieve global preferences.

This means that your web application can't connect to the backend. Check that your API_ENDPOINT env variable is reachable from the device you're using the platform from.

A specific user does not use the application in the same timezone as the server, how can I set a specific timezone for him?

Any user can set his proper timezone in the settings, it will be used for any computed statistics. The timezone of the device will be used for everything else, such as song history.

External guides

Contributing

If you have any issue or any idea that could make the project better, feel free to open an issue. I'd love to hear about new ideas or bugs you are encountering.

Sponsoring

I work on this project on my spare time and try to fix issues as soon as I can. If you feel generous and think this project and my investment are worth a few cents, you can consider sponsoring it with the button on the right, many thanks.

Comments (0)

Please login to join the discussion on this project.

Your Spotify Reviews (0)

Overall Rating

None

based on 0 ratings

Please login to review this project.

No reviews for this project yet.

↑ back to top

pCloud Lifetime

Popular Projects

FluxBB

in Social Networks and Forums
 33k    0    0    0  

Nextcloud

in File Transfer & Synchronization
 20k    1    1    0  

Libreddit

in Social Networks and Forums
 7k    0    1    0  

Dashboard

in Personal Dashboards
 5k    0    0    0  

Audiobookshelf

in Audio Streaming
 5k    0    1    0  

CasaOS

in Self-hosting Solutions
 5k    0    0    0  

Mediagoblin

in Photo and Video Galleries
 4k    0    0    0  

Most Discussed

Nextcloud

in File Transfer & Synchronization
 20k    1    1    0  

Tube Archivist

in Automation
 3k    0    1    0  

OneDev

in Project Management
 2k    0    0    0  

iodine

in Proxy
 2k    0    0    0  

Alf.io

in Booking and Scheduling
 2k    0    0    0  

sysPass

in Password Managers
 1k    0    0    0  

Misskey

in Social Networks and Forums
 2k    0    0    0  
Linux VPS from $11/yr.
RackNerd VPS for $11.38/mo

Top Rated Projects

Gitea

 1 rating
in Project Management

Bagisto

 1 rating
in E-commerce

LinkAce

 1 rating
in Bookmarks and Link Sharing

Pydio

 1 rating
in File Transfer & Synchronization

Audiobookshelf

 1 rating
in Audio Streaming

Nextcloud

 1 rating
in File Transfer & Synchronization

Seafile

 1 rating
in File Transfer & Synchronization

Categories

You May Also Be Interested In

Newtelco Tab logo
Newtelco Tab cover

Newtelco Tab

Beautiful dashboard and new tab launcher with support for A…

Homer logo
Homer cover

Homer

A dead simple static homepage to expose your server service…

Organizr logo
Organizr cover

Organizr

Organizr aims to be your one stop shop for your Servers Fro…