Skip to content

Instantly share code, notes, and snippets.

@shyd
Created Dec 25, 2017
Embed
What would you like to do?
# 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