Skip to content

camcop/pixel-album-art

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pixel-album-art

gif

Overview

Dynamically display the currently playing album art on an LED matrix panel. This project integrates with Last.fm to fetch the album art and handles image format conversion, resizing, and uploading to the board.

Key Features

  • Service Agnostic: Compatible with any music service that scrobbles to Last.fm.
  • Public API Use: Utilizes a public API without the need for a sign-up.
  • Efficient API Use: Only polls the API every 10 seconds by default and does not pull the album art if it has not changed.
  • Auto Power Off: The LED matrix panel will automatically turn off after 10 minutes of inactivity (configurable).

Hardware

Hardware setup

  1. Follow Pimoroni's guide to attach the LED matrix panel to the Interstate75

  2. Install CircuitPython (tested with 9.1.3) on the Interstate75, following the guide from Pimoroni

  3. Attach the board to your computer via USB

Installation

  1. To set up the project, ensure you have Python installed and use the following command to install the required Python packages:
pip install -r requirements.txt
  1. Copy code.py from the interstate75 folder of the project to the root of the board (CIRCUITPY). This code will run every time the board boots.

  2. Press RST button on the board to restart.

Configuration

Before running the application, create a file called .env (without an extension) at the root of the project with the following content (replace your_lastfm_username with your username):

LASTFM_USER=your_lastfm_username

Then update the drive letter of the board in config.py to refer to the drive letter where CIRCUITPY is mounted, e.g.:

BOARD_DRIVE_LETTER = 'D'

Optional Configuration:

config.py:

  • LOOP_SLEEP_S: The time in seconds between each poll of the API. Default is 10 seconds.
  • REQUEST_TIMEOUT_S: The time in seconds to wait for a response from the API. Default is 10 seconds.
  • OUTPUT_IMAGE: The path to the image on the board that will be updated with the album art. Default is art.bmp. Ensure this matches OUTPUT_IMAGE in code.py.

code.py:

  • DISPLAY_TIMEOUT_S: The time in seconds that the LED matrix panel will display the same image before turning off. Default is 600 seconds (10 minutes).
  • OUTPUT_IMAGE: The path to the image on the board that will be updated with the album art. Default is art.bmp. Ensure this matches OUTPUT_IMAGE in config.py.

Usage

To start the application ensure the board is connected to the computer and run the main script:

python main.py

The board may require restarting after reattaching to the computer. Press the RST button on the back of the board to restart.

Dependencies

The project relies on a few external libraries, listed in requirements.txt:

  • Pillow for image processing
  • python-dotenv for environment variable management
  • Requests for making HTTP requests

Inspiration and resources

This project incorporates code from and was inspired by music-screen-api by hankhank10.

It was also inspired by my previous project NowPlaying (which displays the currently playing track on a Waveshare e-ink display), as well as a similar project on reddit.

To understand how to use the Last.fm API for fetching album art, refer to the Last.fm API documentation.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages