Giter Site home page Giter Site logo

esamanoaz / nfc-spotify-casting Goto Github PK

View Code? Open in Web Editor NEW
9.0 2.0 1.0 35 KB

Inspired by Hankhank's vinyl-emulator. Plays Spotify albums, playlists, and podcasts on any Google Home speaker or Chromecast. Spotify URIs are stored on NFC tags that are stuck on the back of printed album covers (or whatever image/art you want). Tapping the album art on the NFC reader plays the album, playlist, or podcast.

License: GNU General Public License v3.0

Python 95.26% Shell 4.74%

nfc-spotify-casting's Introduction

NFC Spotify Casting

Description

Inspired by vinyl-emulator. Hankhank's original version can be seen in this Reddit post. Plays Spotify albums, playlists, and podcasts on any device Spotify can connect to. Spotify URIs are stored on NFC tags that are stuck on the back of printed album covers (or whatever image/art you want). Tapping the album art on the NFC reader plays the album, playlist, or podcast.

Materials needed

  • A Raspberry Pi with a connection to the internet.
  • Python 3.6 or greater installed on the Raspberry pi.
  • A premium Spotify account.
  • An NFC reader. I used the ACR122U.
  • NFC tag stickers. I used the NTAG215 stickers.
  • Something to put the NFC tag stickers onto (album art).
  • Software to write the URIs to the NFC tags. I used the free NFC tools app on Android.

Instructions

  1. Download this repository onto the Raspberry Pi. You can do this using git clone in a command line or going to the repo page and clicking code -> download zip -> and then extract the files to your desktop.
  2. Follow the commented instructions in constants.py and fill out the file.
  3. Edit line 8 in startup.sh so that it changes directory to the correct path.
  4. Install the following Python packages with this command: sudo pip3 install -U package-name-here
    1. nfcpy
    2. spotipy
  5. Write Spotify URIs to NFC tags and apply them to whatever you chose, like album art. Spotify URIs can be found in the Spotify desktop app by right clicking the three dots next to an album, playlist, or show -> click share -> hold down the alt key on Windows or command key on Mac -> click the newly shown Copy Spotify URI button.
  6. Set the file startup.sh to an executable. You can do this by typing sudo chmod +x pathto/filename in the terminal.
  7. The Spotify app usually needs to be open on the device before running the program to be shown in the devices list.
  8. Type ./startup.sh into the Raspberry Pi terminal.
  9. Type y if you want debugging enabled or n if you don't.
  10. Select which device you would like to use by entering its number.
  11. Touch a tag to the NFC reader and take it off the reader after a second or two. Enjoy!

The first time you run the program and after any update you will need to log in. Doing so is a very simple process.

  1. First, run the program with ./startup.sh
  2. Enable debugging by typing y and hit enter.
  3. Read the instructions printed to the console or watch this video for more help.

nfc-spotify-casting's People

Contributors

esamanoaz avatar

Stargazers

Galileo Martinez avatar Lai Alexander Holmsen avatar skyskyhuh avatar  avatar  avatar Cody Bromley avatar Ali Naqvi avatar Lee Harding avatar  avatar

Watchers

 avatar  avatar

Forkers

aldavids

nfc-spotify-casting's Issues

Explicit filter does not work

I have some idea of how to do this because you can send a request to Spotify using spotipy to get information about a track. My idea is to loop through each track in a list of tracks gathered from a playlist or album and then ask if the song is explicit. If it is remove it from the list of tracks to play.

Can't find device path for RC522

I'm using an NFC module, an RC522.
The device is working when using normal read/write scripts, but doesn't get listed when using lsusb.

Episodes (podcasts) play in order old to new. The default should be new to old.

I am not quite sure what the most efficient way of doing this is. I have thought of asking Spotify for a list of all episodes and then flipping the order. That could work, but if the podcast has greater than 100 episodes that probably won't work. It seems like Spotify will only return the first 100 tracks of a playlist so I am sure it is the same here.

Playlists only play and shuffle the first 100 tracks

Playlists only play and shuffle the first 100 tracks. I think this could be fixed by using a for loop and asking Spotify for all the tracks in the playlist with offsets of 100 for each iteration through the for loop. Each iteration the next 100 tracks are added to the track list.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.