Created
January 29, 2020 17:47
-
-
Save nick3499/ae22f8640c0b28cc8a3b9c73e3a69546 to your computer and use it in GitHub Desktop.
Python 3: Radio Streams VLC: csv.reader(), subprocess.run()
This file contains 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
:::::::.. :::. :::::::-. ::: ... | |
;;;;``;;;; ;;`;; ;;, `';,;;; .;;;;;;;. | |
[[[,/[[[' ,[[ '[[, `[[ [[[[[,[[ \[[, | |
$$$$$$c c$$$cc$$$c $$, $$$$$$$$, $$$ | |
888b "88bo,888 888,888_,o8P'888"888,_ _,88P | |
MMMM "W" YMM ""` MMMMP"` MMM "YMMMMMP" |
This file contains 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
#! /snap/bin/pypy3 | |
'''`radio_streams_vlc` displays a list of Internet radio stations along with | |
numbers for users to make selections. Press "h" for help.''' | |
from csv import reader | |
from subprocess import run | |
def station_selection(): | |
'''`station_selection()` method displays a list of Internet radio stations | |
from a CSV database, and prompts the user make a selection.''' | |
cyan = '\x1b[38;2;72;201;176m' # format text RGB: 72, 201, 176 | |
yelo = '\x1b[38;2;244;208;63m' | |
orng = '\x1b[38;2;220;118;51m' | |
reset = '\x1b[0m' # reset to default | |
urls = {} # number selection: station URL | |
with open('ascii_radio.txt', 'r') as ascii_art: | |
[print(f'{cyan}{line[:-1]}{reset}') for line in ascii_art] # ASCII art | |
with open('stations.csv', 'r') as _file: | |
_reader = reader(_file) # csv reader object | |
for number, record in enumerate(_reader, 1): | |
print(f'{cyan}{number:>2}{reset} {yelo}{record[0]:}{reset} \ | |
{orng}{record[1]}{reset}') # print radio station list | |
urls[number] = record[2] # append number with URL to dictionary | |
station_num = int(input('Enter station number: ')) # input station number | |
# pass CLI args to VLC media player, including radion station URL | |
run(['/snap/bin/vlc', '--intf', 'ncurses', urls[station_num]], check=True) | |
if __name__ == '__main__': | |
station_selection() |
This file contains 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
DEF CON Radio [SomaFM] | Mid-tempo Downtempo Chillout ChillStep ElectroSoul Ambient | http://ice2.somafm.com/defcon-128-aac | |
---|---|---|---|
Black Rock FM [SomaFM] | DarkAmbient DesertElectronic | http://ice2.somafm.com/brfm-128-aac | |
Drone Zone [SomaFM] | Ambient Space | http://ice4.somafm.com/dronezone-128-aac | |
SF 10-33 [SomaFM] | Ambient | Police Dispatch | http://ice4.somafm.com/sf1033-128-aac | |
Deep Space One [SomaFM] | Ambient Space | http://ice2.somafm.com/deepspaceone-128-aac | |
Mission Control [SomaFM] | Ambient | space flight chatter | http://ice4.somafm.com/missioncontrol-128-aac | |
Space Station Soma [SomaFM] | Downtempo | http://ice3.somafm.com/spacestation-128-mp3 | |
Groove Salad [SomaFM] | Ambient Downtempo | http://ice4.somafm.com/groovesalad-128-aac | |
Groove Salad Classic [SomaFM] | Downtempo Chillout | http://ice4.somafm.com/gsclassic-128-aac | |
Mixing of Particulate Solids | Ambient Experimental | http://147.175.61.55:8000 | |
Ambi103 | DarkAmbient ChillOut Downtempo | http://173.208.177.90:16576 | |
FmDomPMR | ChillOut Ambient PsyChill | http://130.185.144.199:18832 | |
SleepBot Env. Broadcast | Ambient | http://sc13.shoutcaststreaming.us:8194 | |
Dark Ambient | DarkAmbient | http://95.211.3.65:8835 | |
Ambient Fantasy [DI] | Ambient | http://5.39.71.159:8193 | |
Cosmic Waves | Ambient | http://cosmicwaves.ru:8000 | |
Relaxing Radio | Ambient | http://149.56.195.94:8660 | |
Infinite Space | Ambient Downtempo | http://198.24.145.146:9654 | |
Echoes of BLUEMARS | Ambient | http://streams.echoesofbluemars.org/bluemars.m3u | |
Cryosleep: Echoes of BLUEMARS | Ambient | http://streams.echoesofbluemars.org:8000/cryosleep | |
Dark Ambient Radio | Germany | http://s3.viastreaming.net:8835/ | |
PsyradioFM | Chillout Goa Ambient | http://streamer.psyradio.org:8020/chillout | |
Verdure | Russia | deep ambient | idm | http://air.verdure.net:8881 | |
Systrum Sistum: SSR1 | Drone Ambient | Australia | http://systrum.net:8000/Systrum-Channel1 | |
9128 Live | Ambient Techno Electronica | http://streams.radio.co:80/s0aa1e6f4a/listen | |
Ultima Thule | Ambient | http://www.ultimathule.info/audio_programmes2019/UT_1298_56k.mp3 | |
Space Travel Radio | Lounge Ambient Space | Germany | http://136.243.156.30:1701/stream/2/ | |
ChromaNova | Ambient | Germany | http://176.31.123.212:8192 | |
Slow Focus: NTS | Relaxing Drone Ambient | London | https://stream-mixtape-geo.ntslive.net/mixtape | |
Sleep Radio Stream | Ambient | New Zealand | http://149.56.234.138:8169 | |
Seven Rays [laut.fm] | New Age Chillout Ambient | Ukraine | http://7rays.stream.laut.fm/7rays | |
Radio Record | Chillout Ambient | Russia | http://air.radiorecord.ru:8102/chil_320 | |
Radio Provodach | Chillout Ambient | Russia | http://station.waveradio.org/provodach | |
Chillout Zone | Drone Ambient Downtempo Lounge Chillout | http://5.189.142.165:2304/stream | |
Radio Dimensione Relax | Chillout Lounge Ambient | Italy | http://tachyon.shoutca.st:8919/stream | |
Radio Caprice | Drone Ambient | Russia | http://79.111.119.111:8002/droneambient | |
Planet Ambi | Ambient | Swiss | http://philae.shoutca.st:9019 | |
ChillTrax | Chillout Downtempo Ambient | http://station.chilltrax.com | |
Ambient Radio | Ambient Chillout Meditation Lounge NewAge | http://uk2.internet-radio.com:31491 | |
Ambient Radio: Party Vibe | Ambient Chillout | http://94.130.238.52:8056/stream | |
Ambiesphere | Ambient Chillout | http://uk5.internet-radio.com:8347 | |
Nirvana Meditation | Ambient Chillout | Poland | http://81.219.54.6:8004 | |
Vibration Zen Relax | Ambient | Swiss | http://91.121.38.100:8220 | |
Chillout Essentials [MixLive.ie] | Ambient Chillout Downtempo | Ireland | http://198.24.145.146:9998 | |
Sven Radio | Ambient Chillout NewAge | TechHouse EDM | http://51.255.127.128:8012 | |
Soar Walk Radio | Ambient | http://188.165.192.5:8193 | |
Indie Int. Lounge Network | Lounge Chillout Ambient | http://206.190.130.182:8188 | |
LFOD: Pi Radio | Chillout Trap Chillstep Ambient | http://radio.lfod.online:3140/mpd | |
Relaxing Radio | Ambient | http://149.56.195.94:8660 | |
Serene | Ambient Chillout Downtempo | http://192.99.17.12:4950 | |
Radio Cykx | Ambient Classical Alternative | http://104.238.193.114:7073 | |
DeepSpaceChill: Radio InfoWeb | Chillout EDM | New York | http://stream.radioinfoweb.net:8000/chill | |
Radio Schizoid | Psychdelic Chillout Ambient | http://94.130.113.214:8000/chill | |
Slowmodo Rain | Ambient | http://149.202.79.68:8139 | |
UVB-76 | Ambient | Russia | http://uk3-pn.mixstream.net:8370 | |
Pink Noise Radio | Chillout Ambient Noise | UK | http://uk1.internet-radio.com:8004 | |
intraNature | Meditation Ambient Nature | http://192.240.102.198:14244 |
thank you for the list! I will definitely check it out
I exported the list to m3u with:
cat ambient_stations.csv | awk -F "," '{ print "\#EXTINF:-1,"$1}"\\n"{print $3}' > ambient_stations.m3u
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
feel free to drop a comment [or suggestion, or criticism, etc]