From 67909724e7fba4a3bd5f81d891972fc1f39b0e9a Mon Sep 17 00:00:00 2001 From: Job Evers-Meltzer Date: Wed, 10 Aug 2016 07:44:41 -0500 Subject: [PATCH] fix up import paths --- lbrynet/lbrynet_daemon/LBRYDaemon.py | 13 +++++++------ lbrynet/lbrynet_daemon/LBRYPublisher.py | 10 ++++++---- lbrynet/reflector/__init__.py | 2 ++ 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/lbrynet/lbrynet_daemon/LBRYDaemon.py b/lbrynet/lbrynet_daemon/LBRYDaemon.py index 6f0a78a90..d4e52b91e 100644 --- a/lbrynet/lbrynet_daemon/LBRYDaemon.py +++ b/lbrynet/lbrynet_daemon/LBRYDaemon.py @@ -57,8 +57,7 @@ from lbrynet.core.PTCWallet import PTCWallet from lbrynet.core.LBRYWallet import LBRYcrdWallet, LBRYumWallet from lbrynet.lbryfilemanager.LBRYFileManager import LBRYFileManager from lbrynet.lbryfile.LBRYFileMetadataManager import DBLBRYFileMetadataManager, TempLBRYFileMetadataManager -from lbrynet.reflector.server import ReflectorServerFactory -# from lbryum import LOG_PATH as lbryum_log +from lbrynet import reflector # TODO: this code snippet is everywhere. Make it go away @@ -686,13 +685,15 @@ class LBRYDaemon(jsonrpc.JSONRPC): def _start_reflector(self): if self.run_reflector_server: if self.reflector_port is not None: - reflector_factory = ReflectorServerFactory(self.session.peer_manager, self.session.blob_manager) + reflector_factory = reflector.ServerFactory( + self.session.peer_manager, + self.session.blob_manager + ) try: self.reflector_server_port = reactor.listenTCP(self.reflector_port, reflector_factory) except error.CannotListenError as e: - import traceback - log.error("Couldn't bind reflector to port %d. %s", self.reflector_port, traceback.format_exc()) - raise ValueError("%s lbrynet may already be running on your computer.", str(e)) + log.exception("Couldn't bind reflector to port %d", self.reflector_port) + raise ValueError("{} lbrynet may already be running on your computer.".format(e)) return defer.succeed(True) def _stop_reflector(self): diff --git a/lbrynet/lbrynet_daemon/LBRYPublisher.py b/lbrynet/lbrynet_daemon/LBRYPublisher.py index 970db91f6..2caf1d12b 100644 --- a/lbrynet/lbrynet_daemon/LBRYPublisher.py +++ b/lbrynet/lbrynet_daemon/LBRYPublisher.py @@ -12,7 +12,7 @@ from lbrynet.lbryfile.StreamDescriptor import publish_sd_blob from lbrynet.core.PaymentRateManager import PaymentRateManager from lbrynet.core.LBRYMetadata import Metadata, CURRENT_METADATA_VERSION from lbrynet.lbryfilemanager.LBRYFileDownloader import ManagedLBRYFileDownloader -from lbrynet.reflector.client import LBRYFileReflectorClientFactory +from lbrynet import reflector from lbrynet.conf import LOG_FILE_NAME, REFLECTOR_SERVERS from twisted.internet import threads, defer, reactor @@ -70,9 +70,11 @@ class Publisher(object): return d def start_reflector(self): - factory = LBRYFileReflectorClientFactory(self.session.blob_manager, - self.lbry_file_manager.stream_info_manager, - self.stream_hash) + factory = reflector.ClientFactory( + self.session.blob_manager, + self.lbry_file_manager.stream_info_manager, + self.stream_hash + ) reactor.connectTCP(self.reflector_server, self.reflector_port, factory) return factory.finished_deferred diff --git a/lbrynet/reflector/__init__.py b/lbrynet/reflector/__init__.py index e69de29bb..10e8292e7 100644 --- a/lbrynet/reflector/__init__.py +++ b/lbrynet/reflector/__init__.py @@ -0,0 +1,2 @@ +from lbrynet.reflector.server.server import ReflectorServerFactory as ServerFactory +from lbrynet.reflector.client.client import LBRYFileReflectorClientFactory as ClientFactory