sentriz / gonic

music streaming server / free-software subsonic server API implementation
ircs://irc.libera.chat/#gonic
GNU General Public License v3.0
1.5k stars 105 forks source link

refactor(scanner): make the watcher a little easier to reason about #394

Closed sentriz closed 8 months ago

sentriz commented 8 months ago

hiya @brian-doherty , i was reading the scanner code again today, and since it had been a while it took me a little while to grasp it again. i'm wondering what you think about these changes that i've found to help a me a bit

thoughts? thanks!

brian-doherty commented 8 months ago

This mostly makes sense. My concern about dropping the passing of the root dir regards handling of sym links -- you can't deduce the root dir if you've followed a sym link to somewhere else in the file system. I don't use sym links in my library but you've got handling for them so they need to work properly.

sentriz commented 8 months ago

oh yeah you're right :+1:

sentriz commented 8 months ago

actually @brian-doherty it seems to be fine, have a look at this

image

when we encounter a symlink, we evaluate it and replace the prefix of the originally scanned path before evaluating

so if we scan a /mnt/music/artist (sym to external fs) we evaluate to /mnt/external/artist and carry on as if there was never a symlink in the first place /mnt/music/artist/album

so the reverse mapping of music dirs works fine, as far as i can tell / test

brian-doherty commented 8 months ago

Makes sense, as long as you tested it and it works.

sentriz commented 8 months ago

did some more testing of symlinks seems to be fine :+1:

thanks for your input, and the watcher itself :+1: :+1: