All Projects → hankhank10 → music-screen-api

hankhank10 / music-screen-api

Licence: other
Display the playing Sonos track in real time on an e-ink display - also includes functionality for last.fm

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to music-screen-api

miso-bot
Discord bot with too many features
Stars: ✭ 41 (-53.41%)
Mutual labels:  lastfm, lastfm-api
lastfm
🎶 Last.fm API client for PHP. Comes with a Laravel service provider.
Stars: ✭ 17 (-80.68%)
Mutual labels:  lastfm, lastfm-api
zenreader
Makes your M5Paper an E-ink RSS Reader with built-in Reader mode, to solve annoyances with the Kindle Experimental browser.
Stars: ✭ 87 (-1.14%)
Mutual labels:  eink, e-ink
MusaicFM
Screensaver inspired by Apple’s inbuilt iTunes Screensaver. It can display Artwork by Spotify or last.fm Profile Data.
Stars: ✭ 223 (+153.41%)
Mutual labels:  lastfm, lastfm-api
nicholast.fm
Last.fm Stat Utility Web App
Stars: ✭ 17 (-80.68%)
Mutual labels:  lastfm, lastfm-api
vinyl-shelf-finder
app that manages a Discogs.com user records collection
Stars: ✭ 41 (-53.41%)
Mutual labels:  lastfm, lastfm-api
epaper-clock-and-more
e-paper clock + weather + AQI + traffic delays - using Waveshare 2.7inch & 4.2inch eink displays running on Raspberry Pi
Stars: ✭ 34 (-61.36%)
Mutual labels:  eink
amplyfm
A free and open-source web app for streaming music.
Stars: ✭ 46 (-47.73%)
Mutual labels:  lastfm
docker-node-sonos-http-api
Docker wrapper for https://github.com/jishi/node-sonos-http-api
Stars: ✭ 49 (-44.32%)
Mutual labels:  sonos
esp32-e-paper-weatherdisplay
An ESP32 and 4.2" ePaper Display reads Dark Sky weather API and displays the weather using ESP-IDF
Stars: ✭ 110 (+25%)
Mutual labels:  eink
MuditaOS
Mobile operating system based on FreeRTOS™ optimized for E Ink displays - developed for Mudita Pure minimalist phone
Stars: ✭ 349 (+296.59%)
Mutual labels:  e-ink
SupyPlugins
A collection of plugins for the Limnoria IRC bot.
Stars: ✭ 31 (-64.77%)
Mutual labels:  lastfm
scrobbler
A command-line Last.fm scrobbler and a now-playing status updater.
Stars: ✭ 22 (-75%)
Mutual labels:  lastfm
snapdroid
Snapcast client for Android
Stars: ✭ 84 (-4.55%)
Mutual labels:  sonos
lastcast
Scrobble music playing on Chromecast (from Spotify, Google Play, SoundCloud, ...) to last.fm and libre.fm
Stars: ✭ 73 (-17.05%)
Mutual labels:  lastfm
multi-scrobbler
Scrobble plays from multiple sources to multiple clients
Stars: ✭ 54 (-38.64%)
Mutual labels:  lastfm
SonosNPROneServer
NPR One Service for Sonos using the Sonos Music API (SMAPI)
Stars: ✭ 29 (-67.05%)
Mutual labels:  sonos
lastfm
Portable .Net library for Last.fm
Stars: ✭ 87 (-1.14%)
Mutual labels:  lastfm
kobowriter
A simple typewriter written in go for KOBO e-readers
Stars: ✭ 250 (+184.09%)
Mutual labels:  eink
plumeria
🤖 A Discord chat bot with rich data piping between commands
Stars: ✭ 35 (-60.23%)
Mutual labels:  lastfm

Music screen

A set of scripts to display current and recent music information.

It uses either the Pimoroni wHAT e-ink display to display track information; or the Pimoroni HyperPixel 4.0 Square (Non Touch) High Res display to display full colour album art.

Example of what it looks like

Works in real time with your local Sonos sytem. Also includes functionality to pull last played tracks and music history from last.fm.

No authentication required for either service.

Note: this replaces the now deprecated ink-music-stats repo.

Required hardware

Raspberry Pi 3 or 4 are recommended. The Pi 3 A+ is a smaller form factor which fits behind the HyperPixel Square display nicely as long as no more than one USB port is needed for other projects.

Raspberry Pi Zero W can be used with some stipulations noted here.

