mopidy / mopidy-local

Mopidy extension for playing music from your local music archive
https://mopidy.com/ext/local/
Apache License 2.0
61 stars 26 forks source link

Prompt for confirmation when local library is empty #63

Closed ncsufan8628 closed 2 years ago

ncsufan8628 commented 2 years ago

Hi, Running into some undesired behavior and could use some help. I have a large library mounted via SMB to my RPi. If initialize a local scan and the network drive for whatever reason is accidentally not mounted, my entire library is instantly deleted.

I understand why this behaves this way, but if the library is changing by a large amount of tracks (in my case 7k to 0), it would be nice if if prompted before continuing as it then takes over 3 hours to entirely rebuild the library. Is there any way to have local scan either prompt me before clearing the library for "not found" tracks or work around this issue?

Thanks!

kingosticks commented 2 years ago

Have you considered modifying your update command to test the drive is mounted first? Maybe like ls /mount/well_known_path && mopidyctl local scan?

ncsufan8628 commented 2 years ago

Thanks! Thats a great idea. I can add a wait in there too to give me time to cancel if there is an issue.

kingosticks commented 2 years ago

If you do it like that with the && it won't run the scan if the directory listing fails (because it doesn't exist).

ncsufan8628 commented 2 years ago

Maybe I should be mounting differently, but the directory is always there the way I have it setup. It will just be empty if the mount is not successful.

I am running: ls /dir/path && echo Waiting 30s && sleep 30 && sudo mopidyctl local scan

Seems to be giving me enough time to ctl+c if the dir is empty now.

kingosticks commented 2 years ago

Ideally you'd try to list some known directory or file that's on the mounted drive so that it just won't be there if the mount isn't working. Or maybe there's some other command you can run that'll exit with error status if the mount isn't available. Just a bit nicer to avoid needing interaction from you. But yours sounds good too, whatever works for you.