def setup(self, hosts=None, username=None, password=None): self._connections = [] for host in (x.strip() for x in (hosts or settings.KODI_HOST or "").split(",") if x.strip()): try: if ":" in host: bare_host, port = host.split(":") kodi = Kodi(bare_host, username or settings.KODI_USERNAME, password or settings.KODI_PASSWORD, port=try_int(port, 8080)) else: kodi = Kodi(host, username or settings.KODI_USERNAME, password or settings.KODI_PASSWORD) kodi.host = kodi.variables()["hostname"]["value"] try: server_name = kodi.Settings.GetSettingValue( setting="services.devicename")["result"]["value"] kodi.name = server_name except: pass if kodi not in self._connections: self._connections.append(kodi) except (URLError, RequestTimeout, KeyError, IndexError): pass
def setup(self, hosts=None, username=None, password=None): self._connections = [] for host in (x.strip() for x in (hosts or sickbeard.KODI_HOST or '').split(",") if x.strip()): try: kodi = Kodi(host, username or sickbeard.KODI_USERNAME, password or sickbeard.KODI_PASSWORD) kodi.host = kodi.variables()['hostname']['value'] kodi.name = kodi.Settings.GetSettingValue( setting="services.devicename")['result']['value'] if kodi not in self._connections: self._connections.append(kodi) except (URLError, RequestTimeout): pass