MusicPlayerDaemon / MPD

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

Symbolic links to single files will be added to db if any suffix is present on the link or will be ignored if no suffix is set #2092

Closed lazypingu closed 2 weeks ago

lazypingu commented 1 month ago

Bug report

Describe the bug

Symlinks which points to single files will be ignored on db updates if the links doesn't have a suffix. If a suffix is present on the link it will be added to the db regardless of the suffix.

Expected Behavior

Not sure whether this is a bug at all or expected. I only encontered this during tests. I'm not generally affected, but It was at least strange to me so I just wanted to report it.

This is probably a rare and unusual case, so it might not be relevant.

Actual Behavior

Assuming the following structure of the music directory:

├── dir1
│   └── song.flac
└── dir2
    ├── test -> ../dir1/song.flac
    ├── test.flac -> ../dir1/song.flac
    ├── test.mp3 -> ../dir1/song.flac
    └── test.txt -> ../dir1/song.flac

Updating the db results in adding the music file and all symlinks except the one without suffix (see logs below).

Version

Music Player Daemon 0.24 (v0.23.15-1509-gf7790430a)
Copyright 2003-2007 Warren Dukes <warren.dukes@gmail.com>
Copyright 2008-2021 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

Storage plugins:
 local

Decoder plugins:
 [oggflac] ogg oga
 [flac] flac
 [dsdiff] dff
 [dsf] dsf
 [ffmpeg] 264 265 266 302 3g2 3gp 4xm 722 aa aa3 aac aax ac3 ac4 ace acm act adf adp ads adx aea afc aiff aix al alias_pix alp amr amrnb amrwb anm ans apc ape apl apm apng aptx aptxhd aqt argo_asf argo_brp argo_cvg art asc asf asf_o ass ast au avc avi avif avr avs avs2 avs3 bcstm bethsoftvid bfi bfstm bin bink binka bit bitpacked bmp_pipe bmv boa bonk brender_pix brstm c2 c93 caf cdata cdg cdxl cgi cif cine codec2raw concat cri_pipe dat data daud dav dds_pipe dfa dff dfpwm dif dirac diz dnxhd dpx_pipe dsf dsicin dss dst dtk dts dtshd dv dvbsub dvbtxt dxa ea eac3 ec3 evc exr_pipe f32be f32le f4v f64be f64le fap ffmetadata film_cpk fits flac flic flm flv frm fsb fwse g722 g723_1 g726 g726le g729 gdv gem_pipe genh gif gif_pipe gsm gxf h261 h263 h264 h265 h266 h26l hca hcom hdr_pipe hevc hls hnm ice ico idcin idf idx iff ifv ilbc image2 image2pipe imx ipmovie ipu ircam ism isma ismv iss iv8 ivf ivr j2k j2k_pipe jacosub jpeg_pipe jpegls_pipe jpegxl_pipe jv jxl kux kvag laf lmlm4 loas lrc lvf lxf m2a m4a m4b m4v mac mca mcc mgsts microdvd mj2 mjpeg mjpg mk3d mka mks mkv mlp mlv mm mmf mods moflex mov mp2 mp3 mp4 mpa mpc mpc8 mpeg mpegts mpegtsraw mpegvideo mpl2 mpo msbc msf msnwctcp msp mtaf mtv musx mv mvi mxf mxg nfo nist nsp nsv nut nuv obu ogg oma omg osq paf pam_pipe pbm_pipe pcx_pipe pdv pfm_pipe pgm_pipe pgmyuv_pipe pgx_pipe phm_pipe photocd_pipe pictor_pipe pjs pmp png_pipe pp_bnk ppm_pipe psd_pipe psp psxstr pva pvf qcif qcp qdraw_pipe qoi_pipe r3d rco rcv rgb rka rl2 rm roq rpl rsd rso rt rtp rtsp s16be s24be s24le s32be s32le s337m sami sap
sb sbc sbg scc scd sdns sdp sdr2 sds sdx ser sf sga sgi_pipe shn sln smi smk smush sol son sox spdif sph srt ss2 stl str sub sunrast_pipe sup svag svg_pipe svs sw swf tak tco tedcaptions thd thp tiertexseq tiff_pipe tmv tta txd txt ty ty+ u16be u24be u24le u32be u32le ub ul usm uw v v210 vag vb vbn_pipe vc1 vidc viv vividas vmd voc vpk vqe vqf vql vt vtt vvc w64 wa wav way wc3movie webm webm_dash_manifest webp_pipe wsaud wsd wsvqa wtv wv wve xa xbin xbm_pipe xl xmd xmv xpm_pipe xvag xwd_pipe xwma y4m yop yuv yuv10 rtp:// rtsp:// rtsps://
 [pcm]

Filters:

Tag plugins:

Output plugins:
 null fifo alsa httpd

Encoder plugins:
 null wave flac

Archive plugins:
 [bz2] bz2
 [iso] iso

Input plugins:
 file io_uring archive alsa ffmpeg cdio_paranoia

Playlist plugins:
 extm3u m3u pls flac cue embcue

Protocols:
 file:// alsa:// cdda:// ftp:// gopher:// hls+http:// hls+https:// http:// https:// mmsh:// mmst:// rtmp:// rtmps:// rtmpt:// rtmpts:// rtp:// rtsp:// rtsps:// srtp://

Other features:
 epoll icu ipv6 tcp un

Configuration

music_directory "~/test"
playlist_directory "~/.config/mpd/playlists"
db_file "~/.config/mpd/database"
log_file "~/.config/mpd/log"
pid_file "~/.config/mpd/pid"
state_file "~/.config/mpd/state"
bind_to_address "localhost"
bind_to_address "~/.config/mpd/socket"
log_level                       "verbose"
metadata_to_use "+comment"
input {
        plugin "cdio_paranoia"
        speed "4"
}
audio_output {
        type            "alsa"
        name            "direct"
}
filesystem_charset "UTF-8"

Log

Aug 01 20:27 : update: spawned thread for update job id 1
Aug 01 20:27 : update: starting
Aug 01 20:27 : event: RTIOThread could not get realtime scheduling, continuing anyway: sched_setscheduler failed: Operation not permitted
Aug 01 20:27 : update: reading dir2/test.flac
Aug 01 20:27 : update: added dir2/test.flac
Aug 01 20:27 : update: reading dir2/test.txt
Aug 01 20:27 : client: [0] opened from ?
Aug 01 20:27 : client: [0] process command "ping"
Aug 01 20:27 : client: [0] command returned 0
Aug 01 20:27 : client: [0] closed
Aug 01 20:27 : update: added dir2/test.txt
Aug 01 20:27 : update: reading dir2/test.mp3
Aug 01 20:27 : update: added dir2/test.mp3
Aug 01 20:27 : update: reading dir1/song.flac
Aug 01 20:27 : update: added dir1/song.flac
Aug 01 20:27 : simple_db: removing empty directories from DB
Aug 01 20:27 : simple_db: sorting DB
Aug 01 20:27 : simple_db: writing DB
Aug 01 20:27 : update: finished
MaxKellermann commented 2 weeks ago

That's the way it should be. For regular files (or symlinks pointing to regular files), MPD expects the file names to have one of the supported suffixes, or else it won't scan them.

Of course, the idea of mixing content-independent metadata (i.e. the file's human-readable name) and content-dependent metadata (i.e. a technical description of the file type) in one field (the filename) is a bad design - no thanks to the CP/M developers who invented this AFAIK - but since everybody's doing it this way, MPD follows.