StevenHickson / RPiVideoLooper

Video Looper for the Raspberry Pi
Other
98 stars 36 forks source link

Videolooper starting too fast before wifi network #15

Open darkvador72 opened 8 years ago

darkvador72 commented 8 years ago

Hi,

When using Video looper to connect to a SMB share (on Windows) using wifi connection, the application Video Looper is starting before SMB mount completion.

Is there a way to check that there are files in the target directory and wait before starting the app or to restart the app using a cron entry ?

Thank you for yoru help Best Regards

rmcaninch commented 7 years ago

I scripted an rsync to copy the files off the SMB share and onto the SD card nightly. So they would easily be available.

Don't have time to test this right now, but in startvideos.sh you could try adding something like this after line 14:

# Set bailout to avoid an infinite loop if the FILES share never is readable.
bailout=0
while [! -r $FILES && -x $FILES  ];
do
    sleep 2
    bailout+=2
    if [[ ! "$bailout" -gt 200 ]]; then
        exit 0
done

The idea is to test the FILES directory is readable and executable then sleep 2 seconds and try again. And exit if it hits 200 seconds.