Thank you for your donation!


Cloudsmith graciously provides open-source package management and distribution for our project.


Problem: Detect state changes
#9
Wink 
Alright, it's been a while, but I figured it out with MPD.

For the people who want to get a clean solution (but who are not using the GUI)

A lot of things can be done by using the Music Player Deamon.

To help others to visualize this a bit more, open up PuTTY and connect to your device on port 6600 (this is the MPD).
you can now send commands. For example, you can use currentsong to see the current music playing, so artist, song title, stream-url, etc.
Also, u can use status to get the play-state, volume, bitrate, and much more.
for a complete command reference, take a look here (Thanks to TheOldPresbyope).

Quote:Note

Thanks to the developers, you can also send these commands just from your browser, for more information for how to do this, see this post.

My solution

Since I found out about this, I noticed that sending commands directly over the socket is waaaaay faster than with the GUI (especially with changing volume and changing the play-state).
So with that, I came to the conclusion to rebuild almost everything. the structure will be as follows:

- A backend, that communicates with (for now at least) the MPD. 
I communicate to the backend via a REST API and reacts to changes and calls a python script for reacting with LEDs.
(Programmed in Java, but can easily be done in python)

- A frontend, which is written in Vue.JS. This is a huge improvement in speed because everything is rendered client-side instead of server-side(PHP).
The frontend also makes use of server-side-events, which sinks the state of the speaker FAST across everyone who is using the GUI. Wink
Bonus feature: It's a PWA so it can be installed like an app.

What now?

Right now, the backend supports most of the MPD commands and is of course accessible by RESTful API.
The frontend, in my opinion, is a bit less dated. Also has part of the API integrated. As a bonus, it's PWA and integrated some other APIs in it to add a bit more personality.

Screenshot of the GUI

I definitely continue to expand the functionality of MoOdeAudio. I would like to get some more information, forum-posts, references to all the other services, like how Bluetooth, UPnP, Airplay, and all the other services work and which tools are used.

Regards,

Steven
Reply


Messages In This Thread
Detect state changes - by steven4build - 02-05-2021, 02:55 PM
RE: Detect state changes - by TheOldPresbyope - 02-05-2021, 03:17 PM
RE: Detect state changes - by steven4build - 02-05-2021, 06:29 PM
RE: Detect state changes - by TheOldPresbyope - 02-05-2021, 09:51 PM
RE: Detect state changes - by Tim Curtis - 02-05-2021, 10:04 PM
RE: Detect state changes - by steven4build - 02-07-2021, 11:56 AM
RE: Detect state changes - by bitlab - 02-06-2021, 07:49 PM
RE: Detect state changes - by steven4build - 02-07-2021, 11:58 AM
RE: Detect state changes - by steven4build - 02-10-2021, 06:27 PM
RE: Detect state changes - by Tim Curtis - 02-10-2021, 08:10 PM
RE: Detect state changes - by hindumagic - 02-11-2021, 02:18 AM
RE: Detect state changes - by Tim Curtis - 02-11-2021, 03:26 AM
RE: Detect state changes - by hindumagic - 02-11-2021, 06:28 AM

Forum Jump: