mpd: Simplify Zeroconf publishing
This commit is contained in:
parent
ece59f5deb
commit
b685f2ae63
@ -18,6 +18,7 @@ class MpdFrontend(pykka.ThreadingActor, CoreListener):
|
|||||||
|
|
||||||
self.hostname = network.format_hostname(config['mpd']['hostname'])
|
self.hostname = network.format_hostname(config['mpd']['hostname'])
|
||||||
self.port = config['mpd']['port']
|
self.port = config['mpd']['port']
|
||||||
|
|
||||||
self.zeroconf_name = config['mpd']['zeroconf']
|
self.zeroconf_name = config['mpd']['zeroconf']
|
||||||
self.zeroconf_service = None
|
self.zeroconf_service = None
|
||||||
|
|
||||||
@ -43,13 +44,7 @@ class MpdFrontend(pykka.ThreadingActor, CoreListener):
|
|||||||
self.zeroconf_service = zeroconf.Zeroconf(
|
self.zeroconf_service = zeroconf.Zeroconf(
|
||||||
stype='_mpd._tcp', name=self.zeroconf_name,
|
stype='_mpd._tcp', name=self.zeroconf_name,
|
||||||
host=self.hostname, port=self.port)
|
host=self.hostname, port=self.port)
|
||||||
|
self.zeroconf_service.publish()
|
||||||
if self.zeroconf_service.publish():
|
|
||||||
logger.debug(
|
|
||||||
'Registered MPD with Zeroconf as "%s"',
|
|
||||||
self.zeroconf_service.name)
|
|
||||||
else:
|
|
||||||
logger.debug('Registering MPD with Zeroconf failed.')
|
|
||||||
|
|
||||||
def on_stop(self):
|
def on_stop(self):
|
||||||
if self.zeroconf_service:
|
if self.zeroconf_service:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user