Avoid duplicate tracks in the mpd db when using symlinks

Need help with MPD?
Post Reply
nbpf
Posts: 56
Joined: June 17th, 2014, 6:45 am

Avoid duplicate tracks in the mpd db when using symlinks

Post by nbpf »

My /var/lib/mpd/music contains, among others
  • composers -> /mnt/hdd4/share/audio/composers
    data -> /mnt/hdd4/share/audio/data
    new -> /mnt/hdd4/share/audio/new
    selections -> /mnt/hdd4/share/audio/selections
Of the targets of the above symlinks, only /mnt/hdd4/share/audio/data contains actual data. The targets of composers, new and selections contain hierarchies of symbolic links to data in the target of data. This is great for navigating folders but, unfortunately, yields duplicate tracks in the mpd database and, therefore, in the "album view" of mpd clients. For instance, in cantata or gmpc, the album "Le voyage de Sahar" by "Anouar Brahem" contains the following tracks
  • 1 Sur le fleuve
    1 Sur le fleuve
    2 Le voyage de Sahar
    2 Le voyage de Sahar
    3 L'aube
    3 L'aube
    ...
because of a symbolic link to ../../../data/Anouar Brahem/Le Voyage de Sahar (2005)/ in a subfolder of /mnt/hdd4/share/audio/new. When playing a whole album, each track is played two times, of course! Albums from data which is pointed to by symlinks in composers, new and selections contain 4 copies of each original track! And each track gets played 4 times in a row!

This misbehavior seems to be the consequence of a trivial error in the logic used to build the mpd database but has the effect of making album browsing virtually unusable in mpd clients. My question is whether there is a simple workaround to avoid the problem.

An obvious one one would be not to use symbolic links, of course. But I very much hope that there are more intelligent ways to avoid the problem without throwing away the advantages of symbolic links for folder-based browsing.

Thanks,
nbpf

nbpf
Posts: 56
Joined: June 17th, 2014, 6:45 am

Re: Avoid duplicate tracks in the mpd db when using symlinks

Post by nbpf »

Is

https://github.com/ajjahn/puppet-mpd/bl ... licates.sh

a recommended approach for tackling the problem? Thanks, nbpf

Post Reply