idcrook / shairport-sync-mqtt-display

Display currently playing info, with remote control, using shairport-sync's MQTT support
MIT License
31 stars 6 forks source link

Missing readme details #41

Closed kylejohnsonkj closed 3 years ago

kylejohnsonkj commented 3 years ago

Hey there, I saw the flaschen-taschen support in this project for airplaying cover art to a matrix. Totally awesome. I have it working with mine now (thank you for the detailed readmes). Only at a couple points did I have to do a little research because things weren't working, so I figured I'd note them. I was going to make a pull request but I don't know how to for the wiki.

One thing that was missing was the actual installation of mosquitto. It was self-explanatory but would be nice to include since there's multiple ways. I used this guide to install it for buster. https://mosquitto.org/blog/2013/01/mosquitto-debian-repository/

Also for running app.py in the python-flaschen-taschen project, I needed to install both paho and yaml

pip3 install paho-mqtt python-etcd
pip3 install pyyaml

Besides those things I could stick with your readmes all the way through.

idcrook commented 3 years ago

Installing an MQTT broker is outside the scope of the projects found here. An example of configuring mosquitto MQTT broker is in the wiki: https://github.com/idcrook/shairport-sync-mqtt-display/wiki/Configure-mosquitto-MQTT-broker

For the second part, the README has these packages installed as part of virtual env. They are in the requirements.txt file: https://github.com/idcrook/shairport-sync-mqtt-display/blob/main/python-flaschen-taschen/requirements.txt

cd ~/projects/shairport-sync-mqtt-display
cd python-flaschen-taschen
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
idcrook commented 3 years ago

I was going to make a pull request but I don't know how to for the wiki.

Collaboratively editing a github repo's wiki is indeed a pain. You can share here suggested instructions here and I'll augment the existing wiki page or add another one,

Also, I just started on the flaschen-taschen piece copying over the template from other subprojects. It's very much a work-in-progress :construction:. Glad you were able to get it working.

kylejohnsonkj commented 3 years ago

Dang I swore I ran that pip install -r requirements.txt line. I don't know much about python but maybe it didn't work because it needed to be installed with pip3? Either way the step was there, so no changes needed.

And yeah, I appreciate you working on it. I have another setup where I make the client send-image calls from my PC, but AirPlay is way more convenient. There's some strange issues I have yet to deal with.

idcrook commented 3 years ago

Dang I swore I ran that pip install -r requirements.txt line. I don't know much about python but maybe it didn't work because it needed to be installed with pip3? Either way the step was there, so no changes needed.

My apologies, as this is something that didn't make it from source sub-project README: In any new shell, the venv needs to be entered so that virtual env is setup:

cd python-flaschen-taschen
# this is the python virtual environment we installed into earlier
source venv/bin/activate
python app.py

And yeah, I appreciate you working on it. I have another setup where I make the client send-image calls from my PC, but AirPlay is way more convenient. There's some strange issues I have yet to deal with.

  • Firstly when I start playing a song or switch to a new one, the airplayed image will show up on the matrix but then consistently disappear 12 seconds later, reverting back to an unlit screen (or if I send an image from my PC before airplaying, it will revert to that image). Happens when I output to the terminal too. Curious if you've had this occur?

Yes I observe this exact same annoying behavior. I hadn't debugged further, as I ran out of time allotted when I was prototyping this. It could have something to do with the default "layer" value in the message sent using the example library code? but I really don't know.

https://github.com/idcrook/shairport-sync-mqtt-display/blob/b043aea8b5e1ae59cbdb5729cf056d27a7db0716/python-flaschen-taschen/flaschen.py#L20

You could try specifying a different value in client construction:

https://github.com/idcrook/shairport-sync-mqtt-display/blob/b043aea8b5e1ae59cbdb5729cf056d27a7db0716/python-flaschen-taschen/app.py#L166-L169

  • There's also some matrix flickering when playing songs due to I think the cpu usage of the AirPlay session. The flickering goes away when the music is paused. It doesn't happen with my PC to pi config, since only the ft-server is running on the pi. I separated the cpu core the ft-server code runs on from the shairport-sync code but it still interferes a bit. This is unrelated to your project, but just something I noticed. Hopefully I can get around it somehow.

I was able to eliminate similar flicker on a Model 3 B by increasing the value for --led-slowdown-gpio=2 in server invocation. The flaschen-taschen project touches on this.

If I recall correctly for my setup though, the LED display server and client were running on a different Pi not running shairport-sync + MQTT publishing; that is, it was just subscribed to metadata topics on the MQTT broker (not playing audio or publishing metadata)...

There is a also a jumper configuration that can be used with the Pi HAT on the Pi GPIO header that is supposed to support more performant LED matrix output, but I didn't require this in my particular setup.

kylejohnsonkj commented 3 years ago

It could have something to do with the default "layer" value in the message sent using the example library code? but I really don't know.

Setting layer to 0 fixed it for me! Anything above that had the same issue.

If I recall correctly for my setup though, the LED display server and client were running on a different Pi not running shairport-sync + MQTT publishing;

Gotcha. I'm trying to keep everything contained to the single pi since it's attached to the back of my matrix, so I guess that makes it a bit harder. The flickering isn't that bad, so I think with some tweaking I might be able to get around it. I did the adafruit-hat-pwm jumper mod when I originally set up my matrix and it definitely made a big difference.

Edit: setting the output_backend to pipe got rid of the flickering, so all is good now!

kylejohnsonkj commented 3 years ago

Btw, I've made various changes here and there in addition to the layer such as clearing the matrix when the airplay session becomes inactive, systemd.service files for running the ft-server and app.py client scripts on startup, and defaulting pixels that don't fit in the image dimensions to an unobtrusive black instead of white (occurs with non 1:1 artwork).

I'll make a pull request sometime next week. :)

idcrook commented 3 years ago

closed by #42