Get state when using mpc idel event

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Get state when using mpc idel event

john doe-6
Hi,

According to the mpd protocol (1),  that is, if my understanding is
correct, I should be able, using an idle event, to get the state
('state: play, stop, or pause').
If I connect to mpd using telnet and enter status I get among other
lines the desired line.

I'm using mpd to locally stream an internet stream with as output 'httpd'.
The internet stream will sometime stop and I manually need to do 'mpc
play' to restart the internet stream which is not practicle.
To work around this, I now use a cronjob that executes 'mpc play' every
minute:

* * * * * user mpc play


I'd like to understand how idle events work and how I can get the
desired output.

In addition of understanding how idle events work, is there a better
approach to this?

Any input is welcome.


1)  https://www.musicpd.org/doc/html/protocol.html

--
John Doe

Reply | Threaded
Open this post in threaded view
|

Re: Get state when using mpc idel event

Jonas Smedegaard-2
Quoting john doe (2019-08-15 12:40:39)

> According to the mpd protocol (1),  that is, if my understanding is
> correct, I should be able, using an idle event, to get the state
> ('state: play, stop, or pause').
> If I connect to mpd using telnet and enter status I get among other
> lines the desired line.
>
> I'm using mpd to locally stream an internet stream with as output 'httpd'.
> The internet stream will sometime stop and I manually need to do 'mpc
> play' to restart the internet stream which is not practicle.
> To work around this, I now use a cronjob that executes 'mpc play' every
> minute:
>
> * * * * * user mpc play
>
>
> I'd like to understand how idle events work and how I can get the
> desired output.
>
> In addition of understanding how idle events work, is there a better
> approach to this?
>
> Any input is welcome.
My guess is that MPD sees an internet stream as an endlesly continuing
stream(!) of media, and you therefore cannot rely on MPD change of state
for those: If the stream is hangling then that's not an "end of tune" so
not part of MPD defined interface.


 - Jonas

--
 * Jonas Smedegaard - idealist & Internet-arkitekt
 * Tlf.: +45 40843136  Website: http://dr.jones.dk/

 [x] quote me freely  [ ] ask before reusing  [ ] keep private

signature.asc (849 bytes) Download Attachment