All Projects â†’ fspoettel â†’ thirtytwopixels

fspoettel / thirtytwopixels

Licence: MIT license
đŸ–ŧī¸ wireless LED album art display for spotify, mpd+ncmpcpp and other players.

Programming Languages

python
139335 projects - #7 most used programming language

Projects that are alternatives of or similar to thirtytwopixels

dotfiles
My personal dotfiles repository
Stars: ✭ 36 (-21.74%)
Mutual labels:  mpd, ncmpcpp
boombeastic
A Raspberry Pi based smart connected speaker with support for airplay, spotify, mpd and local playback
Stars: ✭ 206 (+347.83%)
Mutual labels:  spotify, mpd
dotfiles
🏡 Personal dotfiles configuration
Stars: ✭ 73 (+58.7%)
Mutual labels:  mpd, ncmpcpp
owntone-server
OwnTone is forked-daapd's new name. Linux/FreeBSD DAAP (iTunes) and MPD media server with support for AirPlay devices (multiroom), Apple Remote (and compatibles), Chromecast, Spotify and internet radio.
Stars: ✭ 1,408 (+2960.87%)
Mutual labels:  spotify, mpd
Rompr
Web client for Mopidy and MPD
Stars: ✭ 115 (+150%)
Mutual labels:  spotify, mpd
So Nice
Small Web interface to control iTunes, Spotify, Rdio, MPD, Rhythmbox, Amarok and XMMS2. â™Ģ
Stars: ✭ 141 (+206.52%)
Mutual labels:  spotify, mpd
dotfiles
rice repo
Stars: ✭ 71 (+54.35%)
Mutual labels:  mpd, ncmpcpp
Hifiberry Os
Linux distribution optimized for audio playback
Stars: ✭ 487 (+958.7%)
Mutual labels:  spotify, mpd
Forked Daapd
Linux/FreeBSD DAAP (iTunes) and MPD media server with support for AirPlay devices (multiroom), Apple Remote (and compatibles), Chromecast, Spotify and internet radio.
Stars: ✭ 1,073 (+2232.61%)
Mutual labels:  spotify, mpd
Deezer Downloader
Download music from Deezer with a nice front end
Stars: ✭ 127 (+176.09%)
Mutual labels:  spotify, mpd
Boombeastic
A Raspberry Pi based smart connected speaker with support for airplay, spotify, mpd and local playback
Stars: ✭ 195 (+323.91%)
Mutual labels:  spotify, mpd
neovim-spotify
Neovim plugin to control Spotify and Apple Music on macOS
Stars: ✭ 67 (+45.65%)
Mutual labels:  spotify
github-now-playing
đŸŽĩ Display what you're listening to right on your Github profile
Stars: ✭ 75 (+63.04%)
Mutual labels:  spotify
PasTerm
Genera combos a base de Keywords con Termux
Stars: ✭ 36 (-21.74%)
Mutual labels:  spotify
Cukatify
Cukatify is a music social media project
Stars: ✭ 21 (-54.35%)
Mutual labels:  spotify
simple-mpc
A GNU Emacs frontend to mpc.
Stars: ✭ 38 (-17.39%)
Mutual labels:  mpd
Mutify
An android app built with java to mute Spotify ads.
Stars: ✭ 61 (+32.61%)
Mutual labels:  spotify
Discord-Spotify-RPC
Spotify Rich Presence for Discord made in NodeJS
Stars: ✭ 48 (+4.35%)
Mutual labels:  spotify
spotify-song-recommender
A Spotify song recommendation engine built with the power of graph analytics.
Stars: ✭ 34 (-26.09%)
Mutual labels:  spotify
Lyricsx
đŸŽļ Ultimate lyrics app for macOS.
Stars: ✭ 3,251 (+6967.39%)
Mutual labels:  spotify

thirtytwopixels

Finished build in a dark room

wireless LED album art display

Supported players:

  • mpd+ncmpcpp
  • spotify
  • other players via the command-line interface

Hardware

  • Raspberry Pi Zero WH
  • Adafruit RGB Matrix Bonnet
  • A 32x32 LED matrix with a HUB75 connection (available on e.g. Adafruit, Pimoroni, Aliexpress). I used this one.
  • A 5V 4A power adapter

Refer to the Adafruit instructions to set it up. I recommend to do the PWM mod, it removed noticeable flicker for me. This requires minor soldering.

Setup

