Created
December 25, 2017 18:22
-
-
Save shyd/4a12717e31de9f4bbb96750cce65af14 to your computer and use it in GitHub Desktop.
Playlist support for http://dev.shyd.de/2013/09/avr-raspberry-pi-vw-beta-vag-cdc-faker/
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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