zeroconf: Display Avahi server's hostname
This commit is contained in:
parent
dbafe74662
commit
6ad235564e
@ -1,7 +1,6 @@
|
|||||||
from __future__ import absolute_import, unicode_literals
|
from __future__ import absolute_import, unicode_literals
|
||||||
|
|
||||||
import logging
|
import logging
|
||||||
import socket
|
|
||||||
import string
|
import string
|
||||||
|
|
||||||
logger = logging.getLogger(__name__)
|
logger = logging.getLogger(__name__)
|
||||||
@ -64,13 +63,13 @@ class Zeroconf(object):
|
|||||||
except dbus.exceptions.DBusException as e:
|
except dbus.exceptions.DBusException as e:
|
||||||
logger.debug('%s: Server failed: %s', self, e)
|
logger.debug('%s: Server failed: %s', self, e)
|
||||||
|
|
||||||
self.display_hostname = '%s.local' % socket.getfqdn()
|
self.display_hostname = '%s' % self.server.GetHostName()
|
||||||
self.name = string.Template(name).safe_substitute(
|
self.name = string.Template(name).safe_substitute(
|
||||||
hostname=self.display_hostname, port=port)
|
hostname=self.display_hostname, port=port)
|
||||||
|
|
||||||
def __str__(self):
|
def __str__(self):
|
||||||
return 'Zeroconf service %s at [%s]:%d' % (
|
return 'Zeroconf service "%s" (%s at [%s]:%d)' % (
|
||||||
self.stype, self.host, self.port)
|
self.name, self.stype, self.host, self.port)
|
||||||
|
|
||||||
def publish(self):
|
def publish(self):
|
||||||
"""Publish the service.
|
"""Publish the service.
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user