Pimoroni inky wHAT

Pimoroni HyperPixel 4.0 Square Non Touch

Step-by-step beginner installation instructions

I have put together step-by-step basic instructions:

Note that before running go_sonos_highres.py you need to create your own copy of sonos_settings.py: there is an example file in this repo as sonos_settings.py.example

Key dependencies to load if you know what you're doing and don't want to follow all the steps above

sudo apt install python3-tk
sudo apt install python3-pil 
sudo apt install python3-pil.imagetk
sudo pip3 install requests
sudo pip3 install aiohttp RPi.GPIO

Webhook updates

Enabling webhook support in the node-sonos-http-api configuration is strongly recommended. Without this enabled, the script must repeatedly poll to check for updates.

Webhook support for node-sonos-http-api can be enabled by updating/creating the settings.json configuration file located in the base of the node-sonos-http-api/ directory:

{
  "webhook": "http://localhost:8080/"
}

Note: This file does not exist by default and you may need to create it. Also note that the settings.js file is part of the node-sonos-http-api code and should not be modified.

The above configuration assumes that node-sonos-http-api is running on the same machine. If running on a different machine, replace localhost with the IP of the host running this script.

Backlight control

Thanks to a pull request from jjlawren the backlight of the Hyperpixel will turn off when music is not playing to save power & the environment.

If running Raspbian / Raspberry Pi OS, this should work out of the box. If running a different distribution, you'll need to run the following commands:

sudo pip3 install RPi.GPIO
sudo gpasswd -a pi gpio

REST API

The script exposes some REST API endpoints to allow remote control and integration options.

Method Endpoint Payload Notes
GET /state None Provides current playing state in JSON format.
POST /set-room room: name of room (str) Change actively monitored speaker/room.
POST /show-detail detail: 0/1, true/false (bool, required)

timeout: seconds (int, optional)
Show/hide the detail view. Use timeout to revert to the full album view after a delay. Has no effect if paused/stopped.

Examples:

curl http://<IP_OF_HOST>:8080/status
 -> {"room": "Bedroom", "status": "PLAYING", "trackname": "Living For The City", "artist": "Stevie Wonder", "album": "Innervisions", "duration": 442, "webhook_active": true}

curl --data "room=Kitchen" http://<IP_OF_HOST>:8080/set-room
 -> OK
 
curl --data "detail=true" --data "timeout=5" http://<IP_OF_HOST>:8080/show-detail
 -> OK

Important notice on Pi Zero

HyperPixel version

A Pi Zero W can run both node-sonos-http-api and the full color album art version as long as webhooks have been properly enabled. It updates slightly slower (1-2 seconds) than a Pi 3/4.

E-ink version

Note: The e-ink version has not been updated to use webhooks which the HyperPixel version uses and requires the performance tweaks below.

The e-ink script can be got running with a Pi Zero, however you will want to note two things:

  1. Save yourself a headache and ensure you're getting a Pi Zero WH (ie wireless and with headers pre-soldered)

  2. It runs pretty poorly on a Pi Zero due to the processing requirements. Actually this script runs fine, but it can struggle to do this and the http-sonos-api consistently. If you are set on running on a Pi Zero then either have the sonos-api running on a different local machine (and redirect to that IP address in sonos_settings.py) or set the Pi_Zero flag in sonos_settings.py to True (this slows down the frequency of requests)

(Thanks to reddit user u/Burulambie for helping me trouble shoot this)

Important notice on "demaster"

This script uses my "demaster" script to remove some of the nonsense from the end of track names which make them difficult to display (eg - Live at etc, (Remastered 2011), etc). This is highly recommended for displaying on a screen as otherwise it becomes unweildy to read the track names.

Two important points for you to note here:

  1. If you want to turn this off then you can by opening sonossettings.py and changing demaster to False. This will then show the full track name as reported by Sonos.

  2. Demaster makes use of an online API to efficiently reduce the track names and ensure that it is able to learn from previous amendments. This means that in default mode track names are sent to a remote server when they are played to get the shorter name. No personally identifying information is associated with this API request but if you're uncomfortable with this then rather than disabling demaster entirely then you can set it to run in offline only mode by setting the demaster_query_cloud option in your sonos_settings.py to False. This means that the local script will attempt to do some limited reduction of nonsense in track names, but you won't benefit from the latest algorithm to do this - but it's still a lot better than nothing if you're worried about privacy.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].