Hypnos is a sleep-timer and counter for iTunes.
Shut down, sleep or restart your Mac or pause/quit iTunes, if a given number of songs are played or repeated. Or after a given time (duration in minutes) has elapsed. Fade-Out the volume of iTunes automatically and tell Hypnos, if it should quit automatically after it has done its job, or not. Use HypnosRemote on your iPhone to start/stop Hypnos on the Mac and follow the count down.