If you are like me and like to slowly calm down while reading a book and listening to music before going to sleep, this might interest you.
Requires Node.js
npx go-to-sleep [options]
By default, the script will play the Sleep
playlist in iTunes while gradually lowering the volume during 30 minutes before putting the computer to sleep.
However, you can easily change those defaults by either passing some options to the command or creating a file containing your configuration if you plan to use it more often.
-a, --application [application] name of the music player. Only iTunes, Music (on macOS 10.15), and Spotify are supported for the moment.
-m, --minutes [number] how long before you'd like to sleep?
-p, --playlist [playlistName] name (or Spotify URI) of the playlist
# Play the "Sleep" playlist in iTunes for 30min
npx go-to-sleep --minutes=30 --playlist=Sleep
# Play the playlist 5aPHtZ3JXijkkCqYm6QoR1 in Spotify
npx go-to-sleep --application=Spotify --playlist=spotify:playlist:5aPHtZ3JXijkkCqYm6QoR1
Create a new file .go-to-sleep
in your home directory and the script will pick up the default configuration from there.
application=Spotify
playlist=spotify:playlist:5aPHtZ3JXijkkCqYm6QoR1
minutes=40
MIT