fix up import paths

This commit is contained in:
Job Evers-Meltzer 2016-08-10 07:44:41 -05:00
parent 1c88cbc5f6
commit 67909724e7
3 changed files with 15 additions and 10 deletions

View file

@ -57,8 +57,7 @@ from lbrynet.core.PTCWallet import PTCWallet
from lbrynet.core.LBRYWallet import LBRYcrdWallet, LBRYumWallet from lbrynet.core.LBRYWallet import LBRYcrdWallet, LBRYumWallet
from lbrynet.lbryfilemanager.LBRYFileManager import LBRYFileManager from lbrynet.lbryfilemanager.LBRYFileManager import LBRYFileManager
from lbrynet.lbryfile.LBRYFileMetadataManager import DBLBRYFileMetadataManager, TempLBRYFileMetadataManager from lbrynet.lbryfile.LBRYFileMetadataManager import DBLBRYFileMetadataManager, TempLBRYFileMetadataManager
from lbrynet.reflector.server import ReflectorServerFactory from lbrynet import reflector
# from lbryum import LOG_PATH as lbryum_log
# TODO: this code snippet is everywhere. Make it go away # TODO: this code snippet is everywhere. Make it go away
@ -686,13 +685,15 @@ class LBRYDaemon(jsonrpc.JSONRPC):
def _start_reflector(self): def _start_reflector(self):
if self.run_reflector_server: if self.run_reflector_server:
if self.reflector_port is not None: 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: try:
self.reflector_server_port = reactor.listenTCP(self.reflector_port, reflector_factory) self.reflector_server_port = reactor.listenTCP(self.reflector_port, reflector_factory)
except error.CannotListenError as e: except error.CannotListenError as e:
import traceback log.exception("Couldn't bind reflector to port %d", self.reflector_port)
log.error("Couldn't bind reflector to port %d. %s", self.reflector_port, traceback.format_exc()) raise ValueError("{} lbrynet may already be running on your computer.".format(e))
raise ValueError("%s lbrynet may already be running on your computer.", str(e))
return defer.succeed(True) return defer.succeed(True)
def _stop_reflector(self): def _stop_reflector(self):

View file

@ -12,7 +12,7 @@ from lbrynet.lbryfile.StreamDescriptor import publish_sd_blob
from lbrynet.core.PaymentRateManager import PaymentRateManager from lbrynet.core.PaymentRateManager import PaymentRateManager
from lbrynet.core.LBRYMetadata import Metadata, CURRENT_METADATA_VERSION from lbrynet.core.LBRYMetadata import Metadata, CURRENT_METADATA_VERSION
from lbrynet.lbryfilemanager.LBRYFileDownloader import ManagedLBRYFileDownloader 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 lbrynet.conf import LOG_FILE_NAME, REFLECTOR_SERVERS
from twisted.internet import threads, defer, reactor from twisted.internet import threads, defer, reactor
@ -70,9 +70,11 @@ class Publisher(object):
return d return d
def start_reflector(self): def start_reflector(self):
factory = LBRYFileReflectorClientFactory(self.session.blob_manager, factory = reflector.ClientFactory(
self.lbry_file_manager.stream_info_manager, self.session.blob_manager,
self.stream_hash) self.lbry_file_manager.stream_info_manager,
self.stream_hash
)
reactor.connectTCP(self.reflector_server, self.reflector_port, factory) reactor.connectTCP(self.reflector_server, self.reflector_port, factory)
return factory.finished_deferred return factory.finished_deferred

View file

@ -0,0 +1,2 @@
from lbrynet.reflector.server.server import ReflectorServerFactory as ServerFactory
from lbrynet.reflector.client.client import LBRYFileReflectorClientFactory as ClientFactory