MusicPlayerDaemon / MPD

Music Player Daemon
https://www.musicpd.org/
GNU General Public License v2.0
2.18k stars 352 forks source link

Update not updating modified files despite timestamp change #717

Open Forage opened 4 years ago

Forage commented 4 years ago

Bug report

Describe the bug

In order to get different tracks of various artists on the same compilation album grouped together the ALBUMARTIST tag is read from various file tag formats. unlike for MP3 with TPE2 and APE with ALBUM ARTIST, for Ogg Vorbis files this isn't working. While version 0.20 got rid of reading ALBUM ARTIST from these tags, as far as I can read the code ALBUMARTIST should still be supported.

Expected Behavior

Read ALBUMARTIST tags from Ogg Vorbis files and use it to group the different tracks as one album.

Actual Behavior

No ALBUMARTIST value is being read/stored for the Ogg Vorbis files. The value is empty if I look at the track details from a client like M.A.L.P. MP3 files are being grouped, Ogg Vorbis files are not. I tried storing the value as ALBUMARTIST as well as ALBUM ARTIST, to no avail. (yes I did update the library after changing the tags)

Is it supposed to work for Ogg Vorbis files? I can provide a sample file by request if needed.

Version

Music Player Daemon 0.21.19 (0.21.19)
Copyright 2003-2007 Warren Dukes <warren.dukes@gmail.com>
Copyright 2008-2018 Max Kellermann <max.kellermann@gmail.com>
This is free software; see the source for copying conditions.  There is NO
warranty; not even MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

Database plugins:
 simple proxy upnp

Storage plugins:
 local smbclient udisks nfs curl

Neighbor plugins:
 smbclient upnp udisks

Decoders plugins:
 [mad] mp3 mp2
 [mpg123] mp3
 [vorbis] ogg oga
 [oggflac] ogg oga
 [flac] flac
 [opus] opus ogg oga
 [sndfile] wav aiff aif au snd paf iff svx sf voc w64 pvf xi htk caf sd2
 [audiofile] wav au aiff aif
 [dsdiff] dff
 [dsf] dsf
 [hybrid_dsd] m4a
 [faad] aac
 [mpcdec] mpc
 [wavpack] wv
 [modplug] 669 amf ams dbm dfm dsm far it med mdl mod mtm mt2 okt s3m stm ult umx xm
 [mikmod] amf dsm far gdm imf it med mod mtm s3m stm stx ult uni xm
 [sidplay] sid mus str prg P00
 [wildmidi] mid
 [fluidsynth] mid
 [adplug] amd d00 hsc laa rad raw sa2
 [ffmpeg] 16sv 3g2 3gp 4xm 8svx aa3 aac ac3 adx afc aif aifc aiff al alaw amr anim apc ape asf atrac au aud avi avm2 avs bap bfi c93 cak cin cmv cpk daud dct divx dts dv dvd dxa eac3 film flac flc fli fll flx flv g726 gsm gxf iss m1v m2v m2t m2ts m4a m4b m4v mad mj2 mjpeg mjpg mka mkv mlp mm mmf mov mp+ mp1 mp2 mp3 mp4 mpc mpeg mpg mpga mpp mpu mve mvi mxf nc nsv nut nuv oga ogm ogv ogx oma ogg omg opus psp pva qcp qt r3d ra ram rl2 rm rmvb roq rpl rvc shn smk snd sol son spx str swf tak tgi tgq tgv thp ts tsp tta xa xvid uv uv2 vb vid vob voc vp6 vmd wav webm wma wmv wsaud wsvga wv wve
 [gme] ay gbs gym hes kss nsf nsfe sap spc vgm vgz
 [pcm]

Filters:
 libsamplerate soxr

Tag plugins:
 id3tag

Output plugins:
 shout null fifo sndio pipe alsa ao oss openal pulse jack httpd recorder

Encoder plugins:
 null vorbis opus lame wave flac