The project is split into two parts:

  • a server script that runs on a raspberry pi connected to the LED matrix
  • a client script that is invoked from ncmpcpp's config hooks and a CLI. Communication between client and server is handled by a 0MQ TCP socket.

Client

Clone this repo:

git clone https://github.com/fspoettel/thirtytwopixels

Install required modules:

pip3 install -r requirements.txt

Command-line interface (CLI)

  • python3 scripts/show.py <path_to_image> displays an arbitrary image
  • python3 scripts/clear.py clears the display

MPD integration

Add the following lines to ~/.ncmpcpp/config:

# errors and output is appended to syslog
execute_on_song_change="(path_to_repo/scripts/on_song_change.py &> /dev/null &)"
execute_on_player_state_change = "(path_to_repo/scripts/on_player_state_change.py &> /dev/null &)"

Make sure that our hooks are executable:

chmod +x scripts/on_song_change.py
chmod +x scripts/on_player_state_change.py

If your pi is not using the host name raspberrypi.local, you will need to adjust ZMQ_HOST in ./client/matrix_connection.py.

ℹī¸ It is assumed that cover.{jpg,png} files are stored in the album folders alongside music files. If that is not the case, you'll need to implement a module analogous to ./client/mpd.py and call its get_cover method in ./scripts/on_song_change.py. The method should return an absolute file system path to an image.

Server (Raspberry Pi)

Install raspbian on your pi and connect it to your network. ssh into it and make sure the following packages are installed:

sudo apt install python3 pip3 git libjpeg-dev

Clone this repo recursively to include the rpi-rgb-led-matrix submodule:

git clone --recursive https://github.com/fspoettel/thirtytwopixels

Install required modules. Note that the script needs to use sudo to interface with the hardware:

cd thirtytwopixels
sudo pip3 install -r requirements.txt

Setup rpi-rgb-led-matrix. This may take a while to complete.

cd matrix
make build-python PYTHON=$(which python3)
sudo make install-python PYTHON=$(which python3)

Set / adjust panel options in server/matrix_factory.py:

def matrix_factory(width):
    options = RGBMatrixOptions()
    # ...
    panel = RGBMatrix(options=options)
    return panel

Run the server:

sudo python3 server/server.py

You can now send test images to the panel via the cli. Once you are happy with the panel config, you can add the server as a systemd service which is started at startup. To do that, create the following file at /etc/systemd/system/thirtytwopixels.service:

[Unit]
Description=thirtytwopixels tcp server

[Service]
ExecStart=/usr/bin/python3 /usr/local/lib/thirtytwopixels/server/server.py

[Install]
WantedBy=default.target

and move the repo to /usr/local/lib/:

mv thirtytwopixels /usr/local/lib/
sudo chown root:root /usr/local/lib/thirtytwopixels/server/server.py
sudo chmod 644 /usr/local/lib/thirtytwopixels/server/server.py

You can then enable the service via:

sudo systemctl enable thirtytwopixels.service

Spotify

Caution: the cli and socket interface currently will not work if you are using spotify. If this is an issue for you, please open a feature request.

Create a spotify application. As redirect_url, set http://localhost:9090/callback. (feel free to change, it doesn't matter) Then run:

export SPOTIPY_CLIENT_ID=<app client id>
export SPOTIPY_CLIENT_SECRET=<app client secret>
export SPOTIPY_REDIRECT_URI="http://localhost:9090/callback"
./scripts/spotify_login.py

Open the displayed URL in your local browser and log into spotify. It redirects you to a non-existing http://localhost:9090/callback URL with some query params. Copy the URL and past it into the ssh terminal. If it worked, the message Succesfully logged in as user {you} should be displayed and a file .cache should be added in the repository root.

Edit the service to include spotify credentials. Run sudo systemctl edit thirtytwopixels.service and set enter the

[Service]
WorkingDirectory=/usr/local/lib/thirtytwopixels
Environment="SPOTIPY_CLIENT_ID=<app client id>"
Environment="SPOTIPY_CLIENT_SECRET=<app client secret>"
Environment="SPOTIPY_REDIRECT_URI=http://localhost:9090/callback"

Edit ./server/server.py, comment out the line provider = SocketBinding(panel) and uncomment the line provider = SpotifyBinding(panel).

Restart the server:

sudo systemctl restart thirtytwopixels.service

Pictures

Finished build in a light room
Back of finished build

In the wild

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].