diff --git a/amarok/src/scripts/common/Publisher.py b/amarok/src/scripts/common/Publisher.py index 06f28e59..9d16f29b 100644 --- a/amarok/src/scripts/common/Publisher.py +++ b/amarok/src/scripts/common/Publisher.py @@ -18,7 +18,7 @@ from string import split publisher = None # SIGTERM handler must be able to reach this class Publisher: - + active = False zeroconf = None localip = None @@ -26,31 +26,29 @@ class Publisher: def services(self): # override this to provide list of services to register return [] - - def run(self): - + + def run(self): self.localhostname = split(socket.gethostname(),'.')[0]+'.local.' - try: - self.localip = socket.gethostbyname(self.localhostname) - self.zeroconf = Zeroconf.Zeroconf(self.localip) - except: - return - self.active = True + try: + self.localip = socket.gethostbyname(self.localhostname) + self.zeroconf = Zeroconf.Zeroconf(self.localip) + except: + return + + self.active = True toRegister = self.services() for i in toRegister: service = Zeroconf.ServiceInfo( - i["type"]+".local.", - i["name"]+"."+i["type"]+".local.", - socket.inet_aton(self.localip), - i["port"], - 0, - 0, - i["properties"], - self.localhostname) - self.zeroconf.registerService(service) + i["type"]+".local.", + i["name"]+"."+i["type"]+".local.", + socket.inet_aton(self.localip), + i["port"], + 0, + 0, + i["properties"], + self.localhostname) + self.zeroconf.registerService(service) def shutdown(self): if self.active: self.zeroconf.close() - -