zeroconf: Make stype argument required

This commit is contained in:
Stein Magnus Jodal 2015-09-15 11:05:56 +02:00
parent 729249fffd
commit a4f38e2018
3 changed files with 9 additions and 6 deletions

View File

@ -57,10 +57,12 @@ class HttpFrontend(pykka.ThreadingActor, CoreListener):
if self.zeroconf_name:
self.zeroconf_http = zeroconf.Zeroconf(
stype='_http._tcp', name=self.zeroconf_name,
name=self.zeroconf_name,
stype='_http._tcp',
port=self.port)
self.zeroconf_mopidy_http = zeroconf.Zeroconf(
stype='_mopidy-http._tcp', name=self.zeroconf_name,
name=self.zeroconf_name,
stype='_mopidy-http._tcp',
port=self.port)
self.zeroconf_http.publish()
self.zeroconf_mopidy_http.publish()

View File

@ -45,7 +45,8 @@ class MpdFrontend(pykka.ThreadingActor, CoreListener):
def on_start(self):
if self.zeroconf_name:
self.zeroconf_service = zeroconf.Zeroconf(
stype='_mpd._tcp', name=self.zeroconf_name,
name=self.zeroconf_name,
stype='_mpd._tcp',
port=self.port)
self.zeroconf_service.publish()

View File

@ -37,8 +37,8 @@ class Zeroconf(object):
Currently, this only works on Linux using Avahi via D-Bus.
:param str name: human readable name of the service, e.g. 'MPD on neptune'
:param int port: TCP port of the service, e.g. 6600
:param str stype: service type, e.g. '_mpd._tcp'
:param int port: TCP port of the service, e.g. 6600
:param str domain: local network domain name, defaults to ''
:param str host: interface to advertise the service on, defaults to all
interfaces
@ -47,9 +47,9 @@ class Zeroconf(object):
:type text: list of str
"""
def __init__(self, name, port, stype=None, domain=None, text=None):
def __init__(self, name, stype, port, domain=None, text=None):
self.group = None
self.stype = stype or '_http._tcp'
self.stype = stype
self.domain = domain or ''
self.port = port
self.text = text or []