media-server / scripts /audio1.sh
jbilcke-hf's picture
jbilcke-hf HF staff
added channel 2
0b2f8ce
raw
history blame
1.08 kB
#!/bin/bash
echo "Starting the audio collection stream for channel 1.."
current_count=0
while true; do
new_count=$(ls $WEBTV_AUDIO_STORAGE_PATH_CHANNEL_1*.mp3 2> /dev/null | wc -l)
if [ $new_count -ne $current_count ]; then
echo "there are $new_count audio files for channel 1"
echo "Updating audio playlists for channel 1..."
current_count=$new_count
files=($WEBTV_AUDIO_STORAGE_PATH_CHANNEL_1*.mp3)
# Re-create the audio playlists
echo "ffconcat version 1.0" > channel_1_audio_list_a.txt
echo "ffconcat version 1.0" > channel_1_audio_list_b.txt
for (( i=0; i<${#files[@]}; i++ )); do
if (( i%2 == 0 )); then
echo "file '${files[$i]}'" >> channel_1_audio_list_a.txt
else
echo "file '${files[$i]}'" >> channel_1_audio_list_b.txt
fi
done
echo "file 'channel_1_audio_list_b.txt'" >> channel_1_audio_list_a.txt
echo "file 'channel_1_audio_list_a.txt'" >> channel_1_audio_list_b.txt
fi
sleep 1
done