Archive plugins:
 [bz2] bz2
 [zzip] zip
 [iso] iso

Input plugins:
 file archive alsa tidal qobuz curl ffmpeg smbclient nfs mms cdio_paranoia

Playlist plugins:
 extm3u m3u pls xspf asx rss soundcloud flac cue embcue

Protocols:
 file:// alsa:// tidal:// qobuz:// http:// https:// gopher:// rtp:// rtsp:// rtmp:// rtmpt:// rtmps:// smb:// nfs:// mms:// mmsh:// mmst:// mmsu:// cdda://

Other features:
 avahi dbus udisks epoll icu inotify ipv6 systemd tcp un
MaxKellermann commented 4 years ago

Which exact MPD command did not work as expected? What was the response, and what response did you expect?

Forage commented 4 years ago

Not a specific command but its ability to read file tags to store in its database.

I searched online and checked the man pages of mpd and mpc to have one of those applications display track metadata to demonstrate the problem, but it is unclear to me how to do it.

MaxKellermann commented 4 years ago

What makes you sure that it's about reading file tags? Because that's what I wanted to find out, and I need information from you, or else I can't tackle your problem. Over here, MPD reads AlbumArtist tags from Vorbis just fine.

Forage commented 4 years ago

I'm checking known track info with MALP. Title, artist, etc is available for ogg files, as for mp3 files. When TPE2 for album artist is present in mp3 files this value is shown in MALP's track details as well. For ogg files this is not the case for neither ALBUMARTIST nor ALBUM ARTIST stored in the file.

This tells me MPD is not providing this info to MALP for some reason. Since it does work for mp3 files it gives me the impression MPD that the info is not present in its db for some reason.

Is there a way for me to check with MPD/MPC directly what metadata is known for a specific track?

MaxKellermann commented 4 years ago

Is there a way for me to check with MPD/MPC directly what metadata is known for a specific track?

Yes, for example this way (after adding the song to the queue): mpc playlist -f '%artist%;%title%;%albumartist%'

I think it would be helpful to upload a sample file. "album artist" (with space) is not suported, only "albumartist".

Forage commented 4 years ago

Thanks for the info. mpc is nicely giving me the album artist, so that excludes the tag reading being the cause.

pi@raspberrypi:~ $ mpc playlist -f '%artist%;%title%;%albumartist%'
Adjudgement;Whom Can We Trust;VA

I installed MPDroid as it might as well be a client issue now. MPDroid does give me the albumartist correctly, so it looks like it's a M.A.L.P. issue.

Forage commented 4 years ago

Back to MPD. MALP is confident that it can't be an issue in their app: https://gitlab.com/gateship-one/malp/issues/195 So I checked MALP, MPDroid and mpc a bit more. Results appear to be inconsistent. Now MPDroid shows me nothing for the same tracks where it showed a value for the album artist before. If I add the same track twice to the play list I also get the same inconsistency with mpc:

mpc playlist -f '%artist%;%title%;%albumartist%'
Adjudgement;Whom Can We Trust;VA
Brightside;Sick - O;VA
Brightside;Sick - O;

Here's a sample file: Sample.zip

mpc, as well as the Android apps also report a different MPD version than actually installed. Related or simply a forgotten protocol version bump?

pi@raspberrypi:~ $ mpc version
mpd version: 0.21.11
MaxKellermann commented 4 years ago

MPD can read those tags just fine over here, can't reproduce the problem. What you see is not the MPD version but the protocol version, which hasn't changed since 0.21.11, so that's what you see.

Forage commented 4 years ago

I believe I narrowed it down a bit more. It is only when the track has been played that the album artist info is available (viewed by mpc)

Do the following steps allow you to reproduce the issue?

  1. Add the provided track to the playlist (without playing it)
  2. Check playlist with mpc (no VA for album artist is shown)
  3. Play the track
  4. Check playlist with mpc (VA for album artist is shown)

