#!/bin/bash

DIR="/mnt/fourtb/global/tlr/musics/2elecboo"
BASEURL="http://199.91.120.152/share/tlr/musics/2elecboo"

cd "$DIR" || exit 1

echo "#EXTM3U" > 2elecboo.m3u

find . -maxdepth 1 -type f \( -iname "*.mp3" -o -iname "*.flac" -o -iname "*.wav" -o -iname "*.m4a" -o -iname "*.mp4" \) \
| sed 's|^\./||' \
| while read f; do
    echo "#EXTINF:-1,$f" >> 2elecboo.m3u
    echo "$BASEURL/$f" >> 2elecboo.m3u
    echo "" >> 2elecboo.m3u
done
