1
0
Fork 0
mirror of https://github.com/Findus23/RadioStats.git synced 2024-09-19 16:03:48 +02:00
RadioStats/parser/aas.py

19 lines
582 B
Python
Raw Normal View History

from utils import *
2019-09-26 10:17:28 +02:00
from sentry_sdk import capture_exception
URL = "https://meta.radio886.at/886/0"
def get(channel):
2019-09-26 10:17:28 +02:00
data = fetch(URL, True)
if "data" not in data:
capture_exception(Exception("886 didn't return any data."))
return []
for track in fetch(URL, True)["data"]:
artist = track["name"]
title = track["title"]
2018-12-25 20:14:31 +01:00
try:
time = time_to_date(string_to_time(track["scheduled_time"]))
yield time, artist, title
2019-09-26 10:17:28 +02:00
except ValueError as e: # in case time is 24:02:31 or similar
2018-12-25 20:14:31 +01:00
print(e)