1
0
mirror of https://github.com/azlux/botamusique synced 2024-11-23 22:06:09 +00:00

Compare commits

..

No commits in common. "ba02cdebf2e175dc371995361eafcb88ad2c1b52" and "6faadd6669aa27f1c65bf7327f2b2eccf6b15255" have entirely different histories.

View File

@ -22,10 +22,8 @@ def get_radio_server_description(url):
url_icecast = base_url + '/status-json.xsl' url_icecast = base_url + '/status-json.xsl'
url_shoutcast = base_url + '/stats?json=1' url_shoutcast = base_url + '/stats?json=1'
try: try:
response = requests.head(url_shoutcast, timeout=3) r = requests.get(url_shoutcast, timeout=10)
if not response.headers.get('content-type', '').startswith(("audio/", "video/")): data = r.json()
response = requests.get(url_shoutcast, timeout=10)
data = response.json()
title_server = data['servertitle'] title_server = data['servertitle']
return title_server return title_server
# logging.info("TITLE FOUND SHOUTCAST: " + title_server) # logging.info("TITLE FOUND SHOUTCAST: " + title_server)
@ -40,10 +38,8 @@ def get_radio_server_description(url):
return url return url
try: try:
response = requests.head(url_shoutcast, timeout=3) r = requests.get(url_icecast, timeout=10)
if not response.headers.get('content-type', '').startswith(("audio/", "video/")): data = r.json()
response = requests.get(url_icecast, timeout=10)
data = response.json()
source = data['icestats']['source'] source = data['icestats']['source']
if type(source) is list: if type(source) is list:
source = source[0] source = source[0]