Esempio n. 1
0
    def __init__(self, peer_port, dht_node_port, known_dht_nodes, fake_wallet,
                 lbrycrd_conf, lbrycrd_dir, use_upnp, data_dir, created_data_dir,
                 lbrycrdd_path):
        """
        @param peer_port: the network port on which to listen for peers

        @param dht_node_port: the network port on which to listen for dht node requests

        @param known_dht_nodes: a list of (ip_address, dht_port) which will be used to join the DHT network
        """
        self.peer_port = peer_port
        self.dht_node_port = dht_node_port
        self.known_dht_nodes = known_dht_nodes
        self.fake_wallet = fake_wallet
        self.lbrycrd_conf = lbrycrd_conf
        self.lbrycrd_dir = lbrycrd_dir
        if not self.lbrycrd_dir:
            if sys.platform == "darwin":
                self.lbrycrd_dir =  os.path.join(os.path.expanduser("~"), "Library/Application Support/lbrycrd")
            else:
                self.lbrycrd_dir = os.path.join(os.path.expanduser("~"), ".lbrycrd")
        if not self.lbrycrd_conf:
            self.lbrycrd_conf = os.path.join(self.lbrycrd_dir, "lbrycrd.conf")
        self.lbrycrdd_path = lbrycrdd_path
        self.use_upnp = use_upnp
        self.lbry_server_port = None
        self.session = None
        self.lbry_file_metadata_manager = None
        self.lbry_file_manager = None
        self.db_dir = data_dir
        self.current_db_revision = 1
        self.blobfile_dir = os.path.join(self.db_dir, "blobfiles")
        self.created_data_dir = created_data_dir
        self.plugin_manager = PluginManager()
        self.plugin_manager.setPluginPlaces([
            os.path.join(self.db_dir, "plugins"),
            os.path.join(os.path.dirname(__file__), "plugins"),
        ])
        self.command_handlers = []
        self.query_handlers = {}

        self.settings = LBRYSettings(self.db_dir)
        self.blob_request_payment_rate_manager = None
        self.lbryid = None
        self.sd_identifier = StreamDescriptorIdentifier()
        self.plugin_objects = []
        self.db_migration_revisions = None