owntone / owntone-server

Linux/FreeBSD DAAP (iTunes) and MPD media server with support for AirPlay 1 and 2 speakers (multiroom), Apple Remote (and compatibles), Chromecast, Spotify and internet radio.
https://owntone.github.io/owntone-server
GNU General Public License v2.0
2.01k stars 232 forks source link

"announcement" of new song to MPD server #714

Open kalle2000 opened 5 years ago

kalle2000 commented 5 years ago

I am using a MPD plugin for my home automation system to control forked-daapd (https://fhem.de/commandref.html#MPD)

Whenever forked-daapd starts to play a song intially, the song information is being "announced" and the MPD module is able to read this information (by connecting to the MPD server). However when a queued song is being played (i.e. next track) it seems that there is no announcement from forked-daapd to the MPD server (or maybe in an incorrect format). At least the MPD module of my home automation system does not recognize the new song. When using a standard MPD client it works.

How can I support you to narrow down the issue?

thx kalle

chme commented 5 years ago

I'll need to take a closer look at this. It might be, that we are sending the update notification to early (forked-daapd has a two second delay between reading the next song and actually playing it).

If you could get a debug log from forked-daapd, that might be helpful (this will show which mpd commands fhem sends to forked-daapd, interesting lines are the ones containing "MPD message:").

kalle2000 commented 5 years ago

Hi @chme

as I understand it, the MPD module of FHEM is listening on certain events of the MPD server:


Waits until there is a noteworthy change in one or more of MPD's subsystems. 
 As soon as there is one, it lists all changed systems in a line in the format changed: SUBSYSTEM, 
 where SUBSYSTEM is one of the following: 
 - database: the song database has been modified after update. 
 - update: a database update has started or finished. If the database was modified during the update, the database event is also emitted. 
 - stored_playlist: a stored playlist has been modified, renamed, created or deleted 
 +- playlist: the current playlist has been modified 
 +- player: the player has been started, stopped or seeked 
 +- mixer: the volume has been changed 
- output: an audio output has been enabled or disabled 

see line 1216ff

kalle2000 commented 4 years ago

Hi @chme From what I understood looking at the source code it might be sufficient to include Artist, Title and Album information in the mpd status command (Command handler function for 'status')

kalle2000 commented 3 years ago

@chme Can I help you somehow to bring this forward?

chme commented 3 years ago

@kalle2000 sorry, totally forgot this issue existed ... Unfortunately I have no idea why fhem does not get the announcement. forked-daapd definitively sends one.

From what I understood looking at the source code it might be sufficient to include Artist, Title and Album information in the mpd status command (Command handler function for 'status')

The 'status' command does only contain the position and id of the current and the next song, there are no fields for album, title information (see https://www.musicpd.org/doc/html/protocol.html#querying-mpd-s-status).

I found a bug in forked-daapds status command implementation, so that the next song fields were incorrect, but I have little hope, that this would fix the issue you are seeing.

If you can provide a forked-daapd debug log when this issue happens, that may help to identify what happens. Or maybe ask for support by the fhem developers, maybe they have an idea why the announcement is not picked up?