diff --git a/src/calibre/library/server.py b/src/calibre/library/server.py index 930a644be8..4ba6253819 100644 --- a/src/calibre/library/server.py +++ b/src/calibre/library/server.py @@ -7,7 +7,7 @@ __docformat__ = 'restructuredtext en' HTTP server for remote access to the calibre database. ''' -import sys, textwrap, operator, os, re, logging, subprocess +import sys, textwrap, operator, os, re, logging from itertools import repeat from logging.handlers import RotatingFileHandler from datetime import datetime diff --git a/src/calibre/utils/Zeroconf.py b/src/calibre/utils/Zeroconf.py index 610c353fca..3bdb992685 100755 --- a/src/calibre/utils/Zeroconf.py +++ b/src/calibre/utils/Zeroconf.py @@ -933,7 +933,11 @@ class Reaper(threading.Thread): def run(self): while 1: - self.zeroconf.wait(10 * 1000) + try: + self.zeroconf.wait(10 * 1000) + except TypeError: # By Kovid + globals()['_GLOBAL_DONE'] = 1 + return if globals()['_GLOBAL_DONE']: return now = currentTimeMillis() diff --git a/src/calibre/utils/mdns.py b/src/calibre/utils/mdns.py index f941446202..033b903e11 100644 --- a/src/calibre/utils/mdns.py +++ b/src/calibre/utils/mdns.py @@ -41,7 +41,7 @@ def publish(desc, type, port, properties=None, add_hostname=True): ''' port = int(port) server = start_server() - hostname = socket.gethostname() + hostname = socket.gethostname().partition('.')[0] if add_hostname: desc += ' (on %s)'%hostname local_ip = get_external_ip() @@ -58,40 +58,3 @@ def stop_server(): global _server if _server is not None: _server.close() - -''' -class Publish(object): - - def __init__(self, desc, name, port, txt=''): - self.desc = desc - self.name = name - self.port = port - self.txt = txt - - def start(self): - if iswindows: - return - if isosx: - args = ['dns-sd', self.desc, self.name, '.', self.port] - else: - args = ['avahi-publish-service', self.desc, self.name, self.port] - if self.txt: - args.append(self.txt) - - self.process = subprocess.Popen(args) - - def stop(self): - if iswindows: - pass - else: - process = getattr(self, 'process', None) - if process is not None: - process.poll() - if process.returncode is not None: - process.terminate() - process.poll() - if process.returncode is not None: - process.kill() - -def publish(desc, name, port, txt): -''' \ No newline at end of file