From 50cfe42ce04bb3c238b5aad604b215dd80cdf318 Mon Sep 17 00:00:00 2001 From: Thomas Adamcik Date: Sat, 9 Nov 2013 14:04:38 +0100 Subject: [PATCH] avahi: Improve error handling for dbus errors. - Handle dbus not being installed. - Handle not finding the system bus. - Handle not finding the avahi service. - Return if publish succeeded. --- mopidy/utils/zeroconf.py | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/mopidy/utils/zeroconf.py b/mopidy/utils/zeroconf.py index c69fb950..62545e27 100644 --- a/mopidy/utils/zeroconf.py +++ b/mopidy/utils/zeroconf.py @@ -1,17 +1,21 @@ from __future__ import unicode_literals +import logging +import re + +logger = logging.getLogger('mopidy.utils.zerconf') + try: import dbus except ImportError: dbus = None -import re - _AVAHI_IF_UNSPEC = -1 _AVAHI_PROTO_UNSPEC = -1 _AVAHI_PUBLISHFLAGS_NONE = 0 + def _filter_loopback_and_meta_addresses(host): # TODO: see if we can find a cleaner way of handling this. if re.search(r'(?