Old RaspberryPi Media Player

RaspberryPi with InkyPHAT eInk display

I found an old RaspberryPi B today that I used to use as a media player, it'd play random tracks all day long while I worked, and had an eInk display that'd show the track details. For posterity here's the bash files:



echo "Oppen MP3 Player"

while :
	rfile="$(find ./ -iname '*.mp3' -print0 | shuf -z -n1)"
	echo $rname

	artist="$(ffprobe -loglevel error -show_entries format_tags=artist -of default=noprint_wrappers=1:nokey=1 $rname)"
	track="$(ffprobe -loglevel error -show_entries format_tags=title -of default=noprint_wrappers=1:nokey=1 $rname)"
	album="$(ffprobe -loglevel error -show_entries format_tags=album -of default=noprint_wrappers=1:nokey=1 $rname)"
	figlet "$track - $artist"
	python phat.py -a "$artist" -t "$track" -al "$album" -s 22
	cvlc --play-and-exit "$rname"


This updates an InkyPHAT eInk display:

#!/usr/bin/env python

import os
import argparse
from PIL import Image, ImageDraw, ImageFont
from inky import InkyPHAT

PATH = os.path.dirname(__file__)

parser = argparse.ArgumentParser()
parser.add_argument('--artist', '-a', type=str, required=True, help="artist name")
parser.add_argument('--track', '-t', type=str, required=True, help="track name")
parser.add_argument('--album', '-al', type=str, required=True, help="album name")
parser.add_argument('--fontsize', '-s', type=int, required=True, help="enter font size")
args = parser.parse_args()

inky_display = InkyPHAT('black')


img = Image.new('1', (212, 104))

fontsize = args.fontsize
font = ImageFont.truetype("intermedium.ttf", fontsize) 
d = ImageDraw.Draw(img)
d.text((10,10), args.track, (255), font=font)
d.text((10,10 + fontsize + 5), args.artist, (255), font=font)
d.text((10,10 + fontsize + fontsize + 10), args.album, (255), font=font)



© 2019 - 2021 ÖLAB view in Gemini