#!/bin/sh

amused="${AMUSED:-amused}"

notify() {
	path="$($amused status -f path)"
	base="${path##*/}"
	name="${base%.*}"

	termux-notification -i amused --ongoing -t "$name" -c "$path" \
		--type media \
		--media-next     "$amused next" \
		--media-pause    "$amused pause" \
		--media-play     "$amused play" \
		--media-previous "$amused previous"
}

notify
$amused monitor jump,next,pause,play,previous,stop | while read line; do
	notify
done
