notes/Daily Audio Bible DAB Player for LinuxAndroidTermuxMPV-zgDBg3Uw.sh
#!/data/data/com.termux/files/usr/bin/bash


dir="$HOME/downloads"

function get_new(){
  clear
  echo "No Files Found"
  echo "Streaming newest..."
  url="https://player.dailyaudiobible.com/dab"
  m4a="$(wget -qO- "$url"|grep m4a|sed 's/"url":"/\n/g'|tail -n1|cut -d\" -f1|sed 's|\\/|/|g')"
  echo "$m4a"
  mpv --speed 1.77 "$m4a"
  exit
}

#files=( $dir/*dailyaudiobible* )
ls $dir/*dailyaudiobible* || get_new

files=($( ls $dir/*dailyaudiobible* ))
let x=0;

if [ "${#files[@]}" -eq "1" ]

then
  echo "One File Found"
  f="${files[0]}"
  echo "Playing $f"
else

  echo "${files[@]} files found."
  for i in "${files[@]}"
  do

    t="$(echo "$i"|rev|cut -d\_ -f1|rev)"
    echo "$x)$t"
    let x++
  done

  echo -n "Select a number: "
  read f

  #exit if no option is selected

  if [ "$f" = "" ];then exit 0;fi

  f="${files[f]}"

fi

t="$(echo "$f"|rev|cut -d\_ -f1|rev)"
echo "Playing $t"
mpv --speed 1.77 $f

echo "Would you like to remove this file? (Y/n)"
read del


if [ "${del^^}" == "Y" ] || [ "$del" == "" ]
then
  rm "$f" && echo "$f had been deleted."
fi

syntax highlighted by Code2HTML, v. 0.9.1