mirror of
https://github.com/alexbelgium/hassio-addons.git
synced 2026-01-11 18:31:02 +01:00
Improve code
This commit is contained in:
@@ -7,14 +7,17 @@ if [ -d /data/StreamData ]; then
|
||||
|
||||
# Check if there are .wav files in /data/StreamData
|
||||
if find /data/StreamData -type f -name "*.wav" | grep -q .; then
|
||||
bashio::log.fatal "Restoring .wav files from /data/StreamData to $HOME/BirdSongs/StreamData."
|
||||
bashio::log.warning "Restoring .wav files from /data/StreamData to $HOME/BirdSongs/StreamData."
|
||||
|
||||
# Count the number of .wav files to be moved
|
||||
file_count=$(find /data/StreamData -type f -name "*.wav" | wc -l)
|
||||
echo "... found $file_count .wav files to restore."
|
||||
|
||||
# Move the .wav files using `mv` to avoid double log entries
|
||||
mv -v /data/StreamData/*.wav "$HOME"/BirdSongs/StreamData/
|
||||
|
||||
bashio::log.fatal "... files restored successfully, allowing container to stop."
|
||||
else
|
||||
bashio::log.info "No .wav files found to restore."
|
||||
echo "... no .wav files found to restore."
|
||||
fi
|
||||
|
||||
# Clean up the source folder if empty
|
||||
|
||||
Reference in New Issue
Block a user