kew
kew copied to clipboard
Searching & symlinks
Hi there.
This isn't really a bug, but it's something that caught me out and I wondered if there's anything that can be done about it.
I have a large mp3 collection, and a smaller flac collection. I have some albums in both formats, but I keep the older mp3 versions around because some devices (older car stereos that accept USB drives, etc.) don't support flac.
I keep these collections on a network storage device, and I mount the folders as
/mnt/volumes/storage/music/mp3
/mnt/volumes/storage/music/flac
For kew I made an 'optimal' music library under ~/Music - by optimal I mean the structure is
~/Music/artist/album1
~/Music/artist/album2
...
where /artist is a "real" directory, but /albumN is a symlink; if there is a flac version of the album then the symlink points to the flac version, otherwise it points to the mp3 version. So:
~/Music/artist/album1 -> /mnt/volumes/storage/music/mp3/artist/album1
~/Music/artist/album2 -> /mnt/volumes/storage/music/flac/artist/album2
...
Unfortunately this doesn't completely work with kew; if you try running kew dir albumN
for example it will either work for the mp3 albums or it will work for the flac albums, but not for both (for the ones that don't work it will say "No Music found"). Weirdly, whether it find mp3 or flac albums seems to depend on which directory was created first.
This is because of the way the walker
method in file.c
works; as soon as that method changes directory into one of the album directories, getcwd
returns the /mnt/volumes/storage/music/...
path rather than the ~/Music/artist/
path and so when it surfaces from the album directory it is now running in either /mnt/volumes/storage/music/mp3
or /mnt/volumes/storage/music/flac
, but it therefore stays confined in that file format.
I'm not a C dev, but I googled around this a bit and found that there is a GNU method called get_current_dir_name
which returns the PWD rather than the cwd which should fix the problem, but I tried and couldn't get it to work.
If this is an extreme edge case then I'm happy to forget about it - I can solve this another way by creating all of the album directories under ~/Music/artist and just symlinking the files - but just in case anyone else hits this problem I wanted to mention it.
I'm not able to look at it right now, but thank you for opening this issue and for taking your time to try a solution.
Hi, @jonwilts, I committed some changes to the develop branch. It would be really helpful if you could check if these changes works for you: https://github.com/ravachol/kew/tree/develop
grab the zip and unzip into any directory and run 'make' from within that directory. then ./kew to run.
I think the symlink and destination folder need to have the same name for everything to work correctly.
closing this, an improvement will be in the next version.