Skip to content

Instantly share code, notes, and snippets.

@shyd
Created December 25, 2017 18:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save shyd/4a12717e31de9f4bbb96750cce65af14 to your computer and use it in GitHub Desktop.
Save shyd/4a12717e31de9f4bbb96750cce65af14 to your computer and use it in GitHub Desktop.
# replace function `play_cd` with this one to play a playlist instead of folder `cd6`
# This assumes you have a playlist ready in `/var/lib/mpd/playlists/myAwesomePlaylist.m3u`
# load new cd-dir
def play_cd(cd_no):
if ser.read() == CDC_END_CMD and ser.read() == CDC_CDSET:
if str(cd_no) == "6":
os.popen("mpc clear")
os.popen("mpc load myAwesomePlaylist")
os.popen("mpc play")
else:
r = os.popen("mpc ls cd" + str(cd_no)).read()
if r != "":
set_cd_no(chr(CD_MASK + cd_no))
os.popen("mpc clear")
os.popen("mpc ls cd" + str(cd_no) + " | mpc add")
os.popen("mpc play")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment