2828from lbry .wallet import WalletManager
2929from lbry .wallet .usage_payment import WalletServerPayer
3030from lbry .torrent .tracker import TrackerClient
31-
32- try :
33- from lbry .torrent .session import TorrentSession
34- except ImportError :
35- TorrentSession = None
31+ from lbry .torrent .session import TorrentSession
3632
3733log = logging .getLogger (__name__ )
3834
@@ -361,10 +357,6 @@ async def start(self):
361357 wallet = self .component_manager .get_component (WALLET_COMPONENT )
362358 node = self .component_manager .get_component (DHT_COMPONENT ) \
363359 if self .component_manager .has_component (DHT_COMPONENT ) else None
364- try :
365- torrent = self .component_manager .get_component (LIBTORRENT_COMPONENT ) if TorrentSession else None
366- except NameError :
367- torrent = None
368360 log .info ('Starting the file manager' )
369361 loop = asyncio .get_event_loop ()
370362 self .file_manager = FileManager (
@@ -373,7 +365,8 @@ async def start(self):
373365 self .file_manager .source_managers ['stream' ] = StreamManager (
374366 loop , self .conf , blob_manager , wallet , storage , node ,
375367 )
376- if TorrentSession and LIBTORRENT_COMPONENT not in self .conf .components_to_skip :
368+ if self .component_manager .has_component (LIBTORRENT_COMPONENT ):
369+ torrent = self .component_manager .get_component (LIBTORRENT_COMPONENT )
377370 self .file_manager .source_managers ['torrent' ] = TorrentManager (
378371 loop , self .conf , torrent , storage , self .component_manager .analytics_manager
379372 )
@@ -502,9 +495,8 @@ async def get_status(self):
502495 }
503496
504497 async def start (self ):
505- if TorrentSession :
506- self .torrent_session = TorrentSession (asyncio .get_event_loop (), None )
507- await self .torrent_session .bind () # TODO: specify host/port
498+ self .torrent_session = TorrentSession (asyncio .get_event_loop (), None )
499+ await self .torrent_session .bind () # TODO: specify host/port
508500
509501 async def stop (self ):
510502 if self .torrent_session :
0 commit comments