-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathradio_min.py
37 lines (32 loc) · 900 Bytes
/
radio_min.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#import sys
import time
import subprocess
import os
#import glob
#from stat import * # ST_SIZE etc
os.environ["SDL_FBDEV"] = "/dev/fb1"
os.environ["SDL_MOUSEDEV"] = "/dev/input/touchscreen"
os.environ["SDL_MOUSEDRV"] = "TSLIB"
"""
"""
def station_list():
lines = open('playlist.txt', 'r', 444).readlines()
stations =[]
for line in lines:
line = line.rstrip("\n")
stations.append(line)
return (stations)
subprocess.call("mpc play ", shell=True) # start with radio on
number_of_stations = len(station_list())
stations = station_list()
print ("\n")
for station in stations:
""" Scroll thru stations
Station number is for mpc, station for display
"""
n = stations.index(station) + 1
print (n, station)
#subprocess.run("mpc next ", shell = True)
subprocess.call("mpc play "+ str(n), shell = True)
print ("\n")
time.sleep(3)