Leaner code, rsync usage

This commit is contained in:
Alexandre
2024-10-05 10:20:33 +02:00
committed by GitHub
parent 51a84a9ee3
commit 2fde15678a

View File

@@ -4,12 +4,15 @@
# Check if there are files in "$HOME"/BirdSongs/StreamData and move them to /data/StreamData
if [ -d /data/StreamData ] && [ "$(ls -A /data/StreamData/)" ]; then
bashio::log.warning "Container was stopped while files were still being analysed, restoring them"
# Count the number of .wav files in /data/StreamData
wav_count=$(find /data/StreamData -type f -name "*.wav" | wc -l)
bashio::log.warning "Container was stopped while files were still being analyzed, restoring $wav_count .wav files"
# Copy files
if [ "$(ls -A /data/StreamData)" ]; then
if [ "$wav_count" -gt 0 ]; then
mv -v /data/StreamData/* "$HOME"/BirdSongs/StreamData/
fi
echo "... done"
echo ""
@@ -21,4 +24,3 @@ if [ -d /data/StreamData ] && [ "$(ls -A /data/StreamData/)" ]; then
rm -r /data/StreamData
fi