Hi, I have an application that listens to mpd status changes using "idle" and writes the current mpd status onto a hardware display. After issuing a "play" command, mpd immediately notifies the player status change. At that point, I read the status of the player, but the status does not include any audio format information. But mpd just told me that it started playing. If I wait 1 second after receiving the player status change notification, then the status includes the audio format information. I have tested with both internet radio stations and with stored audio files, same result.
Here is an "expect" script that demonstrates the problem. spawn telnet 10.2.1.221 6600 expect "OK" send "clear\r" expect "OK" send "load http://www.sky.fm/mp3/classical.pls\r" expect "OK" send "play\r" expect "OK" send "idle\r" expect "player" send "status\r" expect "OK" sleep 1 send "status\r" expect "OK" expect eof And here is the output. As can be seen, the first status request does not include any audio format information (bitrate = 0, audio = 0:?:0). But after 1 second has elapsed, the status request now returns the correct audio information. It seems that once mpd puts itself into playback mode, it sends the "playing" change notification, but its buffers are probably still empty. Once the buffers start filling, the audio format information becomes available. But problem is, mpd doesn't tell me that now the audio formation information is there to grab. I have to place an ugly delay after the "playing" change notification and then get the status. In a polling application, all of this is irrelevant, but for a event driven application, this matters a lot. Maybe mpd can send an addition notification message, separate from the "playing" message, that tells that the audio format information is now known and available. What do you guys think about this? spawn telnet 10.2.1.221 6600 Trying 10.2.1.221... Connected to 10.2.1.221. Escape character is '^]'. OK MPD 0.17.0 clear OK load http://www.sky.fm/mp3/classical.pls OK play OK idle changed: playlist changed: player OK status volume: -1 repeat: 0 random: 0 single: 0 consume: 0 playlist: 111 playlistlength: 10 xfade: 0 mixrampdb: 0.000000 mixrampdelay: nan state: play song: 0 songid: 55 time: 0:0 elapsed: 0.000 bitrate: 0 audio: 0:?:0 nextsong: 1 nextsongid: 56 OK status volume: -1 repeat: 0 random: 0 single: 0 consume: 0 playlist: 112 playlistlength: 10 xfade: 0 mixrampdb: 0.000000 mixrampdelay: nan state: play song: 0 songid: 55 time: 1:0 elapsed: 0.763 bitrate: 96 audio: 44100:24:2 nextsong: 1 nextsongid: 56 OK ------------------------------------------------------------------------------ Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft MVPs and experts. SALE $99.99 this month only -- learn more at: http://p.sf.net/sfu/learnmore_122412 _______________________________________________ Musicpd-dev-team mailing list Musicpd-dev-team@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/musicpd-dev-team