#!/usr/bin/env bash

# Collect all MP3 files recursively into an array
mapfile -d '' FILES < <(find . -type f -iname "*.mp3" -print0)

while true; do
    for f in "${FILES[@]}"; do
        echo "Streaming: $f"
        ffmpeg -re -i "$f" -vn -c:a libmp3lame -b:a 192k -f mp3 \
            -content_type audio/mpeg -ice_name "LocalStream" \
            http://0.0.0.0:8000/stream
    done
done
