From 5888815cd8bb656c201b0a8393b1fe113f5dff81 Mon Sep 17 00:00:00 2001 From: milaq Date: Thu, 24 Jan 2019 22:07:06 +0100 Subject: [PATCH] add compatibility for other vendors do not hardcode initurl to get easy compatibility with other initurls (e.g. onkyo) --- ycast.py | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/ycast.py b/ycast.py index 38761d3..74e4dc6 100755 --- a/ycast.py +++ b/ycast.py @@ -8,7 +8,6 @@ import xml.etree.cElementTree as etree import yaml -VTUNER_INITURL = '/setupapp/Yamaha/asp/BrowseXML/loginXML.asp' YCAST_LOCATION = 'ycast' stations = {} @@ -37,13 +36,13 @@ class YCastServer(BaseHTTPRequestHandler): def do_GET(self): get_stations() self.address = 'http://' + self.headers['Host'] - if self.path.startswith(VTUNER_INITURL + '?token='): + if 'loginXML.asp?token=0' in self.path: self.send_xml_header() self.wfile.write(bytes('stub', 'utf-8')) elif self.path == '/' \ or self.path == '/' + YCAST_LOCATION \ or self.path == '/' + YCAST_LOCATION + '/'\ - or self.path.startswith(VTUNER_INITURL): + or self.path.startswith('/setupapp'): self.send_xml_header() xml = self.create_root() for category in sorted(stations, key=str.lower):