echo
echo "Copy path of BDMV directory to clipboard:"
echo "e.g., /Volumes/Alita.Battle.Angel.2019.UHD.BluRay/BDMV"
echo
read -rsp $'Press any key when you\'re done...\n' -n 1 -e key  </dev/tty
d="`pbpaste`"
echo $d
echo
echo "Copy 'Segment map' line to clipboard:"
echo "e.g., Segment map: 687,688,674,689"
echo
read -rsp $'Press any key when you\'re done...\n' -n 1 -e key  </dev/tty
s="`pbpaste`"
echo $s
echo
if [ -f playlist.m3u ]
	then rm playlist.m3u
fi
for i in $(echo $s | awk -F ': ' '{print $NF}' | tr ',' '\n')
do
	printf "%s/STREAM/%05d%s\n" $d $i .m2ts >> playlist.m3u
done
mpv --really-quiet --playlist=playlist.m3u > /dev/null 2>&1
#vlc playlist.m3u > /dev/null 2>&1
