#
Usage: Brandomusic is written in bash Contribute on GitHub
#!/usr/bin/env bash
luisadha.github.io/brandomusic Use this self-hosted script to Playing song on ~/storage/music on Termux.
### Bermain di Terminal. <(curl -L luisadha.github.io/brandomusic)
shopt -s nullglob globstar
set +o noclobber
MUSIC_DIR="${HOME}/storage/music"
IFS=$'\n' # Gunakan newline sebagai pemisah array
format='audio/mp3'; file="${1:-$MUSIC_DIR/*.mp3}"; files=($file); n=${#files[@]}; if (( n == 0 )); then echo "Tidak ada file MP3 ditemukan."; exit 1; fi
pick="${files[RANDOM % n]}"
tmp="/sdcard/Download/$(basename "$pick")"
cd "/sdcard/Download" &>/dev/null
cp -rf "$pick" "$tmp" &>/dev/null
echo "Siap mendengarkan musik? (y/N)"
read -s -n 1 answer
echo
case "$answer" in
[Yy])
echo "Warning: Centang selalu aplikasi pemutar favorit anda untuk melewati popup."
xdg-open --content-type "$format" "$tmp"
sleep 1
echo
;;
*)
echo -e "O-K tidak apa-apa, mungkin lain kali."
rm -f "$tmp"
;;
esac
rm -f "$tmp"
cd - &>/dev/null;
#