The value for album artist remains available until you clear the playlist.

I can systematically reproduce the issue this way with different ogg files.

Forage commented 4 years ago

Found it. It's MPD not updating tags after the initial scan of files stored on an NFS share, even if you try to force the db update. If I change the music folder path completely and change it back after an update, the new tags are being picked up just fine. Does that make it related or a duplicate of issue #713 ?

MaxKellermann commented 4 years ago

No, this has nothing to do with 713. How do you force a db update? What was your "change path" procedure exactly which worked around the problem?

Forage commented 4 years ago

To update I use the "Update Server Database" button in the MALP server properties section.

After some more testing, there are two methods of changing path that serve as a work-around:

  1. Change music_directory "nfs://192.168.1.16/data/Music" to some empty folder, I used music_directory "/home/pi", update, change it back again to the NFS share, update.
  2. Change the subfolder name of the configured music_directory containing the album followed by an update (and optionally back again).

For the record, I also have auto_update "yes" in the config, but that doesn't seem to work at all.

MaxKellermann commented 4 years ago

To update I use the "Update Server Database" button in the MALP server properties section.

This doesn't "force" an update. This just triggers an update, but doesn't force anything. To force, use MPD's rescan command instead of update.

After some more testing, there are two methods of changing path that serve as a work-around:

1. Change `music_directory         "nfs://192.168.1.16/data/Music"` to some empty folder, I used `music_directory         "/home/pi"`, update, change it back again to the NFS share, update.

2. Change the subfolder name of the configured `music_directory` containing the album followed by an update (and optionally back again).

This is just another way to simulate rescan. If this fixes your problem, then this problem doesn't exist at all; maybe it has existed in a past MPD version which created your database initially, and the database was kept with new MPD versions.

For the record, I also have auto_update "yes" in the config, but that doesn't seem to work at all.

NFS doesn't support change notifications, so this cannot work.

Forage commented 4 years ago

I meant forcing as opposed to the auto_update. I haven't started using MPD before my existing installation (0.21.19) so it can't be an old db.

Update should be sufficient to pick up the changes made to file tags, shouldn't it?

MaxKellermann commented 4 years ago

Update should be sufficient to pick up the changes made to file tags, shouldn't it?

What kind of changes did you make to file tags, and what program did you use?

Forage commented 4 years ago

Changes like storing ALBUMARTIST to Ogg Vorbis files, storing ALBUM ARTIST (TPE2) to MP3 files, changing tag types from ID3v2.4 to ID3v2.3, etc.

MaxKellermann commented 4 years ago

Your reply is incomplete.

Forage commented 4 years ago

Ah yes, all with foobar2000

MaxKellermann commented 4 years ago

foobar2000 is a proprietary program which I can't possibly support. Let me rephrase the question: when did you do those changes? Show me the ls -l listing of one such file for which MPD didn't update the tags properly.

Forage commented 4 years ago

Just a few minutes ago:

pi@raspberrypi:/net/192.168.1.16/data/Music/[original soundtracks]/Sound City - Real to Reel $ ls -l 11.\ Mantra.mp3 
-rwxrwxrwx 1 99 99 15328781 Mar 30 16:18 '11. Mantra.mp3'

I did the whole album, updated the db, still no album artist being picked up. 11. Mantra.mp3.txt

MaxKellermann commented 4 years ago

Does it work with the rescan command instead of update?

Forage commented 4 years ago

It obviously took considerably more time but the rescan does properly update all changed tags yes.

MaxKellermann commented 4 years ago

This means there is no problem with reading the tags; the problem is that MPD skips those modified files during an update. MPD skips all files whose last modification time stamp hasn't changed. That's why I asked which program you were using: foobar2000 has an option to preserve the last modification time stamp, which is a stupid idea, and of course breaks MPD's database update.

Forage commented 4 years ago

Luckily I haven't got that option checked, as you can see the timestamp has changed after the modification ;)