Skip to content

Instantly share code, notes, and snippets.

@chriswmartin
Last active March 18, 2018 01:18
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 chriswmartin/601bceb95fdc868aea8120355692bcd8 to your computer and use it in GitHub Desktop.
Save chriswmartin/601bceb95fdc868aea8120355692bcd8 to your computer and use it in GitHub Desktop.
John Cage's "Radio Music" in python
#!/usr/bin/python3
import random
import subprocess
# requires vlc
stations = open('stations.txt').read().splitlines();
play_times = range(1,8);
sleep_times = range(1,7);
volumes = range(510,1025);
for x in range(10):
for z in range(15):
print('\n');
current_station = str(random.choice(stations));
print(current_station);
subprocess.call('cvlc --no-video --play-and-exit --run-time=' + str(random.choice(play_times)) + ' --volume ' + str(random.choice(volumes)) + ' ' + current_station + ' & sleep ' + str(random.choice(sleep_times)), shell=True, executable='/bin/bash');
subprocess.call('killall vlc', shell=True, executable='/bin/bash');
http://minnesota.publicradio.org/tools/play/streams/news.pls
http://common.publicradio.org/streams/current.mp3.m3u
http://minnesota.publicradio.org/tools/play/streams/classical.pls
http://minnesota.publicradio.org/tools/play/streams/local.pls
http://minnesota.publicradio.org/tools/play/streams/radio_heartland.pls
http://choralstream1.publicradio.org/choral.m3u
http://www.wefunkradio.com/play/shoutcast.pls
http://sleepbot.com/ambience/cgi/listen.cgi/listen.pls
http://somafm.com/groovesalad130.pls
http://somafm.com/dronezone130.pls
http://somafm.com/lush130.pls
http://somafm.com/sonicuniverse.pls
http://yp.shoutcast.com/sbin/tunein-station.m3u?id=830692
http://yp.shoutcast.com/sbin/tunein-station.m3u?id=492072
http://yp.shoutcast.com/sbin/tunein-station.m3u?id=1762384
http://yp.shoutcast.com/sbin/tunein-station.m3u?id=1357102
http://www.uzic.ch/tek.m3u
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment