#!/bin/bash

LAST_SONG=$(mpc current)
REMAINING="${1:-1}"

echo "${REMAINING} ${LAST_SONG}"
while [ "${REMAINING}" -gt 0 ]; do
	SONG=$(mpc current --wait)
	if [ "${SONG}" != "${LAST_SONG}" ]; then
		let "REMAINING -= 1"
		LAST_SONG="${SONG}"
		echo "${REMAINING} ${LAST_SONG}"
	fi
done

mpc stop
