Skip to content

Instantly share code, notes, and snippets.

@dsprenkels
Last active November 21, 2023 06:30
Show Gist options
  • Save dsprenkels/0f73fb28a2baf0838585 to your computer and use it in GitHub Desktop.
Save dsprenkels/0f73fb28a2baf0838585 to your computer and use it in GitHub Desktop.
MDP alarm
#!/bin/bash
# Copyright 2015 Daan Sprenkels <[email protected]>
export MPD_HOST="$MPD_PASSWD@localhost"
export MPD_PORT=6600
PLAYLISTS_DIR="/var/lib/mpd/playlists"
# Don't activate if we are already playing music
[[ $(mpc status | grep '^\[playing\]') ]] && exit 0
mpc clear
cat "$(ls -1 ${PLAYLISTS_DIR}/*.m3u | sort -R | head -n1)" | mpc add
mpc play
exit 0
@bonelifer
Copy link

Great. All the other ones I've found were to complicated for what they are.

@dsprenkels
Copy link
Author

@bonelifer 🎉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment