-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathjemp.py
More file actions
38 lines (31 loc) · 975 Bytes
/
Copy pathjemp.py
File metadata and controls
38 lines (31 loc) · 975 Bytes
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
38
import json
import http.client
conn = http.client.HTTPSConnection("public.radio.co")
station = 'stations/sd71de59b3/status'
payload = "{}"
conn.request("GET", station, payload)
res = conn.getresponse()
data = res.read()
json_string = data.decode("utf-8")
now_playing = json.loads(json_string)
print("JEMP is currently playing: " + now_playing["current_track"]["title"])
song = now_playing["current_track"]["title"]
artist = song[0:7]
showdate = song[song.find("(")+1:song.find(")")]
if artist == 'Phish -':
print("Phish is playing!")
if int(showdate[-2:]) < 80:
year = str(int(showdate[-2:]) + 2000)
else:
year = str(int(showdate[-2:]) + 1900)
month = showdate[:-3]
month = "000" + month[:month.find("-")]
month = month[-2:]
day = showdate[:-3]
day = "000" + day[day.find("-")+1:]
day = day[-2:]
show = year + "-" + month + "-" + day
else:
print("Phish is not playing :(")
show = "1900-01-01"
print(show)