From 1e0af94ba2e833c12d70040be095e241eee87de1 Mon Sep 17 00:00:00 2001 From: Jack Date: Mon, 1 Aug 2016 22:31:49 -0400 Subject: [PATCH] add download_descriptor --- lbrynet/lbrynet_daemon/LBRYDaemon.py | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/lbrynet/lbrynet_daemon/LBRYDaemon.py b/lbrynet/lbrynet_daemon/LBRYDaemon.py index ea9124d57..0333b28a7 100644 --- a/lbrynet/lbrynet_daemon/LBRYDaemon.py +++ b/lbrynet/lbrynet_daemon/LBRYDaemon.py @@ -49,7 +49,7 @@ from lbrynet.conf import MIN_BLOB_DATA_PAYMENT_RATE, DEFAULT_MAX_SEARCH_RESULTS, DEFAULT_WALLET, DEFAULT_SEARCH_TIMEOUT, DEFAULT_CACHE_TIME, DEFAULT_UI_BRANCH, LOG_POST_URL, LOG_FILE_NAME, SOURCE_TYPES from lbrynet.conf import SEARCH_SERVERS from lbrynet.conf import DEFAULT_TIMEOUT, WALLET_TYPES -from lbrynet.core.StreamDescriptor import StreamDescriptorIdentifier, download_sd_blob +from lbrynet.core.StreamDescriptor import StreamDescriptorIdentifier, download_sd_blob, BlobStreamDescriptorReader from lbrynet.core.Session import LBRYSession from lbrynet.core.PTCWallet import PTCWallet from lbrynet.core.LBRYWallet import LBRYcrdWallet, LBRYumWallet @@ -2236,6 +2236,24 @@ class LBRYDaemon(jsonrpc.JSONRPC): d.addCallback(lambda r: self._render_response(r, OK_CODE)) return d + def jsonrpc_download_descriptor(self, p): + """ + Download and return a sd blob + + Args: + sd_hash + Returns + sd blob, dict + """ + + sd_hash = p['sd_hash'] + + d = download_sd_blob(self.session, sd_hash, PaymentRateManager(self.session.base_payment_rate_manager)) + d.addCallback(BlobStreamDescriptorReader) + d.addCallback(lambda blob: blob.get_info()) + d.addCallback(lambda r: self._render_response(r, OK_CODE)) + return d + def jsonrpc_get_nametrie(self): """ Get the nametrie