Possible to check if a file exists in local storage?

Hey folks! I’ve been thinking it’d be great to play a custom file from local storage on a music player, but fall back to TTS if it doesn’t exist. Doing a playTrackAndRestore against the hub’s /local directory doesn’t seem to throw an error if it doesn’t exist, so try/catch isn’t an option. Is there a way to check local storage for a file before trying to play it?

Maybe @bobbyD knows?

Late to the party on this thread - you could run an HTTP GET on the file URL - if it doesn't exist it will return a 404 error...

Could there not be some obscure situation where services or something is not available / running to service HTTP requests but a file exists? An extreme edge case, if an issue at all... So probably not worth worrying about.... I guess the main test I would do is if you unplug your Internet does that method still hold up? I assume it would... For a file that does actually exist.

Download the Hubitat app