hankhank10 / music-screen-api

Display the playing Sonos track in real time on an e-ink display - also includes functionality for last.fm
120 stars 17 forks source link

Detect TV or Line-In sources #32

Closed jjlawren closed 4 years ago

jjlawren commented 4 years ago

Detects TV or Line-In sources on devices that support those features. Displays appropriate icons on the display in those cases.

I was able to test with a Beam but I had to make some guesses on how it would work on an Amp, Connect, Five, or Play:5. Would appreciate if anyone with access to those could give a quick sanity check.

cc: @habra-cadabra @v1nc3lx

Fixes: https://github.com/hankhank10/music-screen-api/issues/30

v1nc3lx commented 4 years ago

2020-08-09 09:48:14,690 INFO - Monitoring room: Soggiorno 2020-08-09 09:48:14,714 INFO - New track: Smooth Jazz 24/7 - Fourplay - Cinnamon Sugar [Smooth Jazz 24/7] 2020-08-09 09:48:14,716 ERROR - Task exception was never retrieved future: <Task finished coro=<main() done, defined at /home/pi/dev/music-screen-api/go_sonos_highres.py:148> exception=NameError("name 'self' is not defined")> Traceback (most recent call last): File "/home/pi/dev/music-screen-api/go_sonos_highres.py", line 191, in main await redraw(session, sonos_data, display) File "/home/pi/dev/music-screen-api/go_sonos_highres.py", line 89, in redraw if sonos_settings.demaster and self.type not in ["line_in", "TV"]: NameError: name 'self' is not defined

v1nc3lx commented 4 years ago

if sonos_settings.demaster and self.type not in ["line_in", "TV"]: ("go_sonos_highres.py" line 89 of 213 )

I had to switch "self.type" with "sonos_data.type" to make it work (?!) anyway.. it works!! 👍
Just one thing about "show_details": when i switched to line-in, it still displayed infos about the previous track

image

jjlawren commented 4 years ago

Oops, typo. Thanks for testing! I'll try to find time to fix both of those later today.

jjlawren commented 4 years ago

@v1nc3lx pushed an update, can you give a test? Didn't have a lot of time to test but this seems like a straightforward change.

habra-cadabra commented 4 years ago

looks good on Sonos Arc!

IMG_1769

v1nc3lx commented 4 years ago

Five here!

image

v1nc3lx commented 4 years ago

switching to line-in -> wait -> screen turns off -> wait -> start radio: screen turns on with line-in picture and after a couple of seconds it switches to radio picture

jjlawren commented 4 years ago

I'm not totally clear on the timing in that sequence of events. It might be a limitation of the Sonos API if there's a slight delay.