MPD icon indicating copy to clipboard operation
MPD copied to clipboard

MPD removes (temporarly) missing songs from queue

Open muesli4 opened this issue 4 years ago • 5 comments

I am not sure whether this is a bug or intended behavior. However, I noticed that if some of the songs are not available on the filesystem, for whatever reason, they will get removed from the queue. This leads to my queue getting smaller each day and a lot of songs missing. I am using mpd-automount to automatically mount directories and to add them to the library. My guess is that MPD is rescanning the songs on startup and in between the filesystem gets mounted.

What I want to achieve is that any dynamically attached storage gets integrated into the library without affecting the playlist. Is this possible? Maybe I'm doing it wrong.

muesli4 avatar Apr 11 '21 14:04 muesli4

First of all, mpd-automount is a pointless project because MPD can do udisks2 mounts on its own: https://www.musicpd.org/doc/html/plugins.html#udisks and https://www.musicpd.org/doc/html/plugins.html#id3

But one problem remains: if MPD starts and attempts to restore the queue, only songs that are really available can be restored. A song which doesn't exist will be omitted. I understand that this is a problem for you with dynamic mounts, but right now, I'm not quite sure how to properly implement it. Non-existing songs will be omitted for a reason: if the underlying files have been deleted, there's no point in having them in the queue. How do you want it? Do you want MPD to never ever remove deleted songs from the queue?

MaxKellermann avatar Apr 26 '21 19:04 MaxKellermann

First of all, mpd-automount is a pointless project because MPD can do udisks2 mounts on its own: https://www.musicpd.org/doc/html/plugins.html#udisks and https://www.musicpd.org/doc/html/plugins.html#id3

Yes, but I did not waste a lot of time on it and learn something. And as long as the plugin was not working it served me well. Perhaps I should have contributed to MPD. ;)

But one problem remains: if MPD starts and attempts to restore the queue, only songs that are really available can be restored. A song which doesn't exist will be omitted. I understand that this is a problem for you with dynamic mounts, but right now, I'm not quite sure how to properly implement it. Non-existing songs will be omitted for a reason: if the underlying files have been deleted, there's no point in having them in the queue. How do you want it? Do you want MPD to never ever remove deleted songs from the queue?

The thing is, MPD cannot know if a song was deleted if the mountpoint (as in MPD mount) was not mounted. For example, if you fail to connect to a network storage you don't want the player to remove the songs from the queue or playlists. However, if you manage to connect, then MPD can remove them if they no longer exist. I understand that then there must be an intermediate state of songs that ~~do not exist~~ are temporarily unavailable. Perhaps it makes sense to display those in clients but the player itself can simply skip over them.

muesli4 avatar Apr 27 '21 17:04 muesli4

I just edit the provided systemd unit to make mpd depend on a working network connection (wait-online target). That way so far my cifs mounts were already there and mpd simply restored the playlist from state file without issues. From my perspective, even if the files are not existing there is no harm in simply restoring the playlist and have mpd through an error message as soon as someone wants to actually play them. If I load a playlist with a bunch of non-existing files in mpd, I believe it is still added to the queue, however the missing files simply wont play. So this might be pretty much expected behavior from user side.

coroner21 avatar May 17 '21 17:05 coroner21

I just edit the provided systemd unit to make mpd depend on a working network connection (wait-online target). That way so far my cifs mounts were already there and mpd simply restored the playlist from state file without issues.

There may be other issues which lead to songs not being available temporarily.

From my perspective, even if the files are not existing there is no harm in simply restoring the playlist and have mpd through an error message as soon as someone wants to actually play them. If I load a playlist with a bunch of non-existing files in mpd, I believe it is still added to the queue, however the missing files simply wont play. So this might be pretty much expected behavior from user side.

Yes, that's the way I see it. And in the worst case you could add something to the configuration and make the old setting the default (remove missing songs from queue). But maybe there is something I'm missing and it is more complicated.

muesli4 avatar May 18 '21 14:05 muesli4

For a while now I have been using the udisks neighbor plugin and I notice the same behavior. Over time many of my songs disappear from my queue (I have consume disabled). They are on a single USB stick. One explanation I can see is that mounting, triggered by the neighbor plugin, is taking place while MPD is checking the songs from the queue.

I will create a separate issue for this as the plugin should make sure that everything is mounted before somehow accessing any paths.

muesli4 avatar Dec 03 '21 04:12 muesli4