Skip to content

PHP app for displaying currently playing song from Spotify

Notifications You must be signed in to change notification settings

jarilehtinen/now-playing

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Now Playing

PHP/HTML/JavaScript app which displays currently playing song from Spotify along with additional information from LastFM.

When a song is not playing, app displays recently played tracks, total number of scrobbles etc.

Screenshot of Now Playing

Another screenshot of Now Playing

Installation

  1. Create an app on Spotify for Developers site

    Note: make sure the Redirect URI is the same than the SPOTIFY_REDIRECT_URI below.

  2. Create API account on LastFM

    Note: you can leave the Callback URL empty.

  3. Create /auth.php file containing following information:

    <?php
    
    define('KIOSK', false);
       
    define('LASTFM_USER', 'YOUR-LASTFM-USERNAME');
    define('LASTFM_API_KEY', 'YOUR-LASTFM-API-KEY');
    
    define('SPOTIFY_CLIENT_ID', 'YOUR-CLIENT-ID');
    define('SPOTIFY_CLIENT_SECRET', 'YOUR-CLIENT-SECRET');
    define('SPOTIFY_REDIRECT_URI', '/spotify-callback/');
    
    # Warning: Now Playing saves Spotify access tokens to the file below,
    # make sure it is in a secure place
    define('SPOTIFY_ACCESS_TOKENS_FILE_PATH', 'YOUR-PATH-TO-SPOTIFY-ACCESS-TOKENS');
  4. Run Composer php composer.phar install or if you have Composer installed globally composer install

    Composer installs Spotify Web API PHP. If you are not familiar with Composer, head to getcomposer.org.

What, why?

I stumbled upon Jason Tate's raspberry-pi-now-playing which fetched currently playing song from LastFM and displayed it on a Hyperpixel screen. I started to make some little changes, and after a while I ended up adding Spotify API. Eventually I pretty much rewrote the whole thing.

Jason has great instructions how to get it (his version) running on a Raspberry Pi and Hyperpixel screen. Check that out.

About

PHP app for displaying currently playing song from Spotify

Resources

Stars

Watchers

Forks

Packages

No